Skip to content
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

[Android] Hidden <StatusBar> reappears after screen lock #5991

Closed
marcshilling opened this issue Feb 17, 2016 · 19 comments
Closed

[Android] Hidden <StatusBar> reappears after screen lock #5991

marcshilling opened this issue Feb 17, 2016 · 19 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@marcshilling
Copy link

I'm trying out the new cross-platform StatusBar component. One thing I noticed is that if I lock my Android phone screen on a view with <StatusBar hidden={true} />, the status bar is visible again upon unlocking the phone.

@facebook-github-bot
Copy link
Contributor

Hey marcshilling, thanks for reporting this issue!

React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.

  • If you don't know how to do something or something is not working as you expect but not sure it's a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
  • If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
  • We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!

@janicduplessis
Copy link
Contributor

Thanks for reporting this I'll look into it :)

@ghost ghost closed this as completed in cf3bd9f Feb 22, 2016
pglotov pushed a commit to pglotov/react-native that referenced this issue Mar 15, 2016
Summary:I changed the technique used to hide the status bar and now it works properly. Also changed the way flags are set on the decorView to make sure it doesn't cause issues with other flags already set and fix deprecated Promise.reject

**Test plan**
Test using the UIExplorer StatusBar example, change the `hidden` prop value and go in and out of the app making sure the status bar has the right visibility.

Fixes facebook#5991
Closes facebook#6051

Differential Revision: D2960060

Pulled By: nicklockwood

fb-gh-sync-id: ee1c541896f5771d27cfd3ff18537edb6c017284
shipit-source-id: ee1c541896f5771d27cfd3ff18537edb6c017284
@charpeni
Copy link
Contributor

@janicduplessis I just tried this cf3bd9f on branch 0.22-stable and master, it doesn't seem to work.

class AwesomeProject extends Component {
  render() {
    return (
      <View style={styles.container}>
        <StatusBar
          hidden
        />
        <TextInput/>
      </View>
    );
  }
}

Tested on Android 5.

  1. Open the app. (StatusBar is hidden)
  2. Minimize the app.
  3. Reopen the app. (StatusBar is visible)

There seems to have an issue with focus on native components, maybe your fix should fixed it ? #6503 & http://stackoverflow.com/questions/36061617/reactnative-status-bar-disable-android

@marcshilling
Copy link
Author

@charpeni is that code valid? You aren't passing anything to hidden

@charpeni
Copy link
Contributor

@marcshilling It's a valid code, we can omit the value of the prop when it is explicitly true.

@TeodorKolev
Copy link

Why this issue is closed when problem still exist?

@janicduplessis
Copy link
Contributor

@charpeni Have you rebuilt the native code? I just tested the steps you described using 0.22.0-rc4 from npm in one of my apps and it worked.

@TeodorKolev
Copy link

I have same issue, on every event soft keyboard open back button pressed etc. status bar showed up

@janicduplessis
Copy link
Contributor

Are you on 0.22?

@TeodorKolev
Copy link

0.21

@janicduplessis
Copy link
Contributor

Ok, this is normal the issue was fixed only in 0.22. Can you try with 0.22.0-rc4?

@TeodorKolev
Copy link

how to get that?

@janicduplessis
Copy link
Contributor

npm install --save react-native@0.22.0-rc4

@TeodorKolev
Copy link

is there any chance that can break my app? Thanks btw

@janicduplessis
Copy link
Contributor

0.22.0 will be released this monday so the rc build is pretty stable at this point.

@TeodorKolev
Copy link

Thanks a lot man. Respect!

@charpeni
Copy link
Contributor

@charpeni Have you rebuilt the native code? I just tested the steps you described using 0.22.0-rc4 from npm in one of my apps and it worked.

@janicduplessis Yes, I made a new application with react-native init, clone repo on branch 0.22-stable, react-native upgrade and react-native run-android.

From node_modules/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.java I can see your fix.

Did it work for you @TeodorKolev ?

@janicduplessis
Copy link
Contributor

Can you try 0.22.0-rc4 from npm? I think cloning the branch won't work properly unless you change your build.gradle to compile react-native from node_modules instead of using the version from maven (which is still 0.21 since 0.22.0 is using a prebuilt version distributed by npm instead of maven)

You can check http://facebook.github.io/react-native/docs/android-building-from-source.html#content to build it from source properly.

@charpeni
Copy link
Contributor

I can't retry with 0.22.0-rc4 from npm right now because I have this strange error #6446.

I think you're totally right about the prebuilt version distributed by npm, I was blinded by compile "com.facebook.react:react-native:+" // From node_modules.

Actually, if you say it works I totally believe in your work. Nice job by the way! :

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants