Skip to content

Commit 8988150

Browse files
committed
Update dependencies + format
1 parent e489dfc commit 8988150

File tree

7 files changed

+989
-412
lines changed

7 files changed

+989
-412
lines changed

.flowconfig

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,99 @@
11
[ignore]
2+
; We fork some components by platform
3+
.*/*[.]android.js
4+
5+
; Ignore "BUCK" generated dirs
6+
<PROJECT_ROOT>/\.buckd/
7+
8+
; Ignore unexpected extra "@providesModule"
9+
.*/node_modules/.*/node_modules/fbjs/.*
10+
11+
; Ignore duplicate module providers
12+
; For RN Apps installed via npm, "Libraries" folder is inside
13+
; "node_modules/react-native" but in the source repo it is in the root
14+
example/node_modules/react-native/Libraries/react-native/React.js
15+
16+
; Ignore polyfills
17+
example/node_modules/react-native/Libraries/polyfills/.*
18+
19+
; These should not be required directly
20+
; require from fbjs/lib instead: require('fbjs/lib/warning')
21+
example/node_modules/warning/.*
22+
23+
; Flow doesn't support platforms
24+
.*/Libraries/Utilities/HMRLoadingView.js
25+
26+
[untyped]
27+
.*/node_modules/@react-native-community/cli/.*/.*
228

329
[include]
430

531
[libs]
32+
example/node_modules/react-native/Libraries/react-native/react-native-interface.js
33+
example/node_modules/react-native/flow/
34+
35+
[options]
36+
emoji=true
37+
38+
esproposal.optional_chaining=enable
39+
esproposal.nullish_coalescing=enable
40+
41+
module.file_ext=.js
42+
module.file_ext=.json
43+
module.file_ext=.ios.js
44+
45+
module.system=haste
46+
module.system.haste.use_name_reducers=true
47+
# get basename
48+
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
49+
# strip .js or .js.flow suffix
50+
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
51+
# strip .ios suffix
52+
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
53+
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
54+
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
55+
module.system.haste.paths.blacklist=.*/__tests__/.*
56+
module.system.haste.paths.blacklist=.*/__mocks__/.*
57+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/example/node_modules/react-native/Libraries/.*
58+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/example/node_modules/react-native/RNTester/.*
59+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/example/node_modules/react-native/IntegrationTests/.*
60+
module.system.haste.paths.blacklist=<PROJECT_ROOT>/example/node_modules/react-native/Libraries/react-native/react-native-implementation.js
61+
module.system.haste.paths.blacklist=<PROJECT_ROOT>/example/node_modules/react-native/Libraries/Animated/src/polyfills/.*
62+
63+
munge_underscores=true
64+
65+
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
66+
67+
suppress_type=$FlowIssue
68+
suppress_type=$FlowFixMe
69+
suppress_type=$FlowFixMeProps
70+
suppress_type=$FlowFixMeState
71+
72+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
73+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
74+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
675

776
[lints]
77+
sketchy-null-number=warn
78+
sketchy-null-mixed=warn
79+
sketchy-number=warn
80+
untyped-type-import=warn
81+
nonstrict-import=warn
82+
deprecated-type=warn
83+
unsafe-getters-setters=warn
84+
inexact-spread=warn
85+
unnecessary-invariant=warn
86+
signature-verification-failure=warn
87+
deprecated-utility=error
888

9-
[options]
89+
[strict]
90+
deprecated-type
91+
nonstrict-import
92+
sketchy-null
93+
unclear-type
94+
unsafe-getters-setters
95+
untyped-import
96+
untyped-type-import
97+
98+
[version]
99+
^0.98.0

README.md

Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ _Complies with
2020

2121
## ⚠️ Breaking changes in version 1.0.0
2222

23-
* Now using React Native's own JS `PermissionsAndroid` module on Android, which
23+
- Now using React Native's own JS `PermissionsAndroid` module on Android, which
2424
is great because we no longer have to do any additional linking on Android
25-
* Updated API to be closer to React Native's `PermissionsAndroid`
26-
* Removed `openSettings()` support on Android (to stay linking-free). There are
25+
- Updated API to be closer to React Native's `PermissionsAndroid`
26+
- Removed `openSettings()` support on Android (to stay linking-free). There are
2727
several NPM modules available for this
28-
* `restricted` status now supported on Android, although it means something
28+
- `restricted` status now supported on Android, although it means something
2929
different than iOS
3030

3131
## Setup
@@ -62,13 +62,12 @@ react-native link react-native-permissions
6262
folder ➜ `Add Files to <...>`
6363
2. Go to `node_modules``react-native-permissions` ➜ select
6464
`ReactNativePermissions.xcodeproj`
65-
3. Add `libReactNativePermissions.a` to `Build Phases` -> `Link Binary With
66-
Libraries`
65+
3. Add `libReactNativePermissions.a` to `Build Phases` -> `Link Binary With Libraries`
6766

6867
## Using
6968

7069
```js
71-
import Permissions from 'react-native-permissions'
70+
import Permissions from 'react-native-permissions';
7271
// OR const Permissions = require('react-native-permissions').default
7372
// if you use CommonJS module system
7473

@@ -81,18 +80,18 @@ export default class extends React.Component {
8180
componentDidMount() {
8281
Permissions.check('photo').then(response => {
8382
// Response is one of: 'authorized', 'denied', 'restricted', or 'undetermined'
84-
this.setState({ photoPermission: response })
85-
})
83+
this.setState({photoPermission: response});
84+
});
8685
}
8786

8887
// Request permission to access photos
8988
_requestPermission = () => {
9089
Permissions.request('photo').then(response => {
9190
// Returns once the user has chosen to 'allow' or to 'not allow' access
9291
// Response is one of: 'authorized', 'denied', 'restricted', or 'undetermined'
93-
this.setState({ photoPermission: response })
94-
})
95-
}
92+
this.setState({photoPermission: response});
93+
});
94+
};
9695

9796
// Check the status of multiple permissions
9897
_checkCameraAndPhotos = () => {
@@ -101,9 +100,9 @@ export default class extends React.Component {
101100
this.setState({
102101
cameraPermission: response.camera,
103102
photoPermission: response.photo,
104-
})
105-
})
106-
}
103+
});
104+
});
105+
};
107106

108107
// This is a common pattern when asking for permissions.
109108
// iOS only gives you once chance to show the permission dialog,
@@ -122,10 +121,10 @@ export default class extends React.Component {
122121
style: 'cancel',
123122
},
124123
this.state.photoPermission == 'undetermined'
125-
? { text: 'OK', onPress: this._requestPermission }
126-
: { text: 'Open Settings', onPress: Permissions.openSettings },
124+
? {text: 'OK', onPress: this._requestPermission}
125+
: {text: 'Open Settings', onPress: Permissions.openSettings},
127126
],
128-
)
127+
);
129128
}
130129

131130
//...
@@ -141,7 +140,7 @@ Promises resolve into one of these statuses:
141140
| Return value | Notes |
142141
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
143142
| `authorized` | User has authorized this permission |
144-
| `denied` | User has denied this permission at least once. On iOS this means that the user will not be prompted again. Android users can be prompted multiple times until they select 'Never ask me again' |
143+
| `denied` | User has denied this permission at least once. On iOS this means that the user will not be prompted again. Android users can be prompted multiple times until they select 'Never ask me again' |
145144
| `restricted` | **iOS** - this means user is not able to grant this permission, either because it's not supported by the device or because it has been blocked by parental controls. **Android** - this means that the user has selected 'Never ask me again' while denying permission |
146145
| `undetermined` | User has not yet been prompted with a permission dialog |
147146

@@ -182,40 +181,39 @@ The current supported permissions are:
182181

183182
### iOS Notes
184183

185-
* Permission type `bluetooth` represents the status of the
184+
- Permission type `bluetooth` represents the status of the
186185
`CBPeripheralManager`. Don't use this if you only need `CBCentralManager`.
187-
* Permission type `location` accepts a second parameter for `request()` and
186+
- Permission type `location` accepts a second parameter for `request()` and
188187
`check()`; the second parameter is a string, either `always` or `whenInUse`
189188
(default).
190-
* Permission type `notification` accepts a second parameter for `request()`. The
189+
- Permission type `notification` accepts a second parameter for `request()`. The
191190
second parameter is an array with the desired alert types. Any combination of
192191
`alert`, `badge` and `sound` (default requests all three).
193-
* If you are not requesting mediaLibrary then you can remove MediaPlayer.framework from the xcode project.
192+
- If you are not requesting mediaLibrary then you can remove MediaPlayer.framework from the xcode project.
194193

195194
```js
196195
// example
197-
Permissions.check('location', { type: 'always' }).then(response => {
198-
this.setState({ locationPermission: response })
199-
})
196+
Permissions.check('location', {type: 'always'}).then(response => {
197+
this.setState({locationPermission: response});
198+
});
200199

201-
Permissions.request('location', { type: 'always' }).then(response => {
202-
this.setState({ locationPermission: response })
203-
})
200+
Permissions.request('location', {type: 'always'}).then(response => {
201+
this.setState({locationPermission: response});
202+
});
204203

205-
Permissions.request('notification', { type: ['alert', 'badge'] }).then(
204+
Permissions.request('notification', {type: ['alert', 'badge']}).then(
206205
response => {
207-
this.setState({ notificationPermission: response })
206+
this.setState({notificationPermission: response});
208207
},
209-
)
208+
);
210209
```
211210

212-
* You cannot request microphone permissions on the simulator.
213-
* With Xcode 8, you now need to add usage descriptions for each permission you
211+
- You cannot request microphone permissions on the simulator.
212+
- With Xcode 8, you now need to add usage descriptions for each permission you
214213
will request. Open Xcode ➜ `Info.plist` ➜ Add a key (starting with "Privacy -
215214
...") with your kit specific permission.
216215

217-
Example: If you need Contacts permission you have to add the key `Privacy -
218-
Contacts Usage Description`.
216+
Example: If you need Contacts permission you have to add the key `Privacy - Contacts Usage Description`.
219217

220218
<img width="338" alt="3cde3b44-7ffd-11e6-918b-63888e33f983" src="https://cloud.githubusercontent.com/assets/1440796/18713019/271be540-8011-11e6-87fb-c3828c172dfc.png">
221219

@@ -248,6 +246,7 @@ So before submitting your app to the App Store, make sure that in your
248246
<key>NSMotionUsageDescription</key>
249247
<string>Some description</string>
250248
```
249+
251250
This is required because during the phase of processing in the App Store
252251
submission, the system detects that you app contains code to request the
253252
permission `X` but don't have the `UsageDescription` key and then it rejects the
@@ -260,16 +259,16 @@ You can find more information about this issue in #46.
260259

261260
### Android Notes
262261

263-
* Uses React Native's own
262+
- Uses React Native's own
264263
[`PermissionsAndroid` JS API](http://facebook.github.io/react-native/docs/permissionsandroid.html).
265-
* All required permissions also need to be included in the `AndroidManifest.xml`
264+
- All required permissions also need to be included in the `AndroidManifest.xml`
266265
file before they can be requested. Otherwise `request()` will immediately
267266
return `denied`.
268-
* You can request write access to any of these types by also including the
267+
- You can request write access to any of these types by also including the
269268
appropriate write permission in the `AndroidManifest.xml` file. Read more
270269
[here](https://developer.android.com/guide/topics/security/permissions.html#normal-dangerous).
271270

272-
* The optional rationale argument will show a dialog prompt.
271+
- The optional rationale argument will show a dialog prompt.
273272

274273
```js
275274
// example
@@ -281,11 +280,11 @@ Permissions.request('camera', {
281280
'so you can take awesome pictures.',
282281
},
283282
}).then(response => {
284-
this.setState({ cameraPermission: response })
285-
})
283+
this.setState({cameraPermission: response});
284+
});
286285
```
287286

288-
* Permissions are automatically accepted for **targetSdkVersion < 23** but you
287+
- Permissions are automatically accepted for **targetSdkVersion < 23** but you
289288
can still use `check()` to check if the user has disabled them from Settings.
290289

291290
You might need to elevate the **targetSdkVersion** version in your

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// @flow
22

3-
import Permissions from './lib/permissions'
4-
export default Permissions
3+
import Permissions from './lib/permissions';
4+
export default Permissions;

0 commit comments

Comments
 (0)