1.0.8 • Published 7 years ago
react-native-program-stylesheet v1.0.8
react-native-program-stylesheet
重写StyleSheet.create方法,无损RN原生代码。 把任意屏幕宽分成375,快速实现适配任意分辨率的布局。
🤗 🤗 随手给颗星星呗,有bug或者交流,欢迎留言第一时间维护。🤗 🤗
安装:
yarn add react-native-program-stylesheet
使用:
在程序入口处import
index.js
其他页面正常使用StyleSheet,不用再次import
App.js (或者其他任意页面中使用)
Component中使用
在继承自Component中使用,不是使用StyleSheet时,
export default class App extends Component {
render(){
return <View style={{
position: 'absolute',
top: this.getSize(40),
left: this.getSize(40),
width: this.getSize(50),
height: this.getSize(50),
backgroundColor: '#ff0000'}}/>
}
}
非StyleSheet非Component中使用
优化iPhone Plus 一个像素的显示问题,根据分辨率保证最小1个像素渲染,divider、border必备
一条水平分割线
<View style={{width: 375, height: 0.5, backgroundColor:'#dcdcdc'}}>