Skip to content

React Native component to change bottom bar/navigation bar color on Android

License

Notifications You must be signed in to change notification settings

codivoire/react-native-navigation-bar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@codivoire/react-native-navigation-bar

FOSSA Status npm version npm downloads Supports Android MIT License

React Native Navigation Bar Color Change is a library for change color of navigation/Bottom bar on Android

| | | | | |

Dependencies:

  • React Native >= 0.60.0
  • Android Only

Installation

$ yarn add @codivoire/react-native-navigation-bar

or

$ npm install @codivoire/react-native-navigation-bar --save

Example

import React from 'react';
import {View, Text, Button} from 'react-native';
import NavigationBar from '@codivoire/react-native-navigation-bar';

export default function App() {
  const setNavigationColor = color => {
    NavigationBar.changeColor(color);
  };
  const hideNavigation = () => {
    NavigationBar.hide();
  };

  const showNavigation = () => {
    NavigationBar.show();
  };

  const testSetTranslucent = () => {
    NavigationBar.changeColor('translucent', false);
  };

  const testSetTransparent = () => {
    NavigationBar.changeColor('transparent', true);
  };

  return (
    <View
      style={{
        flex: 1,
        justifyContent: 'space-around',
        alignContent: 'center',
        alignItems: 'center',
        backgroundColor: 'cyan',
      }}>
      <Button title="Set transparent" onPress={testSetTransparent} />
      <Button title="Set translucent" onPress={testSetTranslucent} />
      <Button
        title="Set color red"
        onPress={() => {
          setNavigationColor('red');
        }}
      />
      <Button
        title="Set color blue"
        onPress={() => {
          setNavigationColor('blue');
        }}
      />
      <Button
        title="Set color ligth"
        onPress={() => {
          NavigationBar.changeColor('#ffffff', true);
        }}
      />
      <Button title="Hide bar" onPress={hideNavigation} />
      <Button title="Show bar" onPress={showNavigation} />
      <Text>Hello Word!</Text>
    </View>
  );
}

API

changeColor(color, Boolean(light icon color), Boolean(animated - default is true)): (Android)

Change color of Navigation/Bottom bar. color can be a "translucent" | "transparent" | HEX color, or name.

ex: green, blue, #80b3ff, #ffffff....

Light is true? icons will be dark.

  import NavigationBar from '@codivoire/react-native-navigation-bar';
  
  NavigationBar.changeColor('#80b3ff');

hide(): (Android)

Hide Navigation Bar

  import NavigationBar from '@codivoire/react-native-navigation-bar';
  
  NavigationBar.hide();

show(): (Android)

Show Navigation Bar

  import NavigationBar from '@codivoire/react-native-navigation-bar';
  
  NavigationBar.show();

License

MIT

About

React Native component to change bottom bar/navigation bar color on Android

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published