Javascript SectionList的内容在web浏览器中可见,但在iOS中不可见
在构造分区列表并用信息填充它时,我在使用React Native时遇到问题。它似乎在网络浏览器(Chrome)上显示良好 但是,在iOS模拟器/设备上查看内容时,情况似乎并非如此。部分标题显示,但内容不显示 以下是每张卡的代码:Javascript SectionList的内容在web浏览器中可见,但在iOS中不可见,javascript,reactjs,react-native,Javascript,Reactjs,React Native,在构造分区列表并用信息填充它时,我在使用React Native时遇到问题。它似乎在网络浏览器(Chrome)上显示良好 但是,在iOS模拟器/设备上查看内容时,情况似乎并非如此。部分标题显示,但内容不显示 以下是每张卡的代码: const Card = (props) => { return ( <View> <Text style={styles.english}>{props.english}</Text>
const Card = (props) => {
return (
<View>
<Text style={styles.english}>{props.english}</Text>
<Text style={styles.other}>{props.other}</Text>
</View>
);
}
有人知道为什么会这样吗?我是否遗漏了一些显而易见的东西?提前道歉,因为这是我使用web/react本机开发的第一天。如果有人能给我指出正确的方向,我将不胜感激。谢谢 很抱歉。
我找到了答案,我不需要将视图环绕在卡片上。JSX非常合适,并成功地使其工作
const Card = (props) => {
return (
<>
<Text style={styles.english}>{props.english}{"\n"}</Text>
<Text style={styles.other}>{props.other}</Text>
</>
);
}
const卡=(道具)=>{
返回(
{props.english}{“\n”}
{props.other}
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 5,
backgroundColor:"#f1faee",
},
box: {
marginBottom: 10,
padding: 10,
height: 150,
width: "95%",
backgroundColor:"#1d3557",
borderColor:"#000000",
shadowOffset:{ width: 3, height: 3},
shadowColor: 'black',
shadowOpacity: 0.4,
borderRadius: 15,
justifyContent: "center",
},
english: {
color:"#f1faee",
fontSize: 30,
},
other: {
color:"#f1faee",
fontSize: 50,
},
sectionHeader: {
paddingTop: 2,
paddingLeft: 10,
paddingRight: 10,
paddingBottom: 2,
fontSize: 14,
fontWeight: 'bold',
backgroundColor: "#f1faee"
}
});
const Card = (props) => {
return (
<>
<Text style={styles.english}>{props.english}{"\n"}</Text>
<Text style={styles.other}>{props.other}</Text>
</>
);
}