From d99b8cb3687f09f6c481b7d33f659836008074b1 Mon Sep 17 00:00:00 2001 From: mars-lan Date: Fri, 24 Nov 2017 15:57:51 -0800 Subject: [PATCH 1/2] Allow using a custom loading view --- ios/RCTSplashScreen/RCTSplashScreen/RCTSplashScreen.h | 1 + ios/RCTSplashScreen/RCTSplashScreen/RCTSplashScreen.m | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/ios/RCTSplashScreen/RCTSplashScreen/RCTSplashScreen.h b/ios/RCTSplashScreen/RCTSplashScreen/RCTSplashScreen.h index 651b3f5..26684ed 100644 --- a/ios/RCTSplashScreen/RCTSplashScreen/RCTSplashScreen.h +++ b/ios/RCTSplashScreen/RCTSplashScreen/RCTSplashScreen.h @@ -11,5 +11,6 @@ typedef NS_ENUM(NSInteger, RCTCameraAspect) { + (void)open:(RCTRootView *)v; + (void)open:(RCTRootView *)v withImageNamed:(NSString *)imgName; ++ (void)open:(RCTRootView *)v withLoadingView:(UIView *)loadingView; @end diff --git a/ios/RCTSplashScreen/RCTSplashScreen/RCTSplashScreen.m b/ios/RCTSplashScreen/RCTSplashScreen/RCTSplashScreen.m index 278fefd..ea728f2 100644 --- a/ios/RCTSplashScreen/RCTSplashScreen/RCTSplashScreen.m +++ b/ios/RCTSplashScreen/RCTSplashScreen/RCTSplashScreen.m @@ -30,6 +30,14 @@ + (void)open:(RCTRootView *)v withImageNamed:(NSString *)imageName { [rootView setLoadingView:view]; } ++ (void)open:(RCTRootView *)v withLoadingView:(UIView *)loadingView { + rootView = v; + + [[NSNotificationCenter defaultCenter] removeObserver:rootView name:RCTContentDidAppearNotification object:rootView]; + + [rootView setLoadingView:loadingView]; +} + RCT_EXPORT_METHOD(close:(NSDictionary *)options) { if (!rootView) { return; From 3657611c458dc640d9b820bf9828f0143d40b014 Mon Sep 17 00:00:00 2001 From: mars-lan Date: Sun, 18 Feb 2018 16:00:21 -0800 Subject: [PATCH 2/2] Add podspec file for Cocoapods-based installation --- react-native-smart-splash-screen.podspec | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 react-native-smart-splash-screen.podspec diff --git a/react-native-smart-splash-screen.podspec b/react-native-smart-splash-screen.podspec new file mode 100644 index 0000000..a756a5c --- /dev/null +++ b/react-native-smart-splash-screen.podspec @@ -0,0 +1,22 @@ +require 'json' + +package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) + +Pod::Spec.new do |s| + s.name = 'react-native-smart-splash-screen' + s.version = package['version'] + s.summary = package['description'] + s.description = package['description'] + s.license = package['license'] + s.author = package['author'] + s.homepage = package['homepage'] + s.source = { :git => 'https://github.com/react-native-component/react-native-smart-splash-screen', :tag => s.version } + + s.requires_arc = true + s.platform = :ios, '8.0' + + s.preserve_paths = 'LICENSE', 'README.md', 'package.json', 'index.js' + s.source_files = 'ios/**/*.{h,m}' + + s.dependency 'React' +end