Skip to content

Instantly share code, notes, and snippets.

@cball
Last active November 23, 2017 16:39
Show Gist options
  • Save cball/65a50634d2da90260cb7cf02b08f443a to your computer and use it in GitHub Desktop.
Save cball/65a50634d2da90260cb7cf02b08f443a to your computer and use it in GitHub Desktop.
Example of app-wide fullScreen style and StyleSheet's built-in absoluteFillObject that does the same thing
// App/Theme/ApplicationStyles.js
export default {
fullScreen: {
position: 'absolute',
top: 0,
bottom: 0,
left: 0,
right: 0
}
}
// App/Theme/ApplicationStyles.js
export default {
red: '#BD3760',
reallyFadedWhite: 'rgba(255, 255, 255, 0.3)',
transparent: 'rgba(0,0,0,0)'
};
// App/Theme/index.js
import ApplicationStyles from './ApplicationStyles';
import Colors from './Colors';
export default {
ApplicationStyles,
Colors
}
// App/Components/SomeComponent/styles.js
import { StyleSheet } from 'react-native';
import { ApplicationStyles, Colors } from '../../Theme';
export default StyleSheet.create({
container: {
// ...ApplicationStyles.fullScreen,
...StyleSheet.absoluteFillObject,
backgroundColor: Colors.red
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment