useEditChannelImage
A hook that exposes the two image-acquisition flows used by the channel edit screen — camera capture and native gallery pick — using the same control flow and compression behavior as the message composer. It reads compressImageQuality from the ChannelEditDetailsContext and is used by the ChannelEditDetailsForm. The hook intentionally does not upload the picked file; it returns a File and lets the consumer decide what to do with it.
Best Practices
- Use it within a
ChannelEditDetailsContext(e.g. inside the channel edit form) socompressImageQualityresolves correctly. - Always handle the
undefinedresult — the user may cancel or deny camera/gallery access. - Configure compression once via
compressImageQualityonChannelEditDetailsForm(orChannelEditDetailsProvider) rather than re-compressing the returned file. - Upload the returned
Fileyourself (or via yourdoFileUploadRequest) — the hook does not upload. - Don't add an extra compression pass for camera files; the native camera handler already honors
compressImageQuality.
Return type
Returns a UseEditChannelImageResult object.
pickImageFromNativePicker
Opens the device's native image picker and returns a single picked image with the configured compression already applied to its uri. Resolves to undefined if the user cancels or denies access.
| Type |
|---|
() => Promise<File | undefined> |
takePhoto
Launches the device's camera and returns the captured image. Resolves to undefined if the user cancels or denies access.
| Type |
|---|
() => Promise<File | undefined> |