Skip to content

Commit d830567

Browse files
fix: bug fix for a couple customer issues (#59)
* fix: prevent library from crashing when styling options aren't specifed * fix: allow sample app to request media permissions to be used as markers
1 parent 349ed54 commit d830567

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

SampleApp/src/app.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
*/
1616

1717
import React, {ReactElement, useEffect, useState} from 'react';
18-
import {Button, Dimensions, Platform, View} from 'react-native';
18+
import {Button, Dimensions, Platform, View} from "react-native";
1919

20-
import {PERMISSIONS, RESULTS, request} from 'react-native-permissions';
20+
import {PERMISSIONS, RESULTS, requestMultiple} from "react-native-permissions";
2121

2222
import AsyncStorage from '@react-native-async-storage/async-storage';
2323
import {
@@ -81,17 +81,22 @@ const App: React.FC = (): ReactElement => {
8181
}, []);
8282

8383
const checkPermissions = async () => {
84-
const result = await request(
85-
Platform.OS == 'android'
86-
? PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION
87-
: PERMISSIONS.IOS.LOCATION_ALWAYS,
88-
);
84+
const toRequestPermissions = Platform.OS == 'android' ?[
85+
PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION,
86+
PERMISSIONS.ANDROID.READ_MEDIA_IMAGES,
87+
] : [
88+
PERMISSIONS.IOS.LOCATION_ALWAYS,
89+
PERMISSIONS.IOS.PHOTO_LIBRARY
90+
];
91+
92+
const permissionStatuses = await requestMultiple(toRequestPermissions);
93+
const result = permissionStatuses[toRequestPermissions[0]];
8994

9095
if (result == RESULTS.GRANTED) {
9196
setArePermissionsApproved(true);
9297
} else {
9398
Snackbar.show({
94-
text: 'Permissions are needed to proceed with the app. Please re-open and accept.',
99+
text: 'Location permissions are needed to proceed with the app. Please re-open and accept.',
95100
duration: Snackbar.LENGTH_SHORT,
96101
});
97102
}

components/navigation/navigationView/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,14 +376,14 @@ export default class NavigationView extends React.Component<NavigationViewProps>
376376
? [
377377
PixelRatio.getPixelSizeForLayoutSize(this.props.height),
378378
PixelRatio.getPixelSizeForLayoutSize(this.props.width),
379-
this.props.androidStylingOptions,
380-
this.props.termsAndConditionsDialogOptions,
379+
this.props.androidStylingOptions || {},
380+
this.props.termsAndConditionsDialogOptions || {},
381381
]
382382
: [
383383
this.props.height,
384384
this.props.width,
385-
this.props.iOSStylingOptions,
386-
this.props.termsAndConditionsDialogOptions,
385+
this.props.iOSStylingOptions || {},
386+
this.props.termsAndConditionsDialogOptions || {},
387387
];
388388

389389
setTimeout(() => {

0 commit comments

Comments
 (0)