diff --git a/README.md b/README.md index 604c2f6a7..3cb5847d4 100644 --- a/README.md +++ b/README.md @@ -217,8 +217,9 @@ when the user interacts with an element. The [iOS Guidelines](https://developer. parent={View} values={{ userHandle: currentUser?.login }} components={[ - , - + /* be sure to include a key={index} prop to prevent React list/key warning */ + , + ]} /> ``` diff --git a/src/components/LoginSignUp/LoginForm.tsx b/src/components/LoginSignUp/LoginForm.tsx index 6b5cc2c35..eb625335a 100644 --- a/src/components/LoginSignUp/LoginForm.tsx +++ b/src/components/LoginSignUp/LoginForm.tsx @@ -190,8 +190,12 @@ const LoginForm = ( { i18nKey="Dont-have-an-account" onPress={( ) => navigation.navigate( "SignUp" )} components={[ - , , + ]} diff --git a/src/components/LoginSignUp/SignUpConfirmationForm.tsx b/src/components/LoginSignUp/SignUpConfirmationForm.tsx index 7b73c4e7e..fb6fc5e2d 100644 --- a/src/components/LoginSignUp/SignUpConfirmationForm.tsx +++ b/src/components/LoginSignUp/SignUpConfirmationForm.tsx @@ -149,8 +149,8 @@ const SignUpConfirmationForm = ( ) => { i18nKey="I-agree-to-the-Terms-of-Use" onPress={() => setChecked( !checked )} components={[ - , - + , + ]} /> { const currentUser = useCurrentUser( ) as User; - const showTaxonName = useCallback( ( fontComponent: FC ) => ( - - ), [ - currentUser?.prefers_common_names, - currentUser?.prefers_scientific_name_first, - taxon, - withdrawn - ] ); - return ( { i18nKey="Disagreement" values={{ username }} components={[ - showTaxonName( Body4 ) + ]} /> diff --git a/src/components/ObsDetails/Sheets/PotentialDisagreementSheet.js b/src/components/ObsDetails/Sheets/PotentialDisagreementSheet.tsx similarity index 72% rename from src/components/ObsDetails/Sheets/PotentialDisagreementSheet.js rename to src/components/ObsDetails/Sheets/PotentialDisagreementSheet.tsx index 614e58a4b..b36023e68 100644 --- a/src/components/ObsDetails/Sheets/PotentialDisagreementSheet.js +++ b/src/components/ObsDetails/Sheets/PotentialDisagreementSheet.tsx @@ -1,5 +1,4 @@ -// @flow - +import type { ApiTaxon } from "api/types"; import { Body1, DisplayTaxon, @@ -7,16 +6,16 @@ import { RadioButtonSheet } from "components/SharedComponents"; import { View } from "components/styledComponents"; -import type { Node } from "react"; import React from "react"; import { Trans } from "react-i18next"; +import type { RealmTaxon } from "realmModels/types"; import { useCurrentUser, useTranslation } from "sharedHooks"; interface Props { - onPressClose: Function, - onPotentialDisagreePressed: Function, - newTaxon: Object, - oldTaxon: Object + onPressClose: () => void, + onPotentialDisagreePressed: ( _checkedValue: string ) => void; + newTaxon: RealmTaxon | ApiTaxon, + oldTaxon: RealmTaxon | ApiTaxon } const PotentialDisagreementSheet = ( { @@ -24,12 +23,13 @@ const PotentialDisagreementSheet = ( { onPotentialDisagreePressed, newTaxon, oldTaxon -}: Props ): Node => { +}: Props ) => { const { t } = useTranslation( ); const currentUser = useCurrentUser( ); - const showTaxonName = ( taxon, fontComponent ) => ( + const showTaxonName = ( reactKey: string, taxon: object, fontComponent: React.FC ) => ( , showTaxonName( newTaxon, Body1 )]} + components={[ + , + showTaxonName( "1", newTaxon, Body1 ) + ]} /> ) }, @@ -56,7 +59,10 @@ const PotentialDisagreementSheet = ( { labelComponent: ( , showTaxonName( newTaxon, Body1 )]} + components={[ + , + showTaxonName( "1", newTaxon, Body1 ) + ]} /> ) } @@ -65,7 +71,10 @@ const PotentialDisagreementSheet = ( { const topDescriptionText = ( , showTaxonName( oldTaxon, List2 )]} + components={[ + , + showTaxonName( "1", oldTaxon, List2 ) + ]} /> ); diff --git a/src/components/SharedComponents/Sheets/RadioButtonSheet.tsx b/src/components/SharedComponents/Sheets/RadioButtonSheet.tsx index 2ea48b790..f75f7c44e 100644 --- a/src/components/SharedComponents/Sheets/RadioButtonSheet.tsx +++ b/src/components/SharedComponents/Sheets/RadioButtonSheet.tsx @@ -9,7 +9,7 @@ import useTranslation from "sharedHooks/useTranslation"; interface Props { bottomComponent?: React.JSX.Element - buttonRowClassName?: boolean + buttonRowClassName?: string confirm: ( _checkedValue: string ) => void; confirmText?: string; headerText: string,