我想在我的 react native 应用程序的主页上显示一个 View ,该 View 依次显示一个文本元素和一个图标,然后在这两个元素下面我想显示亚马逊 Logo 。我尝试过,但它只显示了 Logo 。
export default class Header extends Component {
render() {
return (
<View style={{ flex: 1, flexDirection: 'row' }}>
<Text style={styles.Title}>Acquista!</Text>
<Ionicons name="ios-contact" size={42} color='red' style={{ marginTop:
65, marginLeft: 210 }} />
</View> ,
<Logo></Logo>
);
}
}
class Logo extends Component {
render() {
return (
<View>
<Image
style={{ height: 200, width: 200, marginTop: 150 }}
source={require('./assets/images/amazon.jpg')}
/>
</View>
);
}
}
最佳答案
将所有内容包装到View
return (
<View style={{ flex: 1 }}>
<View style={{ flex: 1, flexDirection: 'row' }}>
<Text style={styles.Title}>Acquista!</Text>
<Ionicons name="ios-contact" size={42} color='red' style={{ marginTop: 65, marginLeft: 210 }} />
</View>
<Logo />
</View>
)
关于ios - 如何在 native View 中显示更多元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55640628/