Socket
Book a DemoInstallSign in
Socket

react-native-navigationbar-obsever

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-navigationbar-obsever

Android-NvagationShowing-Listener

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

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

import NavigationbarObsever from 'react-native-navigationbar-obsever';
export default class AppScreen extends Component {
  // ...

    componentDidMount() {
      if (Platform.OS === 'android') {
        NavigationbarObsever.isNavigationbarShow((err, isShow) => {
          console.log(err, isShow, 'isShow');
        });
        //if you want to listener,you should bind first.
        NavigationbarObsever.bindListener((err,isOK) => {
          console.log(err, isOK, 'isOK');
        });
        //if you want to listener,you should addListener at second.
        DeviceEventEmitter.addListener('navigationbarDidShowChange', this._navigationDidShowChange);
      }
    }
  
    _navigationDidShowChange = (show) => {
      console.log(show.navigationbarSize, 'navigationbarSize',show.navigationbarShow, 'navigationbarShow');
    }
  
    componentWillUnmount() {
      if (Platform.OS === 'android') {
          //don't forget unbind and remove
        NavigationbarObsever.unbindListener();
        DeviceEventEmitter.removeListener(this._navigationDidShowChange);
        }
    }

  render() {
    // ...

    return (
      // ...
    )
  }
}

Keywords

react-native

FAQs

Package last updated on 10 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.