react-native-navigation-bar-color
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -1,3 +0,4 @@ | ||
import { changeNavigationBarColor } from './src'; | ||
import { changeNavigationBarColor, HideNavigationBar, ShowNavigationBar } from './src'; | ||
export default changeNavigationBarColor; | ||
export { HideNavigationBar, ShowNavigationBar }; |
{ | ||
"name": "react-native-navigation-bar-color", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "React Native component to change bottom bar/navigation bar color on Android", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -36,6 +36,5 @@ # React Native Navigation Bar Color Change | ||
2. Append the following lines to `android/settings.gradle`: | ||
```include ':react-native-navigation-bar-color' | ||
project(':react-native-navigation-bar-color').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation-bar-color/android') | ||
``` | ||
include ':react-native-navigation-bar-color' | ||
project(':react-native-navigation-bar-color').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation-bar-color/android') | ||
``` | ||
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`: | ||
@@ -51,12 +50,18 @@ ``` | ||
import React, { Component } from 'react'; | ||
import { View, Text } from 'react-native'; | ||
import changeNavigationBarColor from 'react-native-navigation-bar-color'; | ||
import { View, Text, Button } from 'react-native'; | ||
import changeNavigationBarColor, { | ||
HideNavigationBar, | ||
ShowNavigationBar, | ||
} from 'react-native-navigation-bar-color'; | ||
export default class Mynewapp extends Component { | ||
componentDidMount = () => { | ||
this.example(); | ||
setNavigationColor = (color) => { | ||
changeNavigationBarColor(color); | ||
}; | ||
hideNavigation = () => { | ||
HideNavigationBar(); | ||
}; | ||
example = () => { | ||
changeNavigationBarColor('red'); | ||
showNavigation = () => { | ||
ShowNavigationBar(); | ||
}; | ||
@@ -69,6 +74,31 @@ | ||
flex: 1, | ||
justifyContent: 'center', | ||
justifyContent: 'space-around', | ||
alignContent: 'center', | ||
alignItems: 'center', | ||
}} | ||
> | ||
<Button | ||
title="Set color red" | ||
onPress={() => { | ||
this.setNavigationColor('red'); | ||
}} | ||
/> | ||
<Button | ||
title="Set color blue" | ||
onPress={() => { | ||
this.setNavigationColor('blue'); | ||
}} | ||
/> | ||
<Button | ||
title="Hide bar" | ||
onPress={() => { | ||
this.hideNavigation(); | ||
}} | ||
/> | ||
<Button | ||
title="Show bar" | ||
onPress={() => { | ||
this.showNavigation(); | ||
}} | ||
/> | ||
<Text>Hello Word!</Text> | ||
@@ -102,4 +132,26 @@ </View> | ||
### `HideNavigationBar()`: (Android) | ||
Hide Navigation Bar | ||
```javascript | ||
import { HideNavigationBar } from 'react-native-navigation-bar-color'; | ||
... | ||
hide = () => { | ||
HideNavigationBar(); | ||
}; | ||
``` | ||
### `ShowNavigationBar()`: (Android) | ||
Show Navigation Bar | ||
```javascript | ||
import { ShowNavigationBar } from 'react-native-navigation-bar-color'; | ||
... | ||
show = () => { | ||
ShowNavigationBar(); | ||
}; | ||
``` | ||
## License | ||
MIT |
@@ -7,3 +7,7 @@ import { NativeModules } from 'react-native'; | ||
NavigationBarColor.changeNavigationBarColor(color); | ||
const HideNavigationBar = () => | ||
NavigationBarColor.HideNavigationBar(); | ||
const ShowNavigationBar = () => | ||
NavigationBarColor.ShowNavigationBar(); | ||
export { changeNavigationBarColor }; | ||
export { changeNavigationBarColor, HideNavigationBar, ShowNavigationBar }; |
Sorry, the diff of this file is not supported yet
63885
131
154