Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Center button has no hover and press effect #43452

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 6 additions & 15 deletions src/components/MapView/MapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ import Mapbox, {MarkerView, setAccessToken} from '@rnmapbox/maps';
import {forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState} from 'react';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import Icon from '@components/Icon';
import Button from '@components/Button';
import * as Expensicons from '@components/Icon/Expensicons';
import {PressableWithoutFeedback} from '@components/Pressable';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import * as UserLocation from '@libs/actions/UserLocation';
import getCurrentPosition from '@libs/getCurrentPosition';
import type {GeolocationErrorCallback} from '@libs/getCurrentPosition/getCurrentPosition.types';
import {GeolocationErrorCode} from '@libs/getCurrentPosition/getCurrentPosition.types';
import colors from '@styles/theme/colors';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import useLocalize from '@src/hooks/useLocalize';
import useNetwork from '@src/hooks/useNetwork';
Expand Down Expand Up @@ -238,20 +236,13 @@ const MapView = forwardRef<MapViewHandle, ComponentProps>(
{directionCoordinates && <Direction coordinates={directionCoordinates} />}
</Mapbox.MapView>
<View style={[styles.pAbsolute, styles.p5, styles.t0, styles.r0, {zIndex: 1}]}>
<PressableWithoutFeedback
accessibilityRole={CONST.ROLE.BUTTON}
<Button
onPress={centerMap}
iconFill={theme.icon}
medium
icon={Expensicons.Crosshair}
accessibilityLabel={translate('common.center')}
>
<View style={styles.primaryMediumIcon}>
<Icon
width={variables.iconSizeNormal}
height={variables.iconSizeNormal}
src={Expensicons.Crosshair}
fill={theme.icon}
/>
</View>
</PressableWithoutFeedback>
/>
</View>
</View>
) : (
Expand Down
21 changes: 6 additions & 15 deletions src/components/MapView/MapView.website.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ import type {MapRef} from 'react-map-gl';
import Map, {Marker} from 'react-map-gl';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import Icon from '@components/Icon';
import Button from '@components/Button';
import * as Expensicons from '@components/Icon/Expensicons';
import {PressableWithoutFeedback} from '@components/Pressable';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import type {GeolocationErrorCallback} from '@libs/getCurrentPosition/getCurrentPosition.types';
import {GeolocationErrorCode} from '@libs/getCurrentPosition/getCurrentPosition.types';
import variables from '@styles/variables';
import * as UserLocation from '@userActions/UserLocation';
import CONST from '@src/CONST';
import useLocalize from '@src/hooks/useLocalize';
Expand Down Expand Up @@ -253,20 +251,13 @@ const MapView = forwardRef<MapViewHandle, ComponentProps>(
{directionCoordinates && <Direction coordinates={directionCoordinates} />}
</Map>
<View style={[styles.pAbsolute, styles.p5, styles.t0, styles.r0, {zIndex: 1}]}>
<PressableWithoutFeedback
accessibilityRole={CONST.ROLE.BUTTON}
<Button
onPress={centerMap}
iconFill={theme.icon}
medium
icon={Expensicons.Crosshair}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd want to keep the accessibilityLabel if going down this route.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@truph01 Bump on this 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jjcoffee I updated it

accessibilityLabel={translate('common.center')}
>
<View style={styles.primaryMediumIcon}>
<Icon
width={variables.iconSizeNormal}
height={variables.iconSizeNormal}
src={Expensicons.Crosshair}
fill={theme.icon}
/>
</View>
</PressableWithoutFeedback>
/>
</View>
</View>
) : (
Expand Down
Loading