-
Notifications
You must be signed in to change notification settings - Fork 71
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 Example #29
Comments
I'm looking for the same. I'm uploading images from a react-native mobile app and it would be great to generate a hash to go along with the upload. It seems like we need to do the following steps:
I'm looking to use the hash with expo-image I might also be unblocked if there was a |
Sorry, I don't know anything about React Native.
It's a buffer of bytes (specifically a const binaryThumbHash = ThumbHash.rgbaToThumbHash(pixels.width, pixels.height, pixels.data)
// ThumbHash to data URL
const placeholderURL = ThumbHash.thumbHashToDataURL(binaryThumbHash)
// If you want to use base64 instead of binary...
const binaryToBase64 = binary => btoa(String.fromCharCode(...binary))
const base64ToBinary = base64 => new Uint8Array(atob(base64).split('').map(x => x.charCodeAt(0)))
const thumbHashToBase64 = binaryToBase64(binaryThumbHash)
const thumbHashFromBase64 = base64ToBinary(thumbHashToBase64) |
@evanw Edit: Updating to add that I commented on an expo dev's release post for support for this library with |
@Joshandrews43 can you share a link to that post? |
Hi! |
Hi,
Library looks super cool, I am just pretty bad with photo handling and was hoping someone could provide a react native example with minimal dependencies
Thanks!
The text was updated successfully, but these errors were encountered: