fontSize-40
will convert to style={{fontSize:40}}
color-red
will converto style={{color:'red'}}
Further more, it can define your prop to all the react-native components and all your self-defined components.
For example:
<View row center>
<Text h1>It is a head</Text>
<Text red detail link>It is a red underline detail text</Text>
</View>
import { Text, View } from 'react-native-prop-style/react-native';
import React, { Component } from 'react';
import { packComponentsPropStyle,packPropStyle } from 'react-native-prop-style';
const myStyle = {
blue: { color: '#3182C8' }
}
const class MyComponent extends Component{
...
}
export default (packPropStyle(MyComponent,myStyle));
// my-native-base.js
import * as nativeBaseComponents from 'native-base'
import { packComponentsPropStyle,packPropStyle } from 'react-native-prop-style';
const myStyle = {
blue: { color: '#3182C8' }
}
const cs = packComponentsPropStyle(nativeBaseComponents,myStyle);
module.exports = {
...cs
}
// otherFile
import { View, Button } from './my-native-base';
...