edeckers / react-native-blob-courier

Use this library to efficiently download and upload blobs in React Native.
Mozilla Public License 2.0
135 stars 10 forks source link

Module '"react-native"' has no exported member 'NativeEventEmitter'.ts(2305) #216

Closed moonofmars closed 2 years ago

moonofmars commented 2 years ago

Describe the bug RN version is 0.67.4. This version is not supported?

Screenshots image

image

edeckers commented 2 years ago

Hi @zhuernm , thank you for posting this issue! The library is supposed to support all React Native >= 0.63.x versions, so I looked into this problem by trying to reproduce it in a fresh app and I managed to use react-native-blob-courier@3.0.9 on React Native 0.67.4 just fine. What version of react-native-blob-courier are you using?

These are my reproduction steps:

  1. Run npx react-native init RnTest0674 --template react-native-template-typescript@6.9.6
  2. Apply the patch below by saving it as test.patch somewhere on your development machine and running patch -p0 < /path/to/test.patch from the RnTest0674 directory
--- package.json    2022-05-12 09:55:35.624635026 +0200
+++ package.json    2022-05-12 09:57:26.629894991 +0200
@@ -14 +14,2 @@
-    "react-native": "0.67.4"
+    "react-native": "0.67.4",
+    "react-native-blob-courier": "^3.0.9"
--- App.tsx 2022-05-12 09:55:35.624635026 +0200
+++ App.tsx 2022-05-12 10:00:19.755356070 +0200
@@ -11 +11,2 @@
-import React from 'react';
+import React, {useEffect} from 'react';
+import BlobCourier from 'react-native-blob-courier';
@@ -63,0 +65,17 @@
+
+  useEffect(() => {
+    const fetchFile = async () => {
+      // Download a file
+      const request0 = {
+        filename: '5MB.zip',
+        method: 'GET',
+        mimeType: 'application/zip',
+        url: 'http://ipv4.download.thinkbroadband.com/5MB.zip',
+      };
+
+      const fetchedResult = await BlobCourier.fetchBlob(request0);
+      console.log(fetchedResult);
+    };
+
+    fetchFile();
+  }, []);

Output:

LOG  {"data": {"absoluteFilePath": "file:///data/user/0/com.rntest0674/cache/5MB.zip", "response": {"code": 200, "headers": [Object]}}, "type": "Unmanaged"}