【问题标题】:Expo React Native - Components switch places after building the apk / opening with QR codeExpo React Native - 构建 apk 后组件切换位置/使用 QR 码打开
【发布时间】:2025-12-21 18:50:10
【问题描述】:

我无法解决这个问题。 我构建了一个简单的 UI,并尝试在视图中设置两个组件 一个将占据左侧,另一个占据右侧。 我设法让它工作,在 android 模拟器和 genymotion 模拟器上看起来不错 但是当我使用 expo qr 代码/构建 apk 时,文本和输入会改变位置:

更新:

我尝试了一个更简单的代码,但问题仍然存在:

Image of changes

<View style={{flex:1,backgroundColor:"#fdf",alignItems:"center"}}>
  <View style={{flexDirection: 'row',height:100,width:150,backgroundColor:"red"}}>
    <View style={{position:"absolute",left:0,width: 50, height: 50, backgroundColor: 'skyblue'}} />
    <View style={{position:"absolute",right:0,width: 50, height: 50, backgroundColor: 'steelblue'}} />
  </View>
</View>

感谢您的帮助!

【问题讨论】:

    标签: react-native components react-native-android expo


    【解决方案1】:

    已解决:问题是带有 react native 的默认 rtl 从'react-native'导入{ I18nManager }; I18nManager.allowRTL(false);

    【讨论】: