【问题标题】:Moving to Next Screen in react native在本机反应中移动到下一个屏幕
【发布时间】:2021-11-02 07:01:57
【问题描述】:

If i click on Lungs Banks i want to move to another screen How can i do this

<KeyboardAvoidingWrapper>
  <WelcomeStyledContainer>
    <StatusBar style="dark" />
    <OrganHeading>
      <OrganHeadingText>Donate Able Organ</OrganHeadingText>
    </OrganHeading>
    <View style={styles.container}>
      <View style={styles.Box}>
        <View style={styles.inerBox}>
          <CardStyle>
            <CardImage source={require('./../assets/organImage/lungs.png')} />
            <CardText>Lungs Bank</CardText>
          </CardStyle>
        </View>
      </View>

【问题讨论】:

    标签: reactjs react-native navigation


    【解决方案1】:

    如果您使用 React-navigation,以下解决方案将适用于您。

    用户界面屏幕:

    <CardText onPress={()=>navigation.navigate("YOUR SCREEN NAME HERE")}>Lungs Bank</CardText>
    

    卡片文本组件:

    const CardText = ({onPress}) => {
    return <Text onPress={onPress}>{props.children}</Text>;
    }
    

    谢谢!

    【讨论】:

      【解决方案2】:

      您可以使用react-navigation 在 react-native 中开始导航的库。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-03-25
        • 2020-07-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-09-09
        • 1970-01-01
        相关资源
        最近更新 更多