React Native应用开发与部署全流程指南
1. React Native组件中的样式表应用
在React Native组件里,可使用样式表来规范组件样式。以下是一个 NormalText.js 组件的示例代码:
// src/components/NormalText.js
import React from 'react-native';
var {
StyleSheet,
Text,
View
} = React;
import {fonts, scalingFactors} from './../styles/fonts';
import Dimensions from 'Dimensions';
let {width} = Dimensions.get('window');
var NormalText = React.createClass({
displayName: 'NormalText',
propTypes: {
style: View.propTypes.style
},
render() {
return (
<Text style={[this.props.style, fonts.normal, scaled.normal]}>
{this.props.children}
</Text>
);
}
});
var scaled = StyleSheet.create({
normal: {
fontSize: width / sca
超级会员免费看
订阅专栏 解锁全文
853

被折叠的 条评论
为什么被折叠?



