
Product
Introducing Custom Tabs for Org Alerts
Create and share saved alert views with custom tabs on the org alerts page, making it easier for teams to return to consistent, named filter sets.
react-native-responsive-styles
Advanced tools
React Native styles that respond to device orientation change
Installation:
npm i --save react-native-responsive-styles
You can now import StyleSheet and any React components from react-native-responsive-styles instead of react-native:
import {
View,
Image,
ScrollView,
StyleSheet
} from 'react-native-responsive-styles';
You can then define custom style properties for landscape and portrait orientations:
const styles = StyleSheet.create({
container: {
flex: 1,
// define separate styles for portrait and landscape
portrait: {
flexDirection: 'column'
},
landscape: {
flexDirection: 'row'
}
},
mainContent: {
flex: 8,
// override a default value when orientation is landscape
landscape: {
flex: 1
}
},
secondaryContent: {
flex: 1,
// override a default value when orientation is portrait
portrait: {
backgroundColor: '#ccc'
}
}
});
Usage of StyleSheet.create is not required. Plain style objects will work as well, as long as you use the React components from this package.
That's it!

You can apply a LayoutAnimation to orientation changes. Valid animation values are spring, linear and easeInEaseOut.
StyleSheet.configureLayoutAnimation('spring');
The default behaviour is no animation, but configuring one is recommended to avoid visual glitches when rearranging elements.
To add support for orientation-specific styles to your own components or other third-party components, wrap them in a higher-order component with makeResponsive:
import React from 'react';
import { makeResponsive } from 'react-native-responsive-styles';
class CustomComponent extends React.Component({
//...
});
export default makeResponsive(CustomComponent);
In most cases this should not be required. You can simply nest your component in a responsive View.
A common use case is to hide an element entirely in one orientation. You can use StyleSheet.hidden for that:
const styles = StyleSheet.create({
landscapeOnly: {
flex: 1,
portrait: StyleSheet.hidden
}
})
This project is in a pre-release state. The API may be considered relatively stable, but changes may still occur.
FAQs
React Native styles that respond to device orientation change
We found that react-native-responsive-styles demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Create and share saved alert views with custom tabs on the org alerts page, making it easier for teams to return to consistent, named filter sets.

Product
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.

Security News
Chrome 144 introduces the Temporal API, a modern approach to date and time handling designed to fix long-standing issues with JavaScript’s Date object.