反应原生,在模态上显示stacknavigator

时间:2018-03-29 09:11:34

标签: react-native react-navigation

我有以下反应导航设置:

const MyTabView = TabNavigator(
  { ...
    NewObservation: { screen: NewObservation },
  },
  { ... }
);

const StackView = StackNavigator(
  {
    global: {
      screen: MyTabView,
      headerMode: "none",
      header: null,
      navigationOptions: {header: null}
    },
    ...
    SeeDetails: { screen: SeeDetails }
  },
  { mode: 'modal' }
);

<StackView/>

NewObservation简化代码

class NewObservation extends React.Component {
  ... 
  render() {
    return (
      <Modal
        animationType={"none"}
        transparent={false}
        visible={this.state.visibleModal}
        onRequestClose={() => this.setState({visibleModal:false}) }
      >
        <View style={{ flex: 1 }}>
          <Text>modal</Text>
          <TouchableOpacity underlayColor={Config.touchOpacityColor} style={styles.backButton}
            onPress={() =>
              this.props.navigation.navigate("SeeDetails", { ... })
            } >
            <Text>go to stack</Text>
          </TouchableOpacity>
        </View>
      </Modal >
    )
}

所以我在&#34; NewObservation选项卡&#34;,在里面我有一个模态显示。

PROBLEME

如果我点击&#34;去堆叠&#34; ,堆栈视图应用程序,但在此模式下,它显示我何时关闭模态。

如何让它始终出现在顶部的模态上?

0 个答案:

没有答案