With react-native-style you can use different templates for styles like media query in css. Use condition value as pixels, but value of style property in point as default in react-native. react-native-style has 2 variables for condition.
height - height of screen in pixels. width - width of screen in pixels.
Install
$ npm i react-native-style --save
Usage Example.
'use strict';
import React, {
AppRegistry,
Text,
View
} from 'react-native';
import styleSheet from 'react-native-style';
class DemoApp extends Component {
render() {
return (
<View style={styles.container}>
<Text>Some Text</Text>
</View>
);
}
}
const styles = styleSheet([{
'height <= 750': {
container: {
height: deviceHeight,
width: deviceWidth,
backgroundColor: '#8cc5b4'
}
}
}]);
AppRegistry.registerComponent('DemoApp', () => DemoApp);