我在我的react-native项目中使用react-navigation来处理我的导航和路由 .
在我的情况下,我有 ViewA
和 ViewB
.
ViewA
需要填写我的 ViewB
的信息 .
用户流是 ViewA
- > ViewB
- > ViewA
.
** VIEW A **
import React from "react";
import { Button, Text, View } from "react-native";
class ViewA extends React.Component {
state = { selected: false };
onSelect = data => {
this.setState(data);
};
onPress = () => {
this.props.navigate("ViewB", { onSelect: this.onSelect });
};
render() {
return (
<View>
<Text>{this.state.selected ? "Selected" : "Not Selected"}</Text>
<Button title="Next" onPress={this.onPress} />
</View>
);
}
}
.
**VIEW B**
import React from "react";
import { Button } from "react-native";
class ViewB extends React.Component {
goBack() {
const { navigation } = this.props;
navigation.goBack();
navigation.state.params.onSelect({ selected: true });
}
render() {
return <Button title="back" onPress={this.goBack} />;
}
}
我要做的是:而不是从左到右打开我的 ViewB
,而'd like it to be opened from bottom to up ('在' the ViewA) and having a close transition ' top-bottom'之上 . 比如莫代尔 .
我的问题是,我想保持我的StackNavigator不变 . 并希望定制这种转变 .
我不想要一个莫代尔 .
感谢您的时间和帮助
1 回答
请务必将其导入页面顶部
这就是导航器对于简单过渡的看法 .