Skip to content

Commit 458cc71

Browse files
authored
Merge pull request #102 from corintho/master
Update StatusBar documentation on README for RN 0.59+
2 parents ff36dfe + 8303911 commit 458cc71

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,24 @@ import { getDeepLink } from './utilities'
300300

301301
### StatusBar
302302

303-
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
303+
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.
304+
305+
Starting with React Native 0.59 onwards, there is a simpler way of handling this update, without the need of patching StatusBar.
306+
```javascript
307+
async openInBrowser(url) {
308+
try {
309+
const oldStyle = StatusBar.pushStackEntry({ barStyle: 'dark-content', animate: false });
310+
await InAppBrowser.open(url)
311+
StatusBar.popStackEntry(oldStyle);
312+
} catch (error) {
313+
Alert.alert(error.message)
314+
}
315+
})
316+
```
317+
318+
For previous versions, you can still apply the method described below.
319+
320+
If you want to change before opening you can do something like
304321

305322
```javascript
306323
async openInBrowser(url) {

0 commit comments

Comments
 (0)