-
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?
Conversation
@@ -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 comment
The 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 comment
The 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
.
js/components/Header.js
Outdated
@@ -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 comment
The 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 comment
The 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 StatusBar.currentHeight
.
54 is the height we want the header to have. This should be pretty self explanatory already.
lgtm, left some nit comments. |
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.
This isn't looking right at the moment. An Android status bar with lots of notification icons is going to look messy overlaid on top of the publisher profile and star components.
Wondering if there is a way to scroll the content under the status bar but have it offset by the height of the status-bar when scrollTop is 0
. The hidden header UI will make this complex to implement.
I reckon it looks weird, but I thought that'd help for the discoverability of the hidden header. |
I was drinking a coffee and had an idea! All we have to do is increase the |
So in this update, I added a grey margin on top of the first item, but then scrolling down will reveal the header. I had to reduce the header to subtract the height of the status bar and fix the vertical positioning. It's not as hackish as it sounds and the result is nice. Let's land this now and we can always revisit it later. |
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.
We're almost there, but can't land this if the firstRow
element is blocking touches on <Header>
@@ -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" |
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?
if (y > Header.HEIGHT) return { | ||
value: Header.HEIGHT, | ||
offset: y - Header.HEIGHT, | ||
}; |
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.
This is really funky syntax, can you find an alternative :-/
@@ -436,6 +442,12 @@ export class Home extends Component { | |||
); | |||
} | |||
|
|||
renderHeader() { | |||
return ( | |||
<View style={styles.firstRow}/> |
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.
This element overhangs the header content and blocks the header buttons. 'Settings' button is difficult to press.
inputRange: [0, Header.HEIGHT], | ||
outputRange: [0, Header.HEIGHT], | ||
inputRange: [0, Header.HEIGHT - Header.STATUS_BAR_HEIGHT], | ||
outputRange: [0, Header.HEIGHT - Header.STATUS_BAR_HEIGHT], |
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 you do this calculation once?
const MAX_Y = Header.HEIGHT - Header.STATUS_BAR_HEIGHT;
Full screen experience for added beauty.
See #43.