3

React Native navigation initialization handler

 2 years ago
source link: https://reactnativeexample.com/react-native-navigation-initialization-handler/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Navigation

React Native navigation initialization handler

Mar 27, 2022

1 min read

React Native Wait Navigation

React Native Navigation initializion handler.

Installation

npm i react-native-wait-navigation
yarn add react-native-wait-navigation

Usage

import { createRef } from 'react';
import { NavigationContainer, NavigationContainerRef } from '@react-navigation/native';
import ReactNativeWaitNavigation from 'react-native-wait-navigation';

export const navigationRef = createRef<NavigationContainerRef>();

export default function App() {
  const handleNavigationReady = () => {
    const emitter = new ReactNativeWaitNavigation(navigationRef);

    emitter.on('initialized', () => {
      closeSplashScreen();
    });
  };

  return (
    <NavigationContainer ref={navigationRef} onReady={handleNavigationReady}>
        {/* Rest of your app code */}
    </NavigationContainer>
  );
}

GitHub

View Github


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK