React Native视图在iPhone Plus上显示扭曲的像素

时间:2017-12-02 16:44:25

标签: iphone react-native

React Native视图在iPhone Plus版本上显示扭曲的像素,而相同的视图在iPhone 5,6或7版本上显示非常优雅。有时候看起来比下面加上iPhone版本的图片更糟糕。 enter image description here 代码如下,

<View style={[styles.headerRow, { paddingHorizontal: 5 }]} >
   <View style={{ flex: 3, borderColor: theme.color.gray.light, borderRightWidth: .5, alignSelf: 'center' }}>
        <Text style={[skin.text.smaller, skin.text.bold, { textAlign: 'center', padding: 8 }]}>{'TITLE'}</Text>
    </View>
   <View style={{ flex: 2, alignItems: 'center', borderColor: theme.color.gray.light, borderRightWidth: .5, alignSelf: 'center' }}>
        <Text style={[skin.text.smaller, skin.text.bold, { textAlign: 'center', padding: 8 }]}>{'BUCKIT'}</Text>
   </View>
   <View style={{ flex: 2.8, alignItems: 'center' }}>
         <Text style={[skin.text.smaller, skin.text.bold, { textAlign: 'center', padding: 8 }]}>{'YOUR AVERAGE'}</Text>
    </View>
</View>

使用屏幕宽度到divid列而不是flex也没有帮助。

1 个答案:

答案 0 :(得分:0)

解决方案:

我找到了一个解决方案,iOS不喜欢将borderWidth设置为小于1,因此您可以使用1或更大的值或react-native提供名为hairlineWidth的StylesSheet变量,该变量的默认值设置为0.3。您可以通过在组件的构造函数中设置StyleSheet.hairlineWidth = 0.5来更改该值。

    if (count($errors) == 0) {
        $password = md5($password);
        $query = "SELECT * FROM users WHERE username='$username' AND password='$password'";
        $result = mysqli_query($db, $query);

        if (mysqli_num_rows($result) == 1) {
            $_SESSION['username'] = $username;
            $_SESSION['success'] = "You are now logged in";
            header('location: index.php');
        }else {
            array_push($errors, "Wrong username or password.");
        }
    }
}