小编Ber*_*cke的帖子

带反应导航的 Expo SDK 45 启动画面

我刚刚升级到 Expo SDK 45,收到一条警告:“expo-app-loading 已被弃用,取而代之的是 expo-splash-screen:请使用 SplashScreen.preventAutoHideAsync() 和 SplashScren.hideAsync()。https:// docs。 expo.dev/versions/latest/sdk/splash-screen/ .所以我这样做了并按照提供的链接进行操作。

我现在遇到的问题是,在示例中,他们在根视图的 onLayOut 上调用 onLayOutRootView 。现在我正在使用反应导航,因此我的根视图嵌套在我的应用程序中相当深。

我是否必须将此函数传递到根视图,或者是否有办法将此函数传递到我的提供程序/导航容器之一?或者有其他修复吗?

//imports


export default App = () => {
  const [appIsReady, setAppIsReady] = useState(false);
  const scheme = "dark";

  useEffect(() => {
    async function prepare() {
      try {
        // Keep the splash screen visible while we fetch resources
        await SplashScreen.preventAutoHideAsync();
        // Pre-load fonts, make any API calls you need to do here
        await Font.loadAsync(customFonts);
      } catch (e) {
        console.warn(e);
      } finally {
        // Tell …
Run Code Online (Sandbox Code Playgroud)

react-native react-navigation expo

16
推荐指数
3
解决办法
6825
查看次数

标签 统计

expo ×1

react-native ×1

react-navigation ×1