mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-05-04 21:53:59 -04:00
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import classnames from "classnames";
|
|
import { INatIconButton } from "components/SharedComponents";
|
|
import React from "react";
|
|
import useTranslation from "sharedHooks/useTranslation";
|
|
import { getShadow } from "styles/global";
|
|
|
|
const DROP_SHADOW = getShadow( );
|
|
|
|
interface Props {
|
|
currentLocationButtonClassName?: string;
|
|
onPress: () => void;
|
|
showCurrentLocationButton?: boolean;
|
|
renderPermissionsGate: () => React.JSX.Element;
|
|
}
|
|
|
|
const CurrentLocationButton = ( {
|
|
currentLocationButtonClassName,
|
|
onPress,
|
|
showCurrentLocationButton,
|
|
renderPermissionsGate
|
|
}: Props ) => {
|
|
const { t } = useTranslation( );
|
|
return showCurrentLocationButton && (
|
|
<>
|
|
<INatIconButton
|
|
icon="location-crosshairs"
|
|
className={classnames(
|
|
"absolute bottom-5 right-5 bg-white rounded-full",
|
|
currentLocationButtonClassName
|
|
)}
|
|
style={DROP_SHADOW}
|
|
accessibilityLabel={t( "Zoom-to-current-location" )}
|
|
onPress={onPress}
|
|
testID="Map.CurrentLocationButton"
|
|
/>
|
|
{renderPermissionsGate( )}
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default CurrentLocationButton;
|