GetStream / stream-chat-react-native

💬 React-Native Chat SDK ➜ Stream Chat. Includes a tutorial on building your own chat app experience using React-Native, React-Navigation and Stream
https://getstream.io/chat/sdk/react-native/
Other
979 stars 325 forks source link

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

Open billnbell opened 1 year ago

billnbell commented 1 year ago

Please upgrade to warning react-native-image-resizer@1.4.5: 🚨 react-native-image-resizer has moved to @bam.tech/react-native-image-resizer

khushal87 commented 1 year ago

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

vanGalilea commented 1 year ago

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

taschik commented 1 year ago

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

tao-qian commented 11 months ago

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 commented 11 months ago

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;
    }
  },
});
khushal87 commented 11 months ago

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.

brianjd commented 5 months ago

What is the timeline for v6?

khushal87 commented 1 month ago

We are planning an rc release in the upcoming weeks, so very soon. Thanks 😄