diff options
author | Ollie Hsieh <renahlee@outlook.com> | 2023-04-17 15:41:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-17 15:41:44 -0700 |
commit | 2509290fdd2b20c76c302d4962216f5d2d2b5a73 (patch) | |
tree | 455bdd7420556e80242ad245ba8d9907ec6c84ee /src/view/com/modals/EditProfile.tsx | |
parent | 91fadadb5848404bc47b69879bbc38a9011a0c62 (diff) | |
download | voidsky-2509290fdd2b20c76c302d4962216f5d2d2b5a73.tar.zst |
Split image cropping into secondary step (#473)
* Split image cropping into secondary step * Use ImageModel and GalleryModel * Add fix for pasting image URLs * Move models to state folder * Fix things that broke after rebase * Latest -- has image display bug * Remove contentFit * Fix iOS display in gallery * Tuneup the api signatures and implement compress/resize on web * Fix await * Lint fix and remove unused function * Fix android image pathing * Fix external embed x button on android * Remove min-height from composer (no longer useful and was mispositioning the composer on android) * Fix e2e picker --------- Co-authored-by: Paul Frazee <pfrazee@gmail.com>
Diffstat (limited to 'src/view/com/modals/EditProfile.tsx')
-rw-r--r-- | src/view/com/modals/EditProfile.tsx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/view/com/modals/EditProfile.tsx b/src/view/com/modals/EditProfile.tsx index e6ef765af..0feae3a80 100644 --- a/src/view/com/modals/EditProfile.tsx +++ b/src/view/com/modals/EditProfile.tsx @@ -8,7 +8,7 @@ import { } from 'react-native' import LinearGradient from 'react-native-linear-gradient' import {ScrollView, TextInput} from './util' -import {PickedMedia} from '../../../lib/media/picker' +import {Image as RNImage} from 'react-native-image-crop-picker' import {Text} from '../util/text/Text' import {ErrorMessage} from '../util/error/ErrorMessage' import {useStores} from 'state/index' @@ -53,15 +53,15 @@ export function Component({ profileView.avatar, ) const [newUserBanner, setNewUserBanner] = useState< - PickedMedia | undefined | null + RNImage | undefined | null >() const [newUserAvatar, setNewUserAvatar] = useState< - PickedMedia | undefined | null + RNImage | undefined | null >() const onPressCancel = () => { store.shell.closeModal() } - const onSelectNewAvatar = async (img: PickedMedia | null) => { + const onSelectNewAvatar = async (img: RNImage | null) => { track('EditProfile:AvatarSelected') try { // if img is null, user selected "remove avatar" @@ -71,13 +71,13 @@ export function Component({ return } const finalImg = await compressIfNeeded(img, 1000000) - setNewUserAvatar({mediaType: 'photo', ...finalImg}) + setNewUserAvatar(finalImg) setUserAvatar(finalImg.path) } catch (e: any) { setError(cleanError(e)) } } - const onSelectNewBanner = async (img: PickedMedia | null) => { + const onSelectNewBanner = async (img: RNImage | null) => { if (!img) { setNewUserBanner(null) setUserBanner(null) @@ -86,7 +86,7 @@ export function Component({ track('EditProfile:BannerSelected') try { const finalImg = await compressIfNeeded(img, 1000000) - setNewUserBanner({mediaType: 'photo', ...finalImg}) + setNewUserBanner(finalImg) setUserBanner(finalImg.path) } catch (e: any) { setError(cleanError(e)) |