-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Full screen experience - Content scroll underneath transparent status bar #49
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ import { | |
View, | ||
StatusBar, | ||
StyleSheet, | ||
Platform, | ||
AppState, | ||
} from 'react-native'; | ||
|
||
|
@@ -121,7 +120,7 @@ export class App extends Component { | |
<View style={styles.container}> | ||
<StatusBar | ||
translucent={true} | ||
backgroundColor="rgba(0, 0, 0, 0.2)" | ||
backgroundColor="transparent" | ||
barStyle="light-content" | ||
/> | ||
<Navigator | ||
|
@@ -136,9 +135,10 @@ export class App extends Component { | |
renderScene({ id, data }, navigator) { | ||
switch (id) { | ||
case 'item': return <Item itemId={data.itemId} navigator={navigator}/>; | ||
default: | ||
var Component = this.routes[id].component; | ||
default: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are the curly brackets needed? I'm just curious. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it's to create a new scope to allow the use of |
||
const Component = this.routes[id].component; | ||
return <Component navigator={navigator}/>; | ||
} | ||
} | ||
} | ||
} | ||
|
@@ -155,7 +155,6 @@ const styles = StyleSheet.create({ | |
|
||
scene: { | ||
backgroundColor: '#333', | ||
paddingTop: Platform.OS === 'ios' ? 20 : 24, | ||
}, | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ import { | |
Text, | ||
StyleSheet, | ||
TouchableOpacity, | ||
Platform, | ||
StatusBar, | ||
} from 'react-native'; | ||
|
||
export default class Header extends Component { | ||
|
@@ -81,11 +83,13 @@ Header.propTypes = { | |
navigator: PropTypes.object, | ||
}; | ||
|
||
Header.HEIGHT = 54; | ||
const STATUS_BAR_HEIGHT = Platform.OS === 'ios' ? 20 : StatusBar.currentHeight; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we make the values 20 and 54 constants with self explained name? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 20 is the height of the status bar on iOS. In Android, we can just use |
||
Header.HEIGHT = 54 + STATUS_BAR_HEIGHT; | ||
|
||
const styles = StyleSheet.create({ | ||
header: { | ||
backgroundColor: '#333', | ||
paddingTop: STATUS_BAR_HEIGHT, | ||
height: Header.HEIGHT, | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep a bit of background color so that if status-bar icons are over a white background (in our app) they are still visible?