me sale este error:
Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method. in Card (at CardContainer.tsx:206) in CardContainer (at CardStack.tsx:623) in RNSScreen (at createAnimatedComponent.js:217) in AnimatedComponent (at createAnimatedComponent.js:278) in AnimatedComponentWrapper (at src/index.native.tsx:147) in Screen (at Screens.tsx:74) in MaybeScreen (at CardStack.tsx:616)Este es mi navegador:
const DefaultStackNavigation = () => { return( <NavigationContainer fallback={<View style={{backgroundColor: "#0C0C0C", height: "100%", width: "100%", flex: 1}} />}> <Stack.Navigator screenOptions={{headerShown: false, gestureEnabled: true, gestureDirection: "horizontal", cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS, cardStyle: {backgroundColor: "transparent", flex: 1, height: "100%", width: "100%"}}} independent={false}> <Stack.Screen name="HomeTabs" component={HomeScreen} /> <Stack.Screen name="ChatScreen" component={ChatScreen} /> <Stack.Screen name="Settings" component={SettingsScreen} /> </Stack.Navigator> </NavigationContainer> ); }; Como tengo gestureEnabled = true , puedo deslizar la pantalla hacia la derecha para volver. Pero ahora hay un problema:
Quiero que el usuario elija si quiere deslizar para regresar o si quiere hacer clic en el botón de regresar. Si deslizo la pantalla hacia la derecha, no aparece ningún error y puedo usar la aplicación. Pero si hago clic en mi botón de navigation.goBack() en mi ChatScreen aparece el error (comienzo de esta publicación). Si habilito el encabezado y hago clic en el botón GoBack, tampoco obtengo este error. ¿Cómo puedo evitar que React Native se comporte de esta manera?
Este es mi botón GoBack:
<View style={styles.backArrowContainer}> <TouchableOpacity style={{height: 60, width: 60, justifyContent: "center", alignItems: "center"}} onPress={() => navigation.goBack()}> <BackArrow /> </TouchableOpacity> </View>