如何在React Native Expo(生产环境)中实现应用程序重新加载

6

我尝试使用react-native-restart创建重启,但是在调用RNRestart.Restart()时出现错误:

[未处理的Promise拒绝:TypeError:空值不是对象(评估'_reactNativeRestart.default.Restart')]

如何在生产环境中实现重新加载?

p.s. 我使用expo


我已经在阅读了。 - albefoxs
如果您正在使用托管工作流,请从expo-updates调用reloadAsync - Dmitro_
1个回答

10
你可以使用expo-updates,只需运行expo install expo-updates 并使用 reloadAsync 方法重新启动应用程序。
import * as Updates from 'expo-updates';
Updates.reloadAsync()

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接