diff options
author | Ollie H <renahlee@outlook.com> | 2023-05-16 15:38:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-16 17:38:32 -0500 |
commit | 5f66adc9a656b79b76986395a73def9eed3d9776 (patch) | |
tree | 5c42de343a9cbe06bf382784f82c4e6930bbbe77 /src/view/com/util/UserAvatar.tsx | |
parent | d5bec4ff37fb3423b8f083dd9fe95c066b4cf90e (diff) | |
download | voidsky-5f66adc9a656b79b76986395a73def9eed3d9776.tar.zst |
Replace image picker with expo-image-picker (#649)
* Replace image picker with expo-image-picker * Fix cropper & picker on web --------- Co-authored-by: Paul Frazee <pfrazee@gmail.com>
Diffstat (limited to 'src/view/com/util/UserAvatar.tsx')
-rw-r--r-- | src/view/com/util/UserAvatar.tsx | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/view/com/util/UserAvatar.tsx b/src/view/com/util/UserAvatar.tsx index a2e607e47..f3679326f 100644 --- a/src/view/com/util/UserAvatar.tsx +++ b/src/view/com/util/UserAvatar.tsx @@ -66,6 +66,7 @@ export function UserAvatar({ if (!(await requestCameraAccessIfNeeded())) { return } + onSelectNewAvatar?.( await openCamera(store, { width: 1000, @@ -83,20 +84,21 @@ export function UserAvatar({ if (!(await requestPhotoAccessIfNeeded())) { return } + const items = await openPicker(store, { + aspect: [1, 1], + }) + const item = items[0] + + const croppedImage = await openCropper(store, { mediaType: 'photo', - multiple: false, + cropperCircleOverlay: true, + height: item.height, + width: item.width, + path: item.path, }) - onSelectNewAvatar?.( - await openCropper(store, { - mediaType: 'photo', - path: items[0].path, - width: 1000, - height: 1000, - cropperCircleOverlay: true, - }), - ) + onSelectNewAvatar?.(croppedImage) }, }, { |