React Native navigationbar
Listen to device navigationbar changes in React Native applications on a per screen basis. Works on Android only.
Installing
npm install react-native-navigationbar-obsever --save
Linking Native Dependencies
Automatic Linking
react-native link react-native-navigationbar-obsever
Android
-
In
android/setting.gradle
... include ':react-native-navigationbar-obsever', ':app' project(':react-native-navigationbar-obsever').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigationbar-obsever/android')
-
In
android/app/build.gradle
... dependencies { ... compile project(':react-native-navigationbar-obsever') }
Usage
;
// ... { if PlatformOS === 'android' NavigationbarObsever; //if you want to listener,you should bind first. NavigationbarObsever; //if you want to listener,you should addListener at second. DeviceEventEmitter; } { console; } { if PlatformOS === 'android' //don't forget unbind and remove NavigationbarObsever; DeviceEventEmitter; } { // ... return // ... }