ReactNative/Flex:如何水平排列两个组件?

del*_*ete 7 jsx reactjs react-jsx react-native

如何使用flex在同一行中的另一个旁边排列2个图像组件?

像这样:

|| (图 1) || (图 2) ||

iti*_*nce 9

flexDirection: 'row' 是你的朋友


小智 7

我认为这样的事情......

<View style={{flexDirection:'row', alignItems:'center', justifyContent:'center'}}>
  <Image source... />
  <Image source... />
</View>
Run Code Online (Sandbox Code Playgroud)

现在,根据您希望水平间隔的方式,您可以使用不同的justifyContent