【发布时间】:2022-08-14 15:24:21
【问题描述】:
我正在尝试在 React Native 的 TouchableOpacity 中的 Text 中使用条件语句 但屏幕上没有显示任何内容。该文件是 .tsx
这是我的代码 `
let count=1
<TouchableOpacity
onPress={() => {}}
>
<Text style={{
// paddingLeft: 8,
width:\'100%\',
}}>
{()=> {
if (count==1) {
<Text>
View Order
</Text>
} else if (count==2) {
<Text>
View Product
</Text>
}
}}
</Text>
</TouchableOpacity>
`
标签: react-native