Browse Source

Fix lint.

Kanta Asada 7 years ago
parent
commit
72f63b830a
2 changed files with 23 additions and 21 deletions
  1. 12
    12
      README.md
  2. 11
    9
      index.android.js

+ 12
- 12
README.md View File

195
   this.setState({ locationPermission: response })
195
   this.setState({ locationPermission: response })
196
 })
196
 })
197
 
197
 
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
+)
201
 ```
203
 ```
202
 
204
 
203
 * You cannot request microphone permissions on the simulator.
205
 * You cannot request microphone permissions on the simulator.
259
 
261
 
260
 ```js
262
 ```js
261
 // example
263
 // 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.',
270
   },
270
   },
271
-).then(response => {
271
+}).then(response => {
272
   this.setState({ cameraPermission: response })
272
   this.setState({ cameraPermission: response })
273
 })
273
 })
274
 ```
274
 ```

+ 11
- 9
index.android.js View File

61
     })
61
     })
62
   }
62
   }
63
 
63
 
64
-    request = (permission, { rationale }) => {
64
+  request = (permission, { rationale }) => {
65
     const androidPermission = permissionTypes[permission]
65
     const androidPermission = permissionTypes[permission]
66
 
66
 
67
     if (!androidPermission) {
67
     if (!androidPermission) {
72
       )
72
       )
73
     }
73
     }
74
 
74
 
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
+        }
81
 
82
 
82
-      return setDidAskOnce(permission).then(() => RESULTS[result])
83
-    })
83
+        return setDidAskOnce(permission).then(() => RESULTS[result])
84
+      },
85
+    )
84
   }
86
   }
85
 
87
 
86
   checkMultiple = permissions =>
88
   checkMultiple = permissions =>