0.3.0 • Published 2 years ago

react-native-detect-navbar-android v0.3.0

Weekly downloads
354
License
ISC
Repository
github
Last release
2 years ago

react-native-detect-navbar-android

Detect soft navigation bar for Android devices

Note: this project is Android only

Installation Process

  • download this from npm
npm install react-native-detect-navbar-android --save
  • Run react-native link or...

  • Edit android/settings.gradle:

    + include ':react-native-detect-navbar-android'
    + project(':react-native-detect-navbar-android').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-detect-navbar-android/android')
  • Edit android/app/build.gradle:

    dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      compile "com.android.support:appcompat-v7:23.0.1"
      compile "com.facebook.react:react-native:+"
    + compile project(':react-native-detect-navbar-android')
    }
  • Edit your android/app/src/main/java/.../MainApplication.java:

    + import import com.rndetectnavbarandroid.RNDetectNavbarAndroidPackage;
      @Override
      protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
          new MainReactPackage()
    +     , new RNDetectNavbarAndroidPackage()
        );
      }

Usage

import DetectNavbar from 'react-native-detect-navbar-android';
// or
import {DetectNavbar} from 'react-native-detect-navbar-android';
// or
const DetectNavbar = require('react-native-detect-navbar-android');

// methods (Android Only, don't call on iOS)
DetectNavbar.hasSoftKeys().then((bool) => {
  if(bool) {
    console.log('Has Soft NavBar');
  } else {
    console.log('Has Hard Key NavBar');
  }
});
0.3.0

2 years ago

0.2.0

4 years ago

0.1.0

5 years ago