Skip to content

Commit

Permalink
Merged rework into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jazmon committed Nov 12, 2016
2 parents 0ce3b27 + d79587f commit d484ad2
Show file tree
Hide file tree
Showing 40 changed files with 7,168 additions and 488 deletions.
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false

[*.java]
indent_size = 4

[*.gradle]
indent_size = 4
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/**/*
146 changes: 146 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
module.exports = {
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.android.js', '.ios.js']
}
},
'import/core-modules': ['react', 'react-native'],
},
parser: 'babel-eslint',
env: {
node: true,
es6: true,
},
globals: {
fetch: true,
__DEV__: true,
FormData: true,
},
extends: ['plugin:react/recommended', 'plugin:flowtype/recommended', 'airbnb'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 6,
impliedStrict: false,
ecmaFeatures: {
experimentalObjectRestSpread: true,
jsx: true
}
},
plugins: [
'babel',
'jsx-a11y',
'sort-class-members',
'flowtype',
'react',
'react-native'
],
rules: {
'react-native/no-unused-styles': 1,
'react-native/split-platform-components': 2,
'jsx-quotes': ['error', 'prefer-double'],
'jsx-a11y/href-no-hash': 2,
'jsx-a11y/label-has-for': 2,
'jsx-a11y/mouse-events-have-key-events': 2,
'jsx-a11y/role-has-required-aria-props': 2,
'jsx-a11y/role-supports-aria-props': 2,
'jsx-a11y/aria-props': 2,
'react/display-name': 1,
'react/jsx-boolean-value': 0,
'react/jsx-no-undef': 2,
'react/jsx-sort-prop-types': 0,
'react/jsx-sort-props': 0,
'react/jsx-uses-react': 1,
'react/jsx-uses-vars': 1,
'babel/flow-object-type': 1,
'react/no-did-mount-set-state': 1,
'react/no-did-update-set-state': 1,
'react/no-unknown-property': 1,
'react/prop-types': 1,
'react/react-in-jsx-scope': 1,
'react/self-closing-comp': 1,
'sort-class-members/sort-class-members': [1, {
'order': [
'[static-properties]',
'[static-methods]',
'[static-render-methods]',
'[properties]',
'[conventional-private-properties]',
'constructor',
'[lifecycle]',
'[arrow-function-properties]',
'[everything-else]',
'render',
],
'groups': {
'lifecycle': [
'displayName',
'propTypes',
'contextTypes',
'childContextTypes',
'mixins',
'statics',
'defaultProps',
'constructor',
'getDefaultProps',
'state',
'getInitialState',
'getChildContext',
'componentWillMount',
'componentDidMount',
'componentWillReceiveProps',
'shouldComponentUpdate',
'componentWillUpdate',
'componentDidUpdate',
'componentWillUnmount'
],
'static-render-methods': [
{ 'name': '/^render.+$/', 'type': 'method', static: true }
]
}
}],
'react/sort-comp': 0,
'react/jsx-wrap-multilines': 1,
'babel/generator-star-spacing': 0,
'react/jsx-filename-extension': 0, // disabled because react native doesnt like .jsx
'babel/new-cap': 0,
'babel/object-curly-spacing': 0,
'babel/object-shorthand': 1,
'babel/arrow-parens': 0,
'babel/no-await-in-loop': 1,
'arrow-parens': 0,
'new-cap': [
'error',
{ newIsCap: true, capIsNewExceptions: ['Color', 'TouchableNativeFeedback.SelectableBackground'] },
],
indent: [
'warn',
2
],
'linebreak-style': [
'warn',
'unix'
],
quotes: [
'warn',
'single'
],
semi: [
'warn',
'always'
],
'comma-dangle': [
'warn',
'always-multiline'
],
'no-unused-vars': 1,
'no-use-before-define': 0,
'no-console': [
'warn', { allow: ['warn', 'error']}
],
'no-mixed-operators': 0,
'class-methods-use-this': 0,
'react/forbid-prop-types': 0, // replace with 1 for very strict type checks
'no-plusplus': ['error', { 'allowForLoopAfterthoughts': true }],
}
};
3 changes: 2 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ suppress_type=$FixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-6]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-6]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue

[version]
^0.27.0
^0.33.0
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ buck-out/
\.buckd/
android/app/libs
android/keystores/debug.keystore

# yarn
yarn-error.log
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2016 Atte Huhtakangas

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
81 changes: 81 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# react-native-onscreen-navbar
A React Native component to customize the Navigation Bar looks on Android.

## Preview
![](http://i.imgur.com/g95jWQ5.gif)

## Usage

#### Install
`npm install react-native-onscreen-navbar --save`

#### Linking (automatically)
`react-native link react-native-onscreen-navbar`

#### Linking (manually)

##### In `android/app/build.gradle`, add the lines

```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')
```

##### In `android/app/src/main/java/com/example/MainApplication.java`, add the `NavigationBarPackage` dependency.
```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()
);
}
}
```

## Example
Check [index.android.js](https://github.com/Jazmon/react-native-onscreen-navbar/blob/master/examples/ExampleProject/index.android.js) in the examples folder

## Properties

| Prop | Default | Type | Description |
| :------------ |:---------------:| :---------------:| :-----|
| animate | `false` | `boolean` | Whether to animate the background color transitions |
| backgroundColor | #000000 | `string` | BackgroundColor of the Navigation Bar |
| translucent | `false` | `boolean` | Is the Navigation Bar translucent or not |


## Acknowledgements
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.


## License

(c) 2016 Atte Huhtakangas, [MIT license](/LICENSE).
41 changes: 41 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apply plugin: 'com.android.library'

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
}

dependencies {
//noinspection GradleDynamicVersion
compile 'com.facebook.react:react-native:+'
}

allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/node_modules/react-native/android"
}
}
}
Binary file added android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
Loading

0 comments on commit d484ad2

Please sign in to comment.