Files
iNaturalistReactNative/src/components/SharedComponents/SimpleObservationLocation.js
Angie 25d0ac7e22 Removes location picker from match screen, fetches user location and reload suggestions (#2703)
* Removes location picker from match screen, fetches user location and reloads suggestions instead

* fix variable name

* Remove unused prop

* changes requested, changes to fetching place guess, changes to refetch offline

* Close permission gate when permissions denied initially

* change toggle to set in reducer

* add optional chaining to location values

* Add optional chaining for place name

* Closing on initial block optional

The function of closing the permission gate on pressing the initial block button was as far as I can see only scoped to the Match container.

---------

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-03-04 12:22:10 +01:00

47 lines
994 B
JavaScript

// @flow
import checkCamelAndSnakeCase from "components/ObsDetails/helpers/checkCamelAndSnakeCase";
import { Heading2 } from "components/SharedComponents";
import type { Node } from "react";
import React, { useMemo } from "react";
import { useTranslation } from "sharedHooks";
type Props = {
observation: Object
};
const SimpleObservationLocation = ( {
observation
}: Props ): Node => {
const { t } = useTranslation( );
const displayLocation = useMemo(
( ) => checkCamelAndSnakeCase(
observation,
observation.private_place_guess
? "privatePlaceGuess"
: "placeGuess"
),
[observation]
);
if ( !observation ) {
return null;
}
return (
<Heading2
className="text-darkGray"
ellipsizeMode="tail"
accessible
accessibilityLabel={t( "Location" )}
accessibilityValue={{
text: displayLocation
}}
>
{displayLocation}
</Heading2>
);
};
export default SimpleObservationLocation;