Skip to content

Commit

Permalink
Merge pull request #102 from corintho/master
Browse files Browse the repository at this point in the history
Update StatusBar documentation on README for RN 0.59+
  • Loading branch information
jdnichollsc authored Sep 3, 2019
2 parents ff36dfe + 8303911 commit 458cc71
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,24 @@ import { getDeepLink } from './utilities'

### StatusBar

The StatusBar will keep the last one provided in your app. So if the StatusBar is `dark-content` before you open the browser this will keep it. If you want to change before opening you can do something like
The StatusBar will keep the last one provided in your app. So if the StatusBar is `dark-content` before you open the browser this will keep it.

Starting with React Native 0.59 onwards, there is a simpler way of handling this update, without the need of patching StatusBar.
```javascript
async openInBrowser(url) {
try {
const oldStyle = StatusBar.pushStackEntry({ barStyle: 'dark-content', animate: false });
await InAppBrowser.open(url)
StatusBar.popStackEntry(oldStyle);
} catch (error) {
Alert.alert(error.message)
}
})
```

For previous versions, you can still apply the method described below.

If you want to change before opening you can do something like

```javascript
async openInBrowser(url) {
Expand Down

0 comments on commit 458cc71

Please sign in to comment.