PixelRatio使用

export default class PixelRatioView extends Component {


    render() {
        return (
            <View style={styles.container}>
                <Text style={styles.textStyle}>
                    PixelRatio实例
                </Text>
                <Text style={styles.textStyle}>
                    当前的屏幕像素密度比例为: {PixelRatio.get()}
                </Text>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#ffffff',
        marginTop: 20
    },
    textStyle: {
        fontSize: 18,
        textAlign: 'center',
        backgroundColor: '#ffffff',
        marginTop: 10
    }

});
原文地址:https://www.cnblogs.com/hualuoshuijia/p/10190290.html