【问题标题】:Expo - SplashScreen freezes in production with 'eas build' but with 'expo build' it works correctlyExpo - SplashScreen 使用 \'eas build\' 在生产中冻结,但使用 \'expo build\' 它可以正常工作
【发布时间】:2022-11-10 10:23:14
【问题描述】:

这是问题所在。SplashScreen 在生产中冻结eas buildexpo build正常工作.

我在本地没有任何问题,eas build 也没有。

在生产中,使用eas build,当应用程序启动时,SplashScreen 会毫无问题地呈现和隐藏​​,然后呈现登录屏幕。之后,当确实登录时,SplashScreen 出现(我不知道为什么)并卡在那里。

这是应用程序.js文件。我认为问题不在这里,因为在渲染登录屏幕时,初始的 SplashScreen 是隐藏的。

SplashScreen.preventAutoHideAsync()

const App: FC = () => {
  const [appIsReady, setAppIsReady] = useState(false)

  useEffect(() => {
    async function prepare() {
      try {
        await getFonts()
        await setTokenFromStorage()
      } catch (e) {
        console.warn(e)
      } finally {
        setAppIsReady(true)
      }
    }
    prepare()
  }, [])

  const onLayoutRootView = useCallback(async () => {
    if (appIsReady) {
      await SplashScreen.hideAsync()
    }
  }, [appIsReady])

  useEffect(() => {
    if (appIsReady) onLayoutRootView()
  }, [appIsReady])

  return appIsReady ? (
    <Provider store={store}>
      <ContextProvider>
        <AppNavigator />
        <Toast config={toastConfig} />
      </ContextProvider>
    </Provider>
  ) : null
}

export default App

我真的不知道应该查看哪些文件来检查问题,但我也不明白为什么当我使用expo build 而不是eas build 构建时应用程序行为是正确的。

【问题讨论】:

  • 我读到它可能是.env 文件,但我不这么认为,因为我登录时服务器会收到请求。

标签: build expo splash-screen production eas


【解决方案1】:

我也有同样的问题。你设法解决了吗?

【讨论】:

猜你喜欢
  • 2023-01-05
  • 1970-01-01
  • 2022-12-04
  • 2022-06-29
  • 2022-06-16
  • 2023-01-26
  • 2019-05-02
  • 2022-09-28
  • 2022-10-24
相关资源
最近更新 更多