如何延迟调用AppRegistry.registerComponent

时间:2018-08-03 05:59:19

标签: react-native react-native-stylesheet

在App初始化之前,我需要阅读一些用户设置。此设置将更新应用程序的样式。

我调用AppRegistry.registerComponent时有些延迟,但应用程序崩溃了。在https://github.com/facebook/react-native/issues/17724上发现了此问题,但没有帮助。

1 个答案:

答案 0 :(得分:0)

我找到了答案

AppRegistry.registerComponent("App", () => App);
AppRegistry.registerRunnable(appName, initParams => {
    setTimeout(
        () => AppRegistry.runApplication("App", initParams),
        5000
    );
});