在 ios 上反应原生 57.7 黑屏

kya*_*maz 5 ios react-native

我们正在尝试将 React Native 应用程序从版本 55 更新到 57.7。这真的很痛苦,但它同时在 ios 和 android 上构建。它在 Android 上运行良好,但在 ios 上,它卡在黑屏上。看起来像这个问题,运行 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;
    }
Run Code Online (Sandbox Code Playgroud)

索引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>
);
Run Code Online (Sandbox Code Playgroud)

感谢您的帮助