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

rn-splash

v0.0.5

Published

react native splash screen

Downloads

3

Readme

RN-SPLASH

yarn add rn-splash

  • A splash screen that runs on the native thread and is dismissed on the JavaScript thread

Two separate set-ups, same implementation in React-Native land

IOS

  • Uses the Launch Image catalog (a single image) to show while the app is loading.
  • Launch Images are specific to phone sizes to you will have to create separate images for each screen size

Android

  • Since there are 13,000+ Android devices, creating an image for each screen would be counter productive.
  • I have decided to go with a 2-image approach
  • One image is used as the background and the other image is centered within the background and is called the logo

Installation (iOS)

  • Drag RNSplashScreen.xcodeproj to your project on Xcode.

  • Click on your main project file (the one that represents the .xcodeproj) select Build Phases and drag libRNSplashScreen.a from the Products folder inside the RNSplashScreen.xcodeproj.

  • Look for Header Search Paths and make sure it contains $(SRCROOT)/../../../react-native/React as recursive.

  • In your project, Look for Header Search Paths and make sure it contains $(SRCROOT)/../node_modules/rn-splash/ios/RNSplashScreen/RNSplashScreen as recursive

  • delete your project's LaunchScreen.xib

  • Add your app's launch image set

In AppDelegate.m add two lines of code, remove one
// right below other imports
#import "RNSplashScreen.h"

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

// replace with this
[RNSplashScreen open:rootView];

Installation (Android)

  • In android/settings.gradle
...
include ':rn-splash'
project(':rn-splash').projectDir = new File(rootProject.projectDir, '../node_modules/rn-splash/android')
  • In android/app/build.gradle
...
dependencies {
    ...
    // From node_modules
    compile project(':rn-splash')
}
  • Create a drawable folder to put your splash images in. The path should be android/app/src/main/res/drawable

  • Make the background image title is background.{extension} full path res/drawable/background.{extension}

  • Make the logo image title is logo.{extension} full path res/drawable/logo.{extension}

  • You can make folders for different screen resolutions

drawable-ldpi/
  background.png
  logo.png

drawable-mdpi/
  background.png
  logo.png

drawable-hdpi/
  background.png
  logo.png

drawable-xhdpi/
  background.png
  logo.png

drawable-xxhdpi/
  background.png
  logo.png

drawable-xxxhdpi/
  background.png
  logo.png

We also need to tell Java Land how big to make the center logo within the background.

  • Create a file called integers/xml within your projects values
  • full path android/app/src/main/res/values/integers.xml
  • put two values, logo_height and logo_width within
<resources>
    <integer name="logo_height">100</integer>
    <integer name="logo_width">100</integer>
</resources>

MainActivity.java

// import these FOUR things
import com.parkerdan.rnsplashscreen.RNSplashScreen;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.ReactInstanceManager;
import android.os.Bundle;

// Add this method to the MainActivity class
  @Override
    protected void onCreate(Bundle savedInstanceState) {
      RNSplashScreen.show(this);
      super.onCreate(savedInstanceState);
   }

MainApplication.java

// import the package
import com.parkerdan.rnsplashscreen.RNSplashScreen;


// Add to packages
...
    new MainReactPackage(),
    new RNSplashScreenPackage()
...

Usage

...
import SplashScreen from 'rn-splash'
...
componentDidMount () {
  SplashScreen.close("scale", 850, 500)
}
...

Method

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

    • animationType: one of ("scale","fade","none")
    • duration: determine the duration of animation
    • delay: determine the delay of animation