简体   繁体   English

在 Testflight 版本中 React Native 元素的位置是错误的

[英]React Native element's position is wrong in Testflight version

I don't understand why the positionning of these elements changes on the Testflight version of my app like bellow, it is supposed to be all aligned on the same line.我不明白为什么这些元素的定位在我的应用程序的 Testflight 版本上会发生变化,如下所示,它应该全部对齐在同一行上。

I am unable to reproduce this bug on both real device and simulator but when I open my app in Testflight, it shows.我无法在真实设备和模拟器上重现此错误,但是当我在 Testflight 中打开我的应用程序时,它会显示。

Any idea what this could be linked to?知道这可能与什么有关吗?

Here is my code:这是我的代码:

<View style={{flex: 1}}>
  <SafeAreaView />
  <View style={{display: 'flex', flexDirection: 'row', marginBottom: 5}}>
    <ButtonIcon
      uri={require('../../image/filter.png')}
      onPress={() => props.navigation.navigate('FilterModal', {activityType: activityType})}
    />
    <View style={{flex: 1}}>
      <SearchBar search={search} onChange={(value) => setSearch(value)} />
    </View>
    <ButtonIcon
      uri={require('../../image/add.png')}
      onPress={() => props.navigation.navigate('Activity')}
    />
  </View>

在此处输入图片说明

The SafeAreaView Component is probably messing with your layout depending if it is on a device with a notch or not. SafeAreaView组件可能会SafeAreaView您的布局,具体取决于它是否位于带有缺口的设备上。 You need to place your other code inside the SafeAreaView to prevent this:您需要将其他代码放在SafeAreaView以防止出现这种情况:

<SafeAreaView style={{flex: 1}}>
  <View style={{flex: 1}} />
  <View style={{display: 'flex', flexDirection: 'row', marginBottom: 5}}>
    <ButtonIcon
      uri={require('../../image/filter.png')}
      onPress={() => props.navigation.navigate('FilterModal', {activityType: activityType})}
    />
    <View style={{flex: 1}}>
      <SearchBar search={search} onChange={(value) => setSearch(value)} />
    </View>
    <ButtonIcon
      uri={require('../../image/add.png')}
      onPress={() => props.navigation.navigate('Activity')}
    />
    </View>
  </SafeAreaView>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM