Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update readme's for iOS integration issue with app start #631

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,26 +139,35 @@ public class MainActivity extends ReactActivity {

**iOS:**

Update `AppDelegate.m` with the following additions:
Update `AppDelegate.mm` with the following additions:


```obj-c
#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#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
Expand Down
15 changes: 13 additions & 2 deletions README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public class MainActivity extends ReactActivity {

**iOS:**

更新你的AppDelegate.m 文件如下:
更新你的AppDelegate.mm 文件如下:


```obj-c
Expand All @@ -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
Expand Down