React-native-splash-screen: SplashScreen.show() is not a function

Created on 7 Nov 2016  路  18Comments  路  Source: crazycodeboy/react-native-splash-screen

seems like you only exported hide method in SplashScreen.m but not show?

Most helpful comment

@crazycodeboy if show() is only a native method, then how can we show the Splash Screen at other times during the app experience?

I'm trying to show the splash screen during page transitions, for example. And it doesn't look like I can do this through react-native-splash-screen.

All 18 comments

Yes, but you can use it in the following way:

Android

public class MainActivity extends ReactActivity {
   @Override
    protected void onCreate(Bundle savedInstanceState) {
        + SplashScreen.show(this);  // here
        super.onCreate(savedInstanceState);
    }
    // ...other code
}

iOS

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // ...other code

    + [SplashScreen show];  // here
    return YES;
}

I would like to on app resume, show SplashScreen again until contents are loaded.

Is that possible? I'm detecting app resume in React Native Javascript

Can you export the show method, and then send a pull request?

public class MainActivity extends ReactActivity {

/**
 * Returns the name of the main component registered from JavaScript.
 * This is used to schedule rendering of the component.
 */
@Override
protected String getMainComponentName() {
    SplashScreen.show(this,true);
}

}

I've downloaded and installed the splash screen plugin automatically. Now, I can see SplashScreen.xcodeproj in Libraries and libSplashScreen.a in "Link Binary With Libraries" section. But when I try #import "SplashScreen.h", it gives file not found error.

splashscreen - file not found

react-native link at the home directory of your project @sairasamdanii

I did same. And I can see "react-native-splash-screen" in node_modules of my project. Can you please notice that imports in my AppDelegate are like "#import " while in SplashScreen example, they are used as "#import "RCTRootView.h" ". Is there any version difference?

I've created my project through plain terminal commands and code written in it is the boiler code provided by react native itself.

@sairasamdanii Are you using v40 of React Native? The iOS native headers have been moved. See also https://github.com/facebook/react-native/releases/tag/v0.40.0 . Quote from that page: "This means that all iOS native libraries need a major version bump for RN 0.40."

Yeah it appears that the SplashScreen setup is broken after RN 0.40. I'm having the same issues.

@crazycodeboy show() looks like a function under api but it isn't...

@siemya show() is a native method

@crazycodeboy if show() is only a native method, then how can we show the Splash Screen at other times during the app experience?

I'm trying to show the splash screen during page transitions, for example. And it doesn't look like I can do this through react-native-splash-screen.

@crazycodeboy i also want to show the splash screen when i reload the js bundle, thats why i need a show function. 陌s there any other way to do it?

hide is undefined

@siemya @jdmcpeek @JakeRawr @crazycodeboy Any update on this? I'm using this with redux-persist and am having a issue #60 . any way to somehow treat the splash screen as a react component and render it at will? I thought about making a component using the same image as the splash screen, but not sure if aspect ratio and layout would match for devices of diff sizes.

@sairasamdanii
Please Go to build setting >> Header search path
add this line :
$(SRCROOT)/../node_modules/react-native-splash-screen/ios
Thanks.

import works for me

we do need this feature

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arnsa picture arnsa  路  5Comments

ijry picture ijry  路  5Comments

luskin picture luskin  路  4Comments

jetre219 picture jetre219  路  4Comments

zxyah picture zxyah  路  4Comments