Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

161
Vistas
How to navigate from splash screen to Onboarding Screens?

This is SplashScreen.js page

I want to get the splash screen displayed and goes invisible by a timeout and then navigate to Onboarding Screen (sliding splash screens)

import React from 'react';
import { View} from 'react-native';

import LogoImage from './LogoImage.js'
import styles from '../stylesheets/SplashStylesheet.js'


const SplashScreen = ({ navigation }) => {
render() {
        let that = this;
        setTimeout(function(){that.setState({timePassed: true})}, 1000);
        const { navigate } = this.props.navigation;

        if (!this.state.timePassed){
           return (
          <View
                style = {styles.splashScreen}>
                <LogoImage/>
          </View>
        );
    }
    else{
        () => navigate('Onboarding);
    }

export default SplashScreen;
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try like this

import React, { useState } from "react";
import { View, Text, StyleSheet } from "react-native";

const SplashScreen = ({ navigation }) => {
  const [timePassed, setTimePassed] = useState(false);

  setTimeout(function () {
    setTimePassed(true);
  }, 5000);

  if (!timePassed) {
    return (
      <View style={styles.splash}>
        <Text style={styles.text}>Splash Screen</Text>
      </View>
    );
  }
  navigation.navigate('Onboarding Screen');
  return null;
};

const styles = StyleSheet.create({
  splash: {
    display: "flex",
    alignItems: "center",
    justifyContent: "center",
    height: "100vh"
  },
  text: {
    fontSize: 20
  }
});

export default SplashScreen;

I set an alert when navigation happens for now. You can change it to redirect.

In your App.js you need to have a stackNavigator setup like below which gives the navigation prop.

import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';

const Stack = createStackNavigator();

const App = () => {
  return (
    <NavigationContainer>
      <Stack.Navigator initialRouteName="Splash Screen" >
        <Stack.Screen name="Splash Screen" component={SplashScreen} />
        <Stack.Screen name="Main Page" component={OnboadingPage} />
      </Stack.Navigator>
    </NavigationContainer>
  );
};

Code sandbox => https://codesandbox.io/s/cool-violet-7lqqr?file=/src/App.js

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda