Open billnbell opened 1 year ago
Hey @billnbell, thanks for bringing this up. We will have a look at this soon.
This is a breaking change. We're going to include this as part of our v6 release.
@vanGalilea do you already have a timeline on the v6 release?
Also waiting for this update. The version that's being used is two years old and doesn't have fixes for recent bugs and we have run into one of these recently.
We deiced to replace the old library with the new one in package.json, then add an overrride for the compressImage method following: https://getstream.io/chat/docs/sdk/reactnative/customization/native_handlers/. So far this seems to be working as a temporary solution.
import ImageResizer from '@bam.tech/react-native-image-resizer'
registerNativeHandlers({
// copied from https://github.com/GetStream/stream-chat-react-native/blob/11e8b013f9b044444ba16f7f2ce2134dd0810118/package/native-package/src/handlers/compressImage.ts#L4
compressImage: async ({
compressImageQuality = 1,
height,
uri,
width,
}) => {
try {
const { uri: compressedUri } = await ImageResizer.createResizedImage(
uri,
height,
width,
'JPEG',
Math.min(Math.max(0, compressImageQuality), 1) * 100,
0,
undefined,
false,
{ mode: 'cover' },
);
return compressedUri;
} catch (error) {
Sentry.captureException(error);
return uri;
}
},
});
Hey @tao-qian, you have done it correctly and this is the only solution we would suggest to solve the problem for now. Upgrading to @bam.tech/react-native-image-resizer
involves namespace change for the package which will be a breaking change for most of our SDK users so we can plan it once we move towards v6. Until then, the solution you have used above should be fine.
What is the timeline for v6?
We are planning an rc release in the upcoming weeks, so very soon. Thanks 😄
Please upgrade to warning react-native-image-resizer@1.4.5: 🚨 react-native-image-resizer has moved to @bam.tech/react-native-image-resizer