react-nativereact-navigation

ReactNative Navigation show Splash screen again on pressing Back key on Login screen instead of closing the App


I have made an App in ReactNative in that I am using Navigation when I launched the App it show Splash screen and after 3 second it show Login screen but the problem is that when I pressed Backkey it navigate to Splash screen again instead of closing the App.

Here Github project link

Please go through the link and run the project at your end and observed the issue.

EDIT navigation.replace('Login') solve the problem in ideal way here is a complete code,

const Splash = ({navigation}: {navigation: any}) => {   // const Splash = (props) => {

  setTimeout(() => {
    navigation.replace('Login')
  }, 3000)

Solution

  • Eventually I solved my problem in a gracefully way here is the snip of code.

    const Splash = ({navigation}) => {
    
        setTimeout(()=>{
            navigation.replace('Login') //FIX
        },3000)
    }