反应原生android的方向风格问题(Direction style issue with react native android)

编程入门 行业动态 更新时间:2024-10-17 19:24:07
反应原生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>

更多推荐

本文发布于:2023-04-28 03:11:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1329727.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:方向   风格   Direction   android   react

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!