通过expo项目,我们可以启动捆绑包并将 ** CONNECTION** 更改为从开发人员工具中用于全局加载捆绑包的隧道。我们如何为react-native项目全局加载包?我尝试使用公共 IP 地址,但捆绑包需要连接到同一个网络。
问问题
54 次
1 回答
0
基于CodePush的实现。您应该能够通过本机代码从其远程位置下载捆绑包,并通过覆盖MainApplication.java
'getJSBundle()
方法返回其位置。
// Override the getJSBundleFile method to let
// your runtime determine where to get the JS
// bundle location from on each app start
@Override
protected String getJSBundleFile() {
// your implementation here
}
AppDelegate.m
通过覆盖的方法,使用 Objective-C 实现 iOS 的相同sourceURLForBridge
方法:
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
// your implementation here
}
虽然对于 react-native 包必须在本地可用,但您的本机代码可以下载旧包并将其与新包交换,然后返回新包的位置。
于 2022-01-24T15:18:52.203 回答