reactjs - React useNavigation 说无法对未安装的组件执行反应状态更新
问题描述
onPressing 按钮 navigation.goBack 触发警告 can't perform a react state update on unmounted component。我正在使用带有 useNavigation 挂钩的反应导航 5。找不到任何解决方法。
<View style={styles.left}>
<TouchableRipple style={styles.back} borderless onPress={() => navigation.goBack()}>
<View style={styles.alignContent}>
<Icon
iconStyle={{ left: -6 }}
size={14}
name="caretleft"
type="antdesign"
color={Colors.green[900]}
containerStyle={{ paddingLeft: 5 }}
/>
<Text style={{ ...styles.buttonTitle, left: -4, color: Colors.green[900] }}>Back</Text>
</View>
</TouchableRipple>
</View>
解决方案
推荐阅读
- android - 为什么当我输入回收站视图时回收站视图没有出现在活动页面中
- python - 如何将代理与我的代码合并(Instaloader python 模块)
- mysql - 如何根据另一个表的选择在表的列中插入值
- c# - 使用 ParallelTask 和 ConcurrentStack 使用单声道导致 Android 崩溃
- c# - HeaderStringFormat 覆盖 Binding 之外的样式
- nativescript - 移动操作系统升级后 NativeScript 应用程序损坏
- .net - .NET 4 到 .NET 4.5.2 - PresentationFramework '方法'get_Command'
- bash - 使用带有破折号('-')的变量的whiptail
- python - 如何让 Flask request.form 返回有序的字典数据?
- google-sheets - 如何在谷歌表格单元格中放置一个href