Skip to content

Support custom view for Android #72

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

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Allow loading a custom XIB instead of an image
  • Loading branch information
danhodos committed Oct 9, 2017
commit f6ee8e1301a358bd0554c71b65409d91c7e55626
1 change: 1 addition & 0 deletions ios/RCTSplashScreen/RCTSplashScreen/RCTSplashScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ typedef NS_ENUM(NSInteger, RCTCameraAspect) {

+ (void)open:(RCTRootView *)v;
+ (void)open:(RCTRootView *)v withImageNamed:(NSString *)imgName;
+ (void)open:(RCTRootView *)v withXibNamed:(NSString *)xibName;

@end
12 changes: 12 additions & 0 deletions ios/RCTSplashScreen/RCTSplashScreen/RCTSplashScreen.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ + (void)open:(RCTRootView *)v withImageNamed:(NSString *)imageName {
[rootView setLoadingView:view];
}

+ (void)open:(RCTRootView *)v withXibNamed:(NSString *)xibName {
rootView = v;

NSArray *nibContents = [[NSBundle mainBundle] loadNibNamed:xibName owner:nil options:nil];
UIView *view = [nibContents lastObject];
view.frame = rootView.bounds;

[[NSNotificationCenter defaultCenter] removeObserver:rootView name:RCTContentDidAppearNotification object:rootView];

[rootView setLoadingView:view];
}

RCT_EXPORT_METHOD(close:(NSDictionary *)options) {
if (!rootView) {
return;
Expand Down