Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: fix crash when taking camera picture

Ammar Ahmed68a6d6c31375
diff --git a/apps/mobile/app/components/dialogs/attach-image-dialog/index.tsx b/apps/mobile/app/components/dialogs/attach-image-dialog/index.tsx
index 1a881eade..58ee9c38c 100644
--- a/apps/mobile/app/components/dialogs/attach-image-dialog/index.tsx
+++ b/apps/mobile/app/components/dialogs/attach-image-dialog/index.tsx
@@ -61,7 +61,7 @@ export default function AttachImage({
Attaching {response?.length} image(s):
</Paragraph>
<ScrollView horizontal>
- {response?.map((item) => (
+ {response?.map?.((item) => (
<TouchableOpacity key={item.filename} activeOpacity={0.9}>
<Image
source={{
diff --git a/apps/mobile/app/screens/editor/tiptap/picker.ts b/apps/mobile/app/screens/editor/tiptap/picker.ts
index da26b23d9..d98feb890 100644
--- a/apps/mobile/app/screens/editor/tiptap/picker.ts
+++ b/apps/mobile/app/screens/editor/tiptap/picker.ts
@@ -186,7 +186,12 @@ const camera = async (options: PickerOptions) => {
maxFiles: 10,
writeTempFile: true
})
- .then((response) => handleImageResponse(response, options))
+ .then((response) => {
+ handleImageResponse(
+ Array.isArray(response) ? response : [response],
+ options
+ );
+ })
.catch((e) => {
console.log("camera error: ", e);
});
@@ -211,7 +216,12 @@ const gallery = async (options: PickerOptions) => {
cropping: false,
multiple: true
})
- .then((response) => handleImageResponse(response, options))
+ .then((response) =>
+ handleImageResponse(
+ Array.isArray(response) ? response : [response],
+ options
+ )
+ )
.catch((e) => {
console.log("gallery error: ", e);
});