Skip to content

Commit 72f63b8

Browse files
author
Kanta Asada
committed
Fix lint.
1 parent 98dd6f9 commit 72f63b8

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,11 @@ Permissions.request('location', { type: 'always' }).then(response => {
195195
this.setState({ locationPermission: response })
196196
})
197197

198-
Permissions.request('notification', { type: ['alert', 'badge'] }).then(response => {
199-
this.setState({ notificationPermission: response })
200-
})
198+
Permissions.request('notification', { type: ['alert', 'badge'] }).then(
199+
response => {
200+
this.setState({ notificationPermission: response })
201+
},
202+
)
201203
```
202204

203205
* You cannot request microphone permissions on the simulator.
@@ -259,16 +261,14 @@ You can find more informations about this issue in #46.
259261

260262
```js
261263
// example
262-
Permissions.request(
263-
'camera',
264-
{
265-
rationale: {
266-
'title': 'Cool Photo App Camera Permission',
267-
'message': 'Cool Photo App needs access to your camera ' +
268-
'so you can take awesome pictures.'
269-
},
264+
Permissions.request('camera', {
265+
rationale: {
266+
title: 'Cool Photo App Camera Permission',
267+
message:
268+
'Cool Photo App needs access to your camera ' +
269+
'so you can take awesome pictures.',
270270
},
271-
).then(response => {
271+
}).then(response => {
272272
this.setState({ cameraPermission: response })
273273
})
274274
```

index.android.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class ReactNativePermissions {
6161
})
6262
}
6363

64-
request = (permission, { rationale }) => {
64+
request = (permission, { rationale }) => {
6565
const androidPermission = permissionTypes[permission]
6666

6767
if (!androidPermission) {
@@ -72,15 +72,17 @@ class ReactNativePermissions {
7272
)
7373
}
7474

75-
return PermissionsAndroid.request(androidPermission, rationale).then(result => {
76-
// PermissionsAndroid.request() to native module resolves to boolean
77-
// rather than string if running on OS version prior to Android M
78-
if (typeof result === 'boolean') {
79-
return result ? 'authorized' : 'denied'
80-
}
75+
return PermissionsAndroid.request(androidPermission, rationale).then(
76+
result => {
77+
// PermissionsAndroid.request() to native module resolves to boolean
78+
// rather than string if running on OS version prior to Android M
79+
if (typeof result === 'boolean') {
80+
return result ? 'authorized' : 'denied'
81+
}
8182

82-
return setDidAskOnce(permission).then(() => RESULTS[result])
83-
})
83+
return setDidAskOnce(permission).then(() => RESULTS[result])
84+
},
85+
)
8486
}
8587

8688
checkMultiple = permissions =>

0 commit comments

Comments
 (0)