用图像附上文本
Enclose text with Image
我正在使用 React native,我想用图像封装文本。
有没有类似这种效果的包或者道具(看截图)
这应该会给出您想要的输出
<View style = {{flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center'}})>
<Image ...>
<Text style = {{flex: 1}}>Hello</Text>
<Image ...>
</View>
编辑:更改 alignItems
->jusitfyContent
并将 flex: 1
添加到 Text
组件
编辑:这是基于您的第二张屏幕截图的解决方案。注意 react-native Text
组件支持子视图。
<View style = {{flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center'}})>
<Image ...>
<Text style = {{flex: 1}}>Hello
<Image ...>
</Text>
</View>
您可以尝试使用 CSS
道具来将其放置在您想要的位置,但这应该有效。
我正在使用 React native,我想用图像封装文本。
有没有类似这种效果的包或者道具(看截图
这应该会给出您想要的输出
<View style = {{flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center'}})>
<Image ...>
<Text style = {{flex: 1}}>Hello</Text>
<Image ...>
</View>
编辑:更改 alignItems
->jusitfyContent
并将 flex: 1
添加到 Text
组件
编辑:这是基于您的第二张屏幕截图的解决方案。注意 react-native Text
组件支持子视图。
<View style = {{flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center'}})>
<Image ...>
<Text style = {{flex: 1}}>Hello
<Image ...>
</Text>
</View>
您可以尝试使用 CSS
道具来将其放置在您想要的位置,但这应该有效。