0.2.0 • Published 3 years ago

react-native-android-system-colors v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

react-native-android-system-colors

Library for managing the native colors of an Android app.

npm version npm downloads npm license


Instalation

To install react-native-android-system-colors - you can use npm or yarn package manager.
npm install react-native-android-system-colors --save

or

yarn add react-native-android-system-colors

Documentation

The react-native-android-system-colors library includes the AndroidSystemColors object interface that has the next methods: setStatusBarColor, setNavigationBarColor, setTaskDescriptionColor. Below you can find the documentation for all methods.

Important! All colors should be provided in the hex format.

The setNavigationBarColor method

Method that change the navigation bar color.
The setNavigationBarColor method accept next arguments:
NameTypeDefault valueRequired
color (hex)stringYes
duration (ms)number0No

The setStatusBarColor method

Method that change the status bar color.
The setStatusBarColor method accept next arguments:
NameTypeDefault valueRequired
color (hex)stringYes
duration (ms)number0No

The setTaskDescriptionColor method

Method that change the recent color.
The setTaskDescriptionColor method accept next arguments:
NameTypeDefault valueRequired
color (hex)stringYes

Examples

  import React, { useEffect } from 'react';
  import { AndroidSystemColors } from 'react-native-android-system-colors';


  const App = () => {

    useEffect(() => {
      const animationDuration = 300;
      const hexColorString = '#2196F3';

      AndroidSystemColors.setStatusBarColor(hexColorString, animationDuration);
      AndroidSystemColors.setNavigationBarColor(hexColorString, animationDuration);
      AndroidSystemColors.setTaskDescriptionColor(hexColorString);
    }, []);

    return null;
  }