简体   繁体   中英

Moving to Next Screen in react native

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>

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

Below solution will work for you if you are using React-navigation.

UI Screen:

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

Card Text Component:

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

Thanks!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM