react-native: No need to Display Splash Video Every time

时间:2017-06-15 10:33:12

标签: react-native react-native-android

I am Developing Sample Application, in this Application, When i was start or run the application,Splash Video Comes every time when i was run the application Or reload the Application .But, I don't need to be Splash Video every time.

this is my code

class SplashPage extends Component {

componentWillMount () {
        var navigator = this.props.navigator;
        setTimeout (() => {

          navigator.replace({
                component: LoginScreen,
                 // <-- This is the View you go to
            });
        }, 8700);     //<-- Time until it jumps to "MainView"
    }

    render () {
        return (
            <View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
               <Video source={require('./images/splashVideo.mp4')}
               rate={1.0}                   
               volume={1.0}                
               muted={false}                
               paused={false}       
               resizeMode="cover"  
               repeat={false}         
               onError={this.videoError}    
               style={styles.backgroundVideo} />
                <View>{StatusBar.setBackgroundColor('black', true)}</View>
            </View>
        );
    }
}

Thanks in Advance

1 个答案:

答案 0 :(得分:1)

Yes I got it, This either Splash Screen/ Video no need to Every time.

Just you will be add in this lines in MainActivity.java file Add this lines.



@Override
    public void invokeDefaultOnBackPressed() {
    moveTaskToBack(true);
    }