Skip to content

Commit 116f32c

Browse files
author
alvaromb
committed
First version 🐣
1 parent 2176623 commit 116f32c

9 files changed

Lines changed: 623 additions & 0 deletions

File tree

.eslintrc

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
{
2+
"parser": "babel-eslint",
3+
4+
"parserOptions": {
5+
"ecmaFeatures": {
6+
"jsx": true,
7+
"modules": true,
8+
"experimentalObjectRestSpread": true
9+
}
10+
},
11+
12+
"env": {
13+
"es6": true,
14+
"jasmine": true,
15+
"node": 1
16+
},
17+
18+
"plugins": [
19+
"react"
20+
],
21+
22+
"globals": {
23+
"__DEV__": true,
24+
"__dirname": false,
25+
"__fbBatchedBridgeConfig": false,
26+
"cancelAnimationFrame": false,
27+
"clearImmediate": true,
28+
"clearInterval": false,
29+
"clearTimeout": false,
30+
"console": false,
31+
"document": false,
32+
"escape": false,
33+
"exports": false,
34+
"fetch": false,
35+
"global": false,
36+
"jest": false,
37+
"Map": true,
38+
"module": false,
39+
"navigator": false,
40+
"process": false,
41+
"Promise": true,
42+
"requestAnimationFrame": true,
43+
"require": false,
44+
"Set": true,
45+
"setImmediate": true,
46+
"setInterval": false,
47+
"setTimeout": false,
48+
"window": false,
49+
"XMLHttpRequest": false,
50+
"pit": false,
51+
"FormData": true
52+
},
53+
54+
"rules": {
55+
"comma-dangle": 0,
56+
"no-cond-assign": 1,
57+
"no-console": 0,
58+
"no-constant-condition": 0,
59+
"no-control-regex": 1,
60+
"no-debugger": 1,
61+
"no-dupe-keys": 1,
62+
"no-empty": 0,
63+
"no-empty-character-class": 1,
64+
"no-ex-assign": 1,
65+
"no-extra-boolean-cast": 1,
66+
"no-extra-parens": 0,
67+
"no-extra-semi": 1,
68+
"no-func-assign": 1,
69+
"no-inner-declarations": 0,
70+
"no-invalid-regexp": 1,
71+
"no-negated-in-lhs": 1,
72+
"no-obj-calls": 1,
73+
"no-regex-spaces": 1,
74+
"no-reserved-keys": 0,
75+
"no-sparse-arrays": 1,
76+
"no-unreachable": 1,
77+
"use-isnan": 1,
78+
"valid-jsdoc": 0,
79+
"valid-typeof": 1,
80+
"block-scoped-var": 0,
81+
"complexity": 0,
82+
"consistent-return": 0,
83+
"curly": 1,
84+
"default-case": 0,
85+
"dot-notation": 1,
86+
"eqeqeq": 1,
87+
"guard-for-in": 0,
88+
"no-alert": 1,
89+
"no-caller": 1,
90+
"no-div-regex": 1,
91+
"no-else-return": 0,
92+
"no-labels": 1,
93+
"no-eq-null": 0,
94+
"no-eval": 1,
95+
"no-extend-native": 1,
96+
"no-extra-bind": 1,
97+
"no-fallthrough": 1,
98+
"no-floating-decimal": 1,
99+
"no-implied-eval": 1,
100+
"no-iterator": 1,
101+
"no-lone-blocks": 1,
102+
"no-loop-func": 0,
103+
"no-multi-str": 0,
104+
"no-native-reassign": 0,
105+
"no-new": 1,
106+
"no-new-func": 1,
107+
"no-new-wrappers": 1,
108+
"no-octal": 1,
109+
"no-octal-escape": 1,
110+
"no-proto": 1,
111+
"no-redeclare": 0,
112+
"no-return-assign": 1,
113+
"no-script-url": 1,
114+
"no-self-compare": 1,
115+
"no-sequences": 1,
116+
"no-unused-expressions": 0,
117+
"no-void": 1,
118+
"no-warning-comments": 0,
119+
"no-with": 1,
120+
"radix": 1,
121+
"vars-on-top": 0,
122+
"wrap-iife": 0,
123+
"yoda": 1,
124+
125+
"strict": 0,
126+
127+
"no-catch-shadow": 1,
128+
"no-delete-var": 1,
129+
"no-label-var": 1,
130+
"no-shadow": 1,
131+
"no-shadow-restricted-names": 1,
132+
"no-undef": 2,
133+
"no-undefined": 0,
134+
"no-undef-init": 1,
135+
"no-unused-vars": [1, {"vars": "all", "args": "none"}],
136+
"no-use-before-define": 0,
137+
"handle-callback-err": 1,
138+
"no-mixed-requires": 1,
139+
"no-new-require": 1,
140+
"no-path-concat": 1,
141+
"no-process-exit": 0,
142+
"no-restricted-modules": 1,
143+
"no-sync": 0,
144+
145+
"key-spacing": 0,
146+
"comma-spacing": 0,
147+
"no-multi-spaces": 0,
148+
"brace-style": 0,
149+
"camelcase": 0,
150+
"consistent-this": [1, "self"],
151+
"eol-last": 1,
152+
"func-names": 0,
153+
"func-style": 0,
154+
"new-cap": 0,
155+
"new-parens": 1,
156+
"no-nested-ternary": 0,
157+
"no-array-constructor": 1,
158+
"no-lonely-if": 0,
159+
"no-new-object": 1,
160+
"no-spaced-func": 1,
161+
"semi-spacing": 1,
162+
"no-ternary": 0,
163+
"no-trailing-spaces": 1,
164+
"no-underscore-dangle": 0,
165+
"no-mixed-spaces-and-tabs": 1,
166+
"quotes": [1, "single", "avoid-escape"],
167+
"quote-props": 0,
168+
"semi": 0,
169+
"sort-vars": 0,
170+
"keyword-spacing": [0, { "before": true }],
171+
"space-in-brackets": 0,
172+
"space-in-parens": 0,
173+
"space-infix-ops": 1,
174+
"space-unary-ops": [1, { "words": true, "nonwords": false }],
175+
"max-nested-callbacks": 0,
176+
"one-var": 0,
177+
"wrap-regex": 0,
178+
179+
"max-depth": 0,
180+
"max-len": 0,
181+
"max-params": 0,
182+
"max-statements": 0,
183+
"no-bitwise": 1,
184+
"no-plusplus": 0,
185+
186+
"react/display-name": 0,
187+
"react/jsx-boolean-value": 0,
188+
"react/jsx-no-undef": 1,
189+
"react/jsx-sort-props": 0,
190+
"react/jsx-uses-react": 0,
191+
"react/jsx-uses-vars": 1,
192+
"react/no-did-mount-set-state": 1,
193+
"react/no-did-update-set-state": 1,
194+
"react/no-multi-comp": 0,
195+
"react/no-unknown-property": 0,
196+
"react/prop-types": 0,
197+
"react/react-in-jsx-scope": 0,
198+
"react/self-closing-comp": 1,
199+
"react/wrap-multilines": 0
200+
}
201+
}

.gitignore

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Xcode
2+
!**/*.xcodeproj
3+
!**/*.pbxproj
4+
!**/*.xcworkspacedata
5+
!**/*.xcsettings
6+
!**/*.xcscheme
7+
*.pbxuser
8+
!default.pbxuser
9+
*.mode1v3
10+
!default.mode1v3
11+
*.mode2v3
12+
!default.mode2v3
13+
*.perspectivev3
14+
!default.perspectivev3
15+
xcuserdata
16+
*.xccheckout
17+
*.moved-aside
18+
DerivedData
19+
*.hmap
20+
*.ipa
21+
*.xcuserstate
22+
project.xcworkspace
23+
24+
# Gradle
25+
/build/
26+
/Examples/**/android/app/build/
27+
/Examples/**/android/app/gradle/
28+
/Examples/**/android/app/gradlew
29+
/Examples/**/android/app/gradlew.bat
30+
/ReactAndroid/build/
31+
32+
# Buck
33+
.buckd
34+
buck-out
35+
/ReactAndroid/src/main/jni/prebuilt/lib/armeabi-v7a/
36+
/ReactAndroid/src/main/jni/prebuilt/lib/x86/
37+
38+
# Android
39+
.idea
40+
.gradle
41+
local.properties
42+
*.iml
43+
/android/
44+
45+
# Node
46+
node_modules
47+
*.log
48+
.nvm
49+
50+
# OS X
51+
.DS_Store
52+
53+
# Test generated files
54+
/ReactAndroid/src/androidTest/assets/AndroidTestBundle.js

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
language: node_js
2+
node_js:
3+
- 6.4.0

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
# react-native-version-number
3+
<img src="https://travis-ci.org/APSL/react-native-version-number.svg?branch=master" />
4+
5+
Returns the `CFBundleShortVersionString` and the `CFBundleVersion`. Android version is under development.
6+
7+
## Getting started
8+
9+
`$ npm install react-native-version-number --save`
10+
11+
### Mostly automatic installation
12+
13+
`$ react-native link react-native-version-number`
14+
15+
### Manual installation
16+
17+
#### iOS
18+
19+
1. In Xcode, in the project navigator, right click `Libraries``Add Files to [your project's name]`
20+
2. Go to `node_modules``react-native-version-number` and add `RNVersionNumber.xcodeproj`
21+
3. In Xcode, in the project navigator, select your project. Add `libRNVersionNumber.a` to your project's `Build Phases``Link Binary With Libraries`
22+
4. Run your project (`Cmd+R`)<
23+
24+
25+
## Usage
26+
```javascript
27+
import VersionNumber from 'react-native-version-number';
28+
29+
console.log(VersionNumber.appVersion);
30+
console.log(VersionNumber.buildVersion);
31+
```
32+
33+
## License
34+
MIT.

index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* @flow */
2+
3+
import { NativeModules } from 'react-native';
4+
5+
const { RNVersionNumber } = NativeModules;
6+
7+
type VersionObject = {
8+
appVersion: string,
9+
buildVersion: string
10+
}
11+
12+
const VersionNumber: VersionObject = {
13+
appVersion: RNVersionNumber.appVersion,
14+
buildVersion: RNVersionNumber.buildVersion,
15+
}
16+
17+
export default VersionNumber;

ios/RNVersionNumber.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
#import "RCTBridgeModule.h"
3+
4+
@interface RNVersionNumber : NSObject <RCTBridgeModule>
5+
6+
@end
7+

ios/RNVersionNumber.m

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
#import "RNVersionNumber.h"
3+
4+
@implementation RNVersionNumber
5+
6+
- (dispatch_queue_t)methodQueue
7+
{
8+
return dispatch_get_main_queue();
9+
}
10+
RCT_EXPORT_MODULE()
11+
12+
- (NSDictionary *)constantsToExport
13+
{
14+
return @{@"appVersion" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"],
15+
@"buildVersion": [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]};
16+
}
17+
18+
@end

0 commit comments

Comments
 (0)