From f1e7e05a1d298fd2c6dcbd6a1142c1841a022cad Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Sun, 6 Feb 2022 22:53:00 +0100 Subject: [PATCH] Squashed commit of the following: commit af3560afebf5f4482e037c1f7c46ca16bd1975a2 Author: Zhiyuan Zheng Date: Sun Feb 6 22:52:43 2022 +0100 Hotfix v3.1.2 commit c8a16c9aa61de80b5e485cf09f5f539ab15b4449 Author: Zhiyuan Zheng Date: Sun Feb 6 18:09:11 2022 +0100 Try to fix weird crash commit c9f7cb664c8ba34acd1700e8443bddb2bb039fcd Author: Zhiyuan Zheng Date: Sun Feb 6 22:47:30 2022 +0100 Fix iOS 12 crashes on media selection https://github.com/expo/expo/issues/14903#issuecomment-966161497 --- package.json | 4 ++-- src/components/mediaSelector.ts | 8 ++++++-- src/utils/slices/instancesSlice.ts | 9 +++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index b964dcac..6a55e56f 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "versions": { "native": "220204", "major": 3, - "minor": 3, - "patch": 1, + "minor": 1, + "patch": 2, "expo": "44.0.0" }, "description": "tooot app for Mastodon", diff --git a/src/components/mediaSelector.ts b/src/components/mediaSelector.ts index 478bf3ec..4a5af36b 100644 --- a/src/components/mediaSelector.ts +++ b/src/components/mediaSelector.ts @@ -4,7 +4,7 @@ import * as ImageManipulator from 'expo-image-manipulator' import * as ImagePicker from 'expo-image-picker' import { ImageInfo } from 'expo-image-picker/build/ImagePicker.types' import i18next from 'i18next' -import { Alert, Linking } from 'react-native' +import { Alert, Linking, Platform } from 'react-native' export interface Props { mediaTypes?: ImagePicker.MediaTypeOptions @@ -91,7 +91,11 @@ const mediaSelector = async ({ } else { const result = await ImagePicker.launchImageLibraryAsync({ mediaTypes, - exif: false + exif: false, + presentationStyle: + Platform.OS === 'ios' && parseInt(Platform.Version) < 13 + ? 0 + : -2 }) if (!result.cancelled) { diff --git a/src/utils/slices/instancesSlice.ts b/src/utils/slices/instancesSlice.ts index 80d825aa..3bc3b4d9 100644 --- a/src/utils/slices/instancesSlice.ts +++ b/src/utils/slices/instancesSlice.ts @@ -169,10 +169,11 @@ const instancesSlice = createSlice({ action: PayloadAction ) => { const activeIndex = findInstanceActive(instances) - instances[activeIndex].timelinesLookback = { - ...instances[activeIndex].timelinesLookback, - ...action.payload - } + instances[activeIndex] && + (instances[activeIndex].timelinesLookback = { + ...instances[activeIndex].timelinesLookback, + ...action.payload + }) }, updateInstanceMePage: ( { instances },