【发布时间】:2022-11-10 10:23:14
【问题描述】:
这是问题所在。SplashScreen 在生产中冻结eas build 但 expo 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