【发布时间】:2017-11-09 06:54:13
【问题描述】:
当我使用硬件后按从我的应用程序的最终屏幕导航到第一个屏幕时
它最初会导航到第一个屏幕并弹回最终屏幕
此外,我在第一个屏幕中给出的动画在导航时变成了卡住和播放体验,这两种导航类型的情况都是一样的,即,
-使用应用程序中的后退按钮导航,同时使用硬件后退按钮
这是我处理硬件后按的最终屏幕 js 文件:
constructor(props) {
super(props);
this.handleBack = (() => {
Actions.FirstScreen();
});
}
componentDidMount() {
BackHandler.addEventListener('hardwareBackPress', this.handleBack);
}
componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.handleBack);
}
这是我有动画的第一个屏幕的 js 文件:
componentWillMount() {
this.slide1 = new Animated.Value(0);
this.slide2 = new Animated.Value(0);
this.bnt1();
this.bnt2();
}
bnt1() {
Animated.timing(
this.slide1, {
delay: 100,
toValue: w / 1.33,
duration: 700,
}
).start();
}
bnt2() {
Animated.timing(
this.slide2, {
delay: 700,
toValue: -(w / 1.33),
duration: 500,
}
).start();
}
【问题讨论】: