mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-05-18 13:32:27 -04:00
* 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>
47 lines
994 B
JavaScript
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;
|