Typescript Declarations Not Being Published?
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",
same here
Still getting the error is it not fixed yet ?
Anyone know if this is actively being looked at?
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
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
FYI I just patched 2.1.2 the lib/typescript folder from 2.1.1 in the meantime (types did not change)