在本机反应中移动到下一个屏幕
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 中开始导航的库。
如果您使用 React-navigation,以下解决方案将适用于您。
UI 画面:
<CardText onPress={()=>navigation.navigate("YOUR SCREEN NAME HERE")}>Lungs Bank</CardText>
卡片文本组件:
const CardText = ({onPress}) => {
return <Text onPress={onPress}>{props.children}</Text>;
}
谢谢!
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 中开始导航的库。
如果您使用 React-navigation,以下解决方案将适用于您。
UI 画面:
<CardText onPress={()=>navigation.navigate("YOUR SCREEN NAME HERE")}>Lungs Bank</CardText>
卡片文本组件:
const CardText = ({onPress}) => {
return <Text onPress={onPress}>{props.children}</Text>;
}
谢谢!