我们正在尝试将我们的React Native应用程序从版本55更新到57.7。确实很痛苦,但它同时在ios和android上构建。在Android上运行正常,但在ios上,它被固定在黑屏上。 看起来像这个问题,Getting an entire black screen when running react-native run-ios。一样。没运气。 我什至尝试在index.js(仍然是黑屏)中进行简单查看。在js或xcode上的开发人员控制台中都没有错误。 不知道我做错了什么。
我们按照官方程序进行了以下链接升级: https://github.com/react-native-community/react-native-releases/blob/master/CHANGELOG.md
和我的代码如下: appDelegate.m
#import "AppDelegate.h"
#import <React/RCTBundleURLProvider.h>
#import <React/RCTPushNotificationManager.h>
#import <React/RCTRootView.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <RNGoogleSignin/RNGoogleSignin.h>
#import "Orientation.h"
#import <ReactNativeNavigation/ReactNativeNavigation.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation;
#ifdef DEBUG
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor whiteColor];
[ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];
[[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
return YES;
}
索引js
import {AppRegistry, View, Text} from 'react-native';
AppRegistry.registerComponent(APP_NAME, () => {
return(
<View style={{ height:500, width:300, backgroundColor:"orange"}}>
<Text>hello</Text>
</View>
);
感谢您的帮助