From bd2a0575f6032dbafaa724fd6c95e219e919f167 Mon Sep 17 00:00:00 2001 From: Luke Taylor Date: Tue, 7 Nov 2023 13:48:48 +0000 Subject: [PATCH] update readme's for ios integration with newer react native and address issue with connecting to bundler --- README.md | 19 ++++++++++++++----- README.zh.md | 15 +++++++++++++-- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9eb674f9..099295aa 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ public class MainActivity extends ReactActivity { **iOS:** -Update `AppDelegate.m` with the following additions: +Update `AppDelegate.mm` with the following additions: ```obj-c @@ -147,18 +147,27 @@ Update `AppDelegate.m` with the following additions: #import #import -#import "RNSplashScreen.h" // here +#import "RNSplashScreen.h" // <--- import added here @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + self.moduleName = @"ProjectName"; + // You can add your custom initial props in the dictionary below. + // They will be passed down to the ViewController used by React Native. + self.initialProps = @{}; + // ...other code - [RNSplashScreen show]; // here + // This allows the app to finish launching before attaching the splash screen + BOOL didFinish = [super application:application didFinishLaunchingWithOptions:launchOptions]; + + [RNSplashScreen show]; // <--- Method called here // or - //[RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView]; - return YES; + // [RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView]; + + return didFinish; } @end diff --git a/README.zh.md b/README.zh.md index f3a9beb0..842738a7 100644 --- a/README.zh.md +++ b/README.zh.md @@ -130,7 +130,7 @@ public class MainActivity extends ReactActivity { **iOS:** -更新你的AppDelegate.m 文件如下: +更新你的AppDelegate.mm 文件如下: ```obj-c @@ -144,10 +144,21 @@ public class MainActivity extends ReactActivity { - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + self.moduleName = @"ProjectName"; + // You can add your custom initial props in the dictionary below. + // They will be passed down to the ViewController used by React Native. + self.initialProps = @{}; + // ...other code + // 允许应用程序完成启动 + BOOL didFinish = [super application:application didFinishLaunchingWithOptions:launchOptions]; + [RNSplashScreen show]; // 添加这一句,这一句一定要在最后 - return YES; + // or + // [RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView]; + + return didFinish; } @end