diff --git a/native/utils/thumbhash-module.js b/native/utils/thumbhash-module.js --- a/native/utils/thumbhash-module.js +++ b/native/utils/thumbhash-module.js @@ -7,12 +7,18 @@ +generateThumbHash: (photoURI: string) => Promise, } = requireNativeModule('Thumbhash'); +const newLineRegex = /\n/g; async function generateThumbHash(photoURI: string): Promise { invariant( platformUtilsModule.generateThumbHash, 'generateThumbHash() unavailable. Check if Thumbhash expo-module is autolinked', ); - return await platformUtilsModule.generateThumbHash(photoURI); + + const rawThumbHash = await platformUtilsModule.generateThumbHash(photoURI); + + // Sometimes native base64 modules encode the string with newlines, + // which breaks the thumbhash format + return rawThumbHash.replace(newLineRegex, ''); } export { generateThumbHash };