Obtuve la navegación realizada con la navegación de la pestaña inferior en reaccionar nativo.
Código de ejemplo
<BottomTab.Screen name="Home" component={RootPasswordsHandler} options={(): { tabBarIcon: ({ color }: { color: any }) => JSX.Element; headerRight: () => JSX.Element; title: string; } => ({ title: globalState.languageHandler.screenNames.HOME_SCREEN, tabBarIcon: ({ color }): JSX.Element => <TabBarIcon name="home" color={color} />, headerRight: (): JSX.Element => ( <TextInput style={styles.navStyles.input} placeholder={globalState.languageHandler.generic.FIND_PASSWORD} /> ), })} /> En el componente RootPasswordsHandler , el componente obtiene las contraseñas de la base de datos, las guarda en el estado local useState y las representa.
Me gustaría agregar una entrada as in code example above , que accederá a esos datos y filtrará la matriz de contraseñas.
¿Cómo puedo lograr eso? Soy bastante nuevo en reaccionar nativo y estoy completamente atrapado aquí.
Puede usar setOptions en su componente y luego acceder a ellos en BottomTab
¡Ejemplo de documentos para ver cómo se pasa el value !
function ProfileScreen({ navigation, route }) { const [value, onChangeText] = React.useState(route.params.title); React.useLayoutEffect(() => { navigation.setOptions({ title: value === '' ? 'No title' : value, }); }, [navigation, value]); return ( <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}> <TextInput style={{ height: 40, borderColor: 'gray', borderWidth: 1 }} onChangeText={onChangeText} value={value} /> <Button title="Go back" onPress={() => navigation.goBack()} /> </View> ); }