Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
billnbell opened this issue Jan 21, 2023 · 6 comments
Open

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

billnbell opened this issue Jan 21, 2023 · 6 comments

Comments

@billnbell
Copy link

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
Copy link
Member

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

@vanGalilea
Copy link
Contributor

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

@vanGalilea vanGalilea added the v6 label Feb 21, 2023
@taschik
Copy link

taschik commented Sep 20, 2023

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

@tao-qian
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants