From f057b71686b3efd4d1dc0f71fa0049666c313931 Mon Sep 17 00:00:00 2001 From: natjms Date: Thu, 1 Jul 2021 18:02:41 -0300 Subject: [PATCH] Fix issue with multipart data typing in Settings This probably doesn't totally fix the problems with uploading a new avatar becasue the interface hasn't been fully tested due to the problems outlined in #26, the documentation is kind of ambiguous on how the data is handled and I honestly don't know much about multipart form data, as I have recently discovered --- src/components/pages/profile/settings.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/pages/profile/settings.js b/src/components/pages/profile/settings.js index 5b53b07..dbf8d85 100644 --- a/src/components/pages/profile/settings.js +++ b/src/components/pages/profile/settings.js @@ -10,6 +10,7 @@ import { Dimensions, } from "react-native"; import { FontAwesome } from '@expo/vector-icons'; +import mime from "mime"; import AsyncStorage from "@react-native-async-storage/async-storage"; import * as requests from "src/requests"; @@ -90,7 +91,7 @@ const SettingsJsx = (props) => { const _handleChangeProfilePhoto = async () => { await ImagePicker.getCameraRollPermissionsAsync() - const { uri, type } = await ImagePicker.launchImageLibraryAsync({ + const { uri } = await ImagePicker.launchImageLibraryAsync({ allowsEditing: true, aspect: [1, 1], }); @@ -100,7 +101,7 @@ const SettingsJsx = (props) => { setState({...state, newAvatar: { uri, - type, + type: mime.getType(uri), name, }, });