react-native-blurhash icon indicating copy to clipboard operation
react-native-blurhash copied to clipboard

Typescript Declarations Not Being Published?

Open Wahsner opened this issue 4 months ago • 6 comments

Hi,

Upgrading from 2.0.3 to the latest 2.1.2 and now encounter TS2307: Cannot find module react-native-blurhash or its corresponding type declarations.

import { Blurhash } from 'react-native-blurhash';

"react": "19.1.0", "react-native": "0.81.0", "react-native-blurhash": "^2.1.2",

Wahsner avatar Aug 28 '25 16:08 Wahsner

same here

pierrebiver avatar Aug 30 '25 11:08 pierrebiver

Still getting the error is it not fixed yet ?

omkarKiranaClub avatar Sep 03 '25 10:09 omkarKiranaClub

Anyone know if this is actively being looked at?

sjransom avatar Sep 18 '25 13:09 sjransom

they aren't.

They were published in 2.1.1 (proof: https://www.npmjs.com/package/react-native-blurhash/v/2.1.1?activeTab=code). They are not published in 2.1.2 (proof: https://www.npmjs.com/package/react-native-blurhash/v/2.1.2?activeTab=code).

@mrousavy

pleerock avatar Sep 19 '25 12:09 pleerock

As a temporary workaround, I downgraded to 2.1.1 and patched with patch-package. Here are the changes I applied:

diff --git a/node_modules/react-native-blurhash/android/src/main/java/com/mrousavy/blurhash/BlurhashViewManager.kt b/node_modules/react-native-blurhash/android/src/main/java/com/mrousavy/blurhash/BlurhashViewManager.kt
index 9224e9a..193540b 100644
--- a/node_modules/react-native-blurhash/android/src/main/java/com/mrousavy/blurhash/BlurhashViewManager.kt
+++ b/node_modules/react-native-blurhash/android/src/main/java/com/mrousavy/blurhash/BlurhashViewManager.kt
@@ -108,7 +108,7 @@ class BlurhashViewManager :
     return image
   }
 
-  override fun getExportedCustomDirectEventTypeConstants(): MutableMap<String, Any>? {
+  override fun getExportedCustomDirectEventTypeConstants(): Map<String, Any>? {
     return MapBuilder.builder<String, Any>()
         .put(LoadErrorEvent.EVENT_NAME, MapBuilder.of("registrationName", "onLoadError"))
         .put(LoadStartEvent.EVENT_NAME, MapBuilder.of("registrationName", "onLoadStart"))
diff --git a/node_modules/react-native-blurhash/ios/BlurhashViewManager.swift b/node_modules/react-native-blurhash/ios/BlurhashViewManager.swift
index a22972f..3d38d6b 100644
--- a/node_modules/react-native-blurhash/ios/BlurhashViewManager.swift
+++ b/node_modules/react-native-blurhash/ios/BlurhashViewManager.swift
@@ -88,6 +88,11 @@ final class BlurhashViewWrapper: UIView, BlurhashViewDelegate {
         blurhashView.frame = frame
     }
 
+    override func layoutSubviews() {
+      super.layoutSubviews();
+      blurhashView.frame = self.bounds;
+    }
+
     override func didSetProps(_: [String]!) {
         blurhashView.finalizeUpdates()
     }

This got things working for me until a fix is released

lucasroca avatar Sep 22 '25 14:09 lucasroca

FYI I just patched 2.1.2 the lib/typescript folder from 2.1.1 in the meantime (types did not change)

ogtfaber avatar Nov 27 '25 09:11 ogtfaber