react-native - React Native ListView 不一致的分隔线

标签 react-native react-native-listview react-native-android

在Android 4.4上,ListView分隔线粗细不一致,有的不渲染。
我看不出这怎么可能是代码问题,这就是我呈现它们的方式:

     separator: {
        height: 1,
        backgroundColor: 'grey',
      }
      ...
      <ListView
      renderSeparator={(sectionID, rowID) =>
        <View key={`${sectionID}-${rowID}`} style={styles.separator} />
      }
      .../>

这是有此问题的 View 的屏幕截图:

enter image description here

此问题在 iOS 或 Android 6 上不会发生。

以前有人遇到过这个问题吗?

更新

我做了一个测试,这不是Android4的问题。在 Nexus One 设备上运行时,所有 API 版本都会发生这种情况(在 android 模拟器中)

最佳答案

我在 iOS 上遇到了这个问题,并通过添加细线边距来解决它,如下所示:

<View
    style={{
      ...styles,
      borderWidth: StyleSheet.hairlineWidth,
      margin: StyleSheet.hairlineWidth,
    }}
>
    {// ...row content}
</View>

关于react-native - React Native ListView 不一致的分隔线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38012355/

相关文章:

javascript - .then 和 .catch 都在同一个代码块中执行

android - 值-v28.xml :5:5-8:13: AAPT: No resource found that matches the given name (at 'dialogCornerRadius' with value '?android:attr/dialogCornerRadius' )

javascript - 如何根据纬度和经度获取两个位置之间的距离?

reactjs - React Native - TextInput - 如何一起使用 value 和 defaultValue

react-native - number.toLocaleString() 在 react-native 中不起作用

javascript - Concat 实际上是连接而不是添加到数组。 react native JavaScript

具有动态行和列的 react native 平面列表

react-native - 在 React Native Android 中如何在应用程序后台检查互联网连接在线/离线?

android - 在 Object.readSync 处读取错误 : EISDIR: illegal operation on a directory,

react-native - 我所有的 react-native 项目都显示错误 TypeError : cb. apply is not a function