File tree Expand file tree Collapse file tree 2 files changed +23
-21
lines changed Expand file tree Collapse file tree 2 files changed +23
-21
lines changed Original file line number Diff line number Diff 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```
Original file line number Diff line number Diff 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 =>
You can’t perform that action at this time.
0 commit comments