Skip to content

Comments

[revert] remove Statusbar marginTop for navTransparent#3493

Merged
aksonov merged 3 commits intomasterfrom
unknown repository
Sep 4, 2019
Merged

[revert] remove Statusbar marginTop for navTransparent#3493
aksonov merged 3 commits intomasterfrom
unknown repository

Conversation

@bang9
Copy link
Contributor

@bang9 bang9 commented Jun 20, 2019

Reason

Status bar can be overlay to screen(app will draw under the status bar), It is not odd behavior..
Transplucent status bar is default in iOS(cli, expo) and Android(expo)
But not default option on Android(cli), it just can be set by translucent of 'StatusBar'

If user want to status bar overlay to screen, they must use 'SafeAreaView' but this working only in iOS, because that concept doesn't exist on Android.
for this reason, not margin top to navigation in RNRF but padding top to screen(or wrapping routes with OverlayStatusBarView) by user self

please see the example code

import {SafeAreaView, StatusBar, Platform } from 'react-native';

const OverlayStatusBarView = (props) => {
    const {children, style, ...rest} = props;
    return(
      <SafeAreaView 
        style={[{paddingTop: StatusBar.currentHeight},style]}
        {...rest}
      >
        <StatusBar translucent /> 
        {children}
      </SafeAreaView>
    )
}

@aksonov
Copy link
Owner

aksonov commented Sep 4, 2019

I can't merge this ticket because it brakes existing apps (on iOS). Probably you can add check for iOS/Android and set/not set height depends from ios..

@bang9
Copy link
Contributor Author

bang9 commented Sep 4, 2019

I can't merge this ticket because it brakes existing apps (on iOS). Probably you can add check for iOS/Android and set/not set height depends from ios..

@aksonov It only affect to android
StatusBar.currentHeight is always return 0 on iOS

@aksonov aksonov merged commit 3871a06 into aksonov:master Sep 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants