-
Notifications
You must be signed in to change notification settings - Fork 360
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React Native implementation #54
Comments
I'm happy to help with this, I've been trying by using react-native-canvas but it is not performant at all... |
@espipj yes, I've thought about using the native APIs aswell by implementing this extra initializing method in the existing, already very fast, fast-image component library. I've also created an issue over there Unfortunately I don't have the time right now to create such a pull request, from what I understood though it doesn't seem that hard when I looked into the native code of fast-image. |
Hey @mrousavy I got something working on iOS using the swift implementation and linking it to React Native |
@mrousavy I implemented blurhash using OpenGL so that it can be used in React Native. |
@schiller-manuel that looks really interesting! your idea of using this would be to render this GL View as a placeholder until the image (which is a separate, invisible component) has been loaded, to then swap the GL View with the Image view, correct? |
yes, that's how I'd use it. In the linked example the |
@espipj @schiller-manuel I've just created a native UI module for this. See: https://github.com/mrousavy/react-native-blurhash. Currently, I've only implemented iOS, working on Android right now. It uses the default Image component, I still need to create extra properties like In short: It's a lightweight component that just renders the Blurhash Image in react native. No need for |
I did it. It's working on Android and iOS. Uses the lightweight native Image components, and no dependencies. I've also added an encoder so you can encode straight out of your react native app. For decoding, I also added an asynchronous decoder ( Here's the link: https://github.com/mrousavy/react-native-blurhash @woltapp do you want to mention this library in the README in case anyone else is searching for a React Native implementation? |
Is there a react-native library that doesn't require native linking? |
@siddhatiwari you can use gl-react-blurhash in Expo if this is what you want to do. |
@siddhatiwari while the expo library works, you should keep in mind that the performance is not as good as my native module, since it uses the JS thread for decoding, which is slower and blocks any other JS code execution. @schiller-manuel did an awesome job implementing this without native code, but it's just limited performance wise per design. Always choose the right tool for the job. |
@mrousavy @schiller-manuel Thanks for the quick response! Will check out gl-react-blurhash. |
@jerry-git sure, here you go: #176 |
Closing, as this is now third-party :) |
UPDATE: I've created a native UI module for iOS (Swift) and Android (Kotlin) myself, check it out here: mrousavy/react-native-blurhash
Hi! The library is really awesome, but I can't seem to find a way to use it in React Native (with the blurhash-typescript library).
The
decode(...)
function returns a raw pixel array (UInt8ClampedArray
), but the<Image>
component can't be initialized with a pixel array. (see: react-native Image.source)The text was updated successfully, but these errors were encountered: