npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nghinv/react-native-splash-screen

v2.0.0

Published

react-native-splash-screen

Downloads

2

Readme

@nghinv/react-native-splash-screen

npm npm

A smart splash screen for React Native apps, written in JS, oc and java for cross-platform support. It works on iOS and Android.

Preview

react-native-splash-screen-ios react-native-splash-screen-android

Installation

  • Use yarn
yarn add @nghinv/react-native-splash-screen
  • Use npm
npm install @nghinv/react-native-splash-screen --save

Installation (iOS)

  • With RN >= 0.60 run cd ios && pod install

  • With RN < 0.60 run react-native link @nghinv/react-native-splash-screen

  • delete your project's LaunchScreen.xib

  • Drag SplashScreenResource folder to your project if you want change image, replace splash.png or add a image with your custom name

  • In AppDelegate.m

...

#import "RCTSplashScreen.h" //import interface

...

RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation moduleName:@"ReactNativeComponents" initialProperties:nil launchOptions:launchOptions];

[RCTSplashScreen open:rootView withImageNamed:@"splash"]; // activate splashscreen, imagename from LaunchScreen.xib

rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;

Installation (Android)

  • Auto link with RN >= 0.60

  • Run react-native link @nghinv/react-native-splash-screen with RN <0.60

  • Add your own drawable/splash.png to android/app/src/main/res/, it is recommended to add drawable-?dpi folders that you need.

    • drawable-hdpi
    • drawable-mdpi
    • drawable-xhdpi
    • drawable-xxhdpi
    • drawable-xxxhdpi
  • in MainActivity.java

...
import android.os.Bundle;
import com.reactnativecomponent.splashscreen.RCTSplashScreen; //import RCTSplashScreen
...
@Override
protected void onCreate(Bundle savedInstanceState) {
    RCTSplashScreen.openSplashScreen(this); //open splashscreen
    super.onCreate(savedInstanceState);
}
  • In android/app/**/styles.xml
...
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="android:windowIsTranslucent">true</item>
</style>
...

Usage

...
import SplashScreen from '@nghinv/react-native-splash-screen';
...
componentDidMount () {
  SplashScreen.close({
    animationType: SplashScreen.animationType.scale,
    duration: 850,
    delay: 500,
  })
}
...

Method

  • close(animationType, duration, delay) close splash screen with custom animation

    • animationType: determine the type of animation. enum(animationType.none, animationType.fade, animationType.scale)
    • duration: determine the duration of animation
    • delay: determine the delay of animation