'use strict';
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
PixelRatio,
Image,
ScrollView,
View,
} from 'react-native';
class StyleImg extends Component {
render(){
var url = ({
uri: 'http://7u2psp.com2.z0.glb.qiniucdn.com/576d0f99f1f58390384.jpg?imageView2/1/w/'+ 1000 * PixelRatio.get() +'/h/' + 1000 * PixelRatio.get() +'/q/100'
});
var image = ({
uri: 'http://7u2psp.com2.z0.glb.qiniucdn.com/576d0f99f1f58390384.jpg?imageView2/1/w/'+ 1000 * PixelRatio.get() +'/h/' + 1000 * PixelRatio.get() +'/q/100'
});
return (
<ScrollView>
<View style = {styles.pad}>
<Text style = {styles.pad}>图片裁剪是否压扁(同一片源)</Text>
<Image source={url} style={{width: 180,height: 240}} />
<Image source={url} style={{width: 180,height: 180}} />
</View>
<Text style = {styles.pad}>设备适配</Text>
<Text>PixelRatio:{PixelRatio.get()}</Text>
<Text style = {styles.pad}>高度{300 * PixelRatio.get()}</Text>
<Text>想用服务器的截图功能,但是好像rn实现了这样的功能。</Text>
<Image source={image} style={{height: 300 * PixelRatio.get()}} />
<Text style = {styles.pad}>PixelRatio 设备适配</Text>
<Text>width: 160 * {PixelRatio.get()} , height: 213 * {PixelRatio.get()}</Text>
<Image source={url} style={{width: 160 * PixelRatio.get(),height: 213 * PixelRatio.get()}} />
</ScrollView>
);
}
}
const styles = StyleSheet.create({
pad:{
padding: 10,
},
});
AppRegistry.registerComponent('StyleImg', () => StyleImg);