Move over to Stremio/react-native-orientation-view
This component gives you an alternative way of writing orientation(size) specific UI in ReactNative by changing the ui on the UI Thread instead of JS thread.
The iOS implementation is not native yet and fallbacks to the Dimensions approach. It requires one additional property, initialIsInPortrait
.
render() {
return (
<OrientationView style={{flex: 1}}>
<LandscapeView style={StyleSheet.absoluteFill}>{this.renderLandscape()}</LandscapeView>
<PortraitView style={StyleSheet.absoluteFill}>{this.renderPortrait()}</PortraitView>
</OrientationView>
);
}
render() {
const {height, width} = Dimensions.get('window');
if (height >= width) {
return this.renderPortrait();
} else {
return this.renderLandscape();
}
}