反应原生android的方向风格问题(Direction style issue with react native android)
我正在处理从右到左的反应本机应用程序,并希望处理布局direction: 'rtl'或direction: 'rtl' 。
它适用于iOS,但无法在Android上运行。
一个示例代码是:
<View style={{flexDirection: 'row', justifyContent: 'space-between', direction: 'rtl'}}> <Text> right content </Text> <Text> left content </Text> </View>谢谢。
I'm working on a right-to-left react native app and want to handle layout with direction: 'rtl' or direction: 'rtl'.
It works fine with ios but it doesn't work on Android for no reason.
An example code is :
<View style={{flexDirection: 'row', justifyContent: 'space-between', direction: 'rtl'}}> <Text> right content </Text> <Text> left content </Text> </View>Thanks.
最满意答案
方向道具只适用于iOs。 请参阅文档https://facebook.github.io/react-native/docs/layout-props.html#direction
如果你想从右到左布局你的视图,那么下面的代码将起作用。
<View style={{justifyContent: 'space-between',flexDirection: 'row-reverse'}}> <Text> text1 </Text> <Text> text2 </Text> <Text> text3 </Text> <Text> text4 </Text> <Text> text5 </Text> </View>Direction props is only for iOs. Refer documentation https://facebook.github.io/react-native/docs/layout-props.html#direction
If you want to layout your views from right to left then below code would work.
<View style={{justifyContent: 'space-between',flexDirection: 'row-reverse'}}> <Text> text1 </Text> <Text> text2 </Text> <Text> text3 </Text> <Text> text4 </Text> <Text> text5 </Text> </View>更多推荐
发布评论