【发布时间】:2020-08-16 23:07:30
【问题描述】:
我正在调用以下函数
const LevelCard = (level) => {
const currLevel = level;
console.log(currLevel)
return (
<View style={{
flex: 1,
width: 400,
alignItems: 'center',
justifyContent: 'center'
}}>
<CategoryButton
title='Text should go here'
onPress={() => navigation.navigate('')}
/>
</View>
);
}
来自另一个组件
function CallFunction() {
return (
<SafeAreaView style={styles.categories}>
<ScrollView horizontal={true} style={styles.scrollView}>
<View>
<LevelCard
level="This is the text I want to pass"
/>
</View>
</ScrollView>
</SafeAreaView>
);
}
但我不知道如何实际从“级别”获取文本以显示在 react-native 组件中的任何位置。但是,console.log 语句在它之外可以正常工作。
谢谢
【问题讨论】:
标签: android reactjs function react-native mobile