stream-chat-react-native icon indicating copy to clipboard operation
stream-chat-react-native copied to clipboard

Upgrade to @bam.tech/react-native-image-resizer

Open billnbell opened this issue 2 years ago • 8 comments

Please upgrade to warning [email protected]: 🚨 react-native-image-resizer has moved to @bam.tech/react-native-image-resizer

billnbell avatar Jan 21 '23 22:01 billnbell

Hey @billnbell, thanks for bringing this up. We will have a look at this soon.

khushal87 avatar Jan 23 '23 06:01 khushal87

This is a breaking change. We're going to include this as part of our v6 release.

vanGalilea avatar Jan 24 '23 11:01 vanGalilea

@vanGalilea do you already have a timeline on the v6 release?

taschik avatar Sep 20 '23 17:09 taschik

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.

tao-qian avatar Dec 11 '23 23:12 tao-qian

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;
    }
  },
});

tao-qian avatar Dec 12 '23 01:12 tao-qian

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.

khushal87 avatar Dec 12 '23 05:12 khushal87

What is the timeline for v6?

brianjd avatar Jun 17 '24 19:06 brianjd