aksonov / aksonov/react-native-router-flux

How to prevent load login page again if already have session after user backhandler exitapp()?

Đang mở
#3,483 3 bình luận 2 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
8.9k
Fork
2.1k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### Version

- react-native-router-flux v4.0.1
- react v16.4.1
- react-native 0.55.4

### Expected behaviour

after tap2x exit apps, and open apps again go to scene home

### Actual behaviour
after tap2x exit apps, and open apps again go to scene login

### Steps to reproduce
```
componentDidMount() {
BackHandler.addEventListener('hardwareBackPress', this.handleBackButton);
}
componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButton);
}
handleBackButton = () => {
if (this.state.doubleBackToExitPressedOnce) {
BackHandler.exitApp();
}
else if(NavigationActions.currentScene === 'home'){
ToastAndroid.show('Press back again to exit', ToastAndroid.SHORT);
this.setState({ doubleBackToExitPressedOnce: true });
// BackHandler.exitApp();
setTimeout(() => {
this.setState({ doubleBackToExitPressedOnce: false });
}, 2000);
return true;
}

}
```

on router:
```
< Scene initial component={LoginScreen} hideNavBar titleStyle={styles.title} title='' />
< Scene key="home" component={WelcomeScreen} hideNavBar title='' navigationBarStyle={styles.navBar} titleStyle={styles.title} back drawerLockMode='locked-closed' />
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.