我尝试创建一个带有图像的视图和一个包裹Image组件的Text组件.
我的造型:
textContainer: {
flexDirection: 'row',
},
text: {
flex: 10,
},
image: {
flex:1,
height: 180,
width: 150,
margin: 10,
borderColor: '#ccc',
borderWidth: 1,
}
Run Code Online (Sandbox Code Playgroud)
我的组件:
<ScrollView style={styles.contentContainer} >
{this.props.content.title_1 ? <Text style={styles.title}>{this.props.content.title_1}</Text> : null}
<View style={styles.textContainer}>
{this.props.content.text_1 ? <Text style={styles.text}>{this.props.content.text_1}</Text> : null}
{this.props.content.image_1 ? <Image width={null} height={null} style={styles.image} source={this.props.content.image_1} /> : null}
</View>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
这就是结果:(根本没有包装哈哈)
在这里的图片中,我很快将小图片刻录到文本中.但我无法将文字包裹起来..
我希望任何人都可以帮助我朝着正确的方向前进!