javascript - 如何确保在 Expo/React Native 中的任何其他内容之前调用代码?
问题描述
我想在任何其他代码之前执行 SplashScreen.preventAutoHideAsync。
我已将它放在任何其他代码之前,包括希望在任何其他功能组件之前但在导入之后调用它
import * as SplashScreen from "expo-splash-screen";
... other imports ...
SplashScreen.preventAutoHideAsync().catch(() => {
/* reloading the app might trigger some race conditions, ignore them */
});
...
export default function App() {
...
}
但是,我不确定import
s 中是否有任何东西导致我的启动画面消失SplashScreen.hideAsync().catch(() => {});
我可以只使用require
而不是import
确保执行顺序吗?
解决方案
推荐阅读
- azure - 为 Azure 表存储 REST API 使用提琴手/邮递员
- ios - 我需要帮助使用 Swift 4 格式化文本字段中的小数位
- string - 组装 8086 TASM - 0Ah 21h 记住最后一个条目
- regex - 正则表达式区分字符串中的所有字符与少数字符大写
- android - GoogleAuthException:未知
- unit-testing - 有没有办法配置一个 runsettings 文件只检查被测的实际项目?
- javascript - AG-GRID & AngularJS - 如何在外部编辑数据
- python - 将参数传递给 tkinter 中的函数
- php - 如何仅在选中时显示按钮
- android - 从 LiveData 触发第二个查询并合并结果(Firestore)?