Detect device type and screen size.
npm install react-native-device --save
-
isIpad
- boolean
-
isIphone
- boolean
-
kind
- "iPad"
- "iPhone4"
- "iPhone5"
- "iPhone6"
- "iPhone6plus"
-
width
-
height
'use strict';
var React = require('react-native');
var Device = require('react-native-device');
var {
AppRegistry
} = React;
var ExampleApp = React.createClass({
render: function() {
if (Device.isIpad()) {
// return iPad layout
} else {
// return iPhone layout
}
}
});
AppRegistry.registerComponent('ExampleApp', () => ExampleApp);