MCPcopy Index your code
hub / github.com/fabio-alss-freitas/react-native-animated-splash-screen

github.com/fabio-alss-freitas/react-native-animated-splash-screen @V1.0.5

Chat with this repo
repository ↗ · DeepWiki ↗ · release V1.0.5 ↗ · + Follow
3 symbols 6 edges 2 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

license Version GitHub All Releases npm GitHub issues

React Native Animated Splash Screen

GitHub followers GitHub stars

Animated splash screen for Android and iOS. It is based on Implementing Twitter’s App Loading Animation in React Native topic from RN. To work on Android, it use an Image instead of MaskedView.

Examples

React Native Animated Splash Screen Android 1 React Native Animated Splash Screen Android 2

Features

  • Custom background color
  • Custom logo
  • Custom logo size

Installation

yarn add react-native-animated-splash-screen

or

npm install --save react-native-animated-splash-screen

Usage

import AnimatedSplash from "react-native-animated-splash-screen";

render() {
    return (
      <AnimatedSplash
        isLoaded={this.state.isLoaded}
        logoImage={require("./assets/logo.png")}
        backgroundColor={"#262626"}
        logoHeight={150}
        logoWidht={150}
      >
        <App />
      </AnimatedSplash>
    );
  }

Props

Name Description Type Required Default Value
isLoaded Condition to show children component and finish the animation. Boolean
backgroundColor Splash screen background color. String #f00 '#f00'
logoImage Splash screen logo image. Object
logoWidth Logo image width in px. Number 150
logoHeight Logo image height in px. Number 150
children Children to render inside this component. Node null
preload Condition to load children component while wait isLoaded prop be True. Boolean true

Example with React Navigation

1) Create a navigator (Stack or Switch) normally:

const AppNavigator = createStackNavigator(
  {
    home: {
      screen: HomeScreen,
      navigationOptions: {
        header: null
      }
    },
    dashboard: {
      screen: DashboardScreen,
      navigationOptions: {
        title: "Dashboard"
      }
    }
  },
  {
    initialRouteName: "home"
  }
);

2) Create an app container:

const Container = createAppContainer(AppNavigator);

3) Pass the container as a children of AnimatedSplash:

class App extends React.Component {
  state = {
    isLoaded: false
  };

  async componentDidMount() {
    await loadAsync();
    this.setState({ isLoaded: true });
  }

  render() {
    return (
      <AnimatedSplash
        isLoaded={this.state.isLoaded}
        logoImage={require("./assets/logo.png")}
        backgroundColor={"#262626"}
        logoHeight={150}
        logoWidht={150}
      >
        <Container />
      </AnimatedSplash>
    );
  }
}

export default App;

Example with React Navigation (setting isLoaded inside a screen of navigator)

Make sure you have done the previous step.

1) Pass the IsLoaded function as screenProps of Container:

class App extends React.Component {
  state = {
    isLoaded: false
  };

  setAppLoaded = () => {
    this.setState({ isLoaded: true });
  };

  render() {
    return (
      <AnimatedSplash
        isLoaded={this.state.isLoaded}
        logoImage={require("./assets/logo.png")}
        backgroundColor={"#262626"}
        logoHeight={150}
        logoWidht={150}
      >
        <Container screenProps={{ setAppLoaded: this.setAppLoaded }} />
      </AnimatedSplash>
    );
  }
}

export default App;

2) Update your navigator to handle screenProps on the chosen screen:

const AppNavigator = createSwitchNavigator(
  {
    home: {
      screen: props => (
        <HomeScreen {...props} setAppLoaded={props.screenProps.setAppLoaded} />
      )
    },
    dashboard: { screen: DashboardScreen }
  },
  {
    initialRouteName: "home"
  }
);

2) Call the function on the chosen screen:

this.props.setAppLoaded();

Author

Fabio Freitas

License

MIT

Core symbols most depended-on inside this repo

Shape

Function 2
Class 1

Languages

TypeScript100%

Modules by API surface

src/AnimatedSplash.js3 symbols

For agents

$ claude mcp add react-native-animated-splash-screen \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page