react-native-onscreen-navbar
Version:
Onscreen navigation bar customization component for Android
87 lines (63 loc) • 2.79 kB
Markdown
[](https://travis-ci.org/jazmon/react-native-onscreen-navbar)
A React Native component to customize the Navigation Bar looks on Android.

`npm install react-native-onscreen-navbar --save`
For react-native pre 0.46.0 use a older version
`npm install react-native-onscreen-navbar@1.2.0 --save`
`react-native link react-native-onscreen-navbar`
```diff
dependencies {
+ compile project(':react-native-onscreen-navbar')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
}
```
##### In `android/settings.gradle`, add the lines
```diff
include ':app'
+ include ':react-native-onscreen-navbar'
+ project(':react-native-onscreen-navbar').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-onscreen-navbar/android')
```
```diff
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
+ import com.attehuhtakangas.navigationbar.NavigationBarPackage;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
...
/**
* A list of packages used by the app. If the app uses additional views
* or modules besides the default ones, add more packages here.
*/
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
+ new NavigationBarPackage()
);
}
}
```
Check [index.android.js](https://github.com/Jazmon/react-native-onscreen-navbar/blob/master/examples/ExampleProject/index.android.js) in the examples folder
| Prop | Default | Type | Description |
| :------------ |:---------------:| :---------------:| :-----|
| animate | `false` | `boolean` | Whether to animate the background color transitions |
| backgroundColor |
| translucent | `false` | `boolean` | Is the Navigation Bar translucent or not |
Inspired heavily by [StatusBar](https://github.com/facebook/react-native/blob/0.27-stable/Libraries/Components/StatusBar/StatusBar.js) in the React Native main repo.
(c) 2017 Atte Huhtakangas, [MIT license](/LICENSE).