oblador / react-native-vector-icons

Customizable Icons for React Native with support for image source and full styling.
https://oblador.github.io/react-native-vector-icons/
MIT License
17.46k stars 2.13k forks source link

Issue in react-native-vector-icons, need to apply patch with 10.1.0 version #1632

Closed sjkushwaha21 closed 2 months ago

sjkushwaha21 commented 4 months ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-vector-icons@10.1.0 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-vector-icons/android/.project b/node_modules/react-native-vector-icons/android/.project
new file mode 100644
index 0000000..5b2e34b
--- /dev/null
+++ b/node_modules/react-native-vector-icons/android/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+   <name>react-native-vector-icons</name>
+   <comment>Project react-native-vector-icons created by Buildship.</comment>
+   <projects>
+   </projects>
+   <buildSpec>
+       <buildCommand>
+           <name>org.eclipse.jdt.core.javabuilder</name>
+           <arguments>
+           </arguments>
+       </buildCommand>
+       <buildCommand>
+           <name>org.eclipse.buildship.core.gradleprojectbuilder</name>
+           <arguments>
+           </arguments>
+       </buildCommand>
+   </buildSpec>
+   <natures>
+       <nature>org.eclipse.jdt.core.javanature</nature>
+       <nature>org.eclipse.buildship.core.gradleprojectnature</nature>
+   </natures>
+   <filteredResources>
+       <filter>
+           <id>1716794798985</id>
+           <name></name>
+           <type>30</type>
+           <matcher>
+               <id>org.eclipse.core.resources.regexFilterMatcher</id>
+               <arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
+           </matcher>
+       </filter>
+   </filteredResources>
+</projectDescription>
diff --git a/node_modules/react-native-vector-icons/android/bin/src/main/java/com/oblador/vectoricons/VectorIconsModuleImpl.class b/node_modules/react-native-vector-icons/android/bin/src/main/java/com/oblador/vectoricons/VectorIconsModuleImpl.class
new file mode 100644
index 0000000..2a5207e
Binary files /dev/null and b/node_modules/react-native-vector-icons/android/bin/src/main/java/com/oblador/vectoricons/VectorIconsModuleImpl.class differ
diff --git a/node_modules/react-native-vector-icons/android/bin/src/main/java/com/oblador/vectoricons/VectorIconsPackage.class b/node_modules/react-native-vector-icons/android/bin/src/main/java/com/oblador/vectoricons/VectorIconsPackage.class
new file mode 100644
index 0000000..79146ea
Binary files /dev/null and b/node_modules/react-native-vector-icons/android/bin/src/main/java/com/oblador/vectoricons/VectorIconsPackage.class differ
diff --git a/node_modules/react-native-vector-icons/android/bin/src/newarch/java/com/oblador/vectoricons/VectorIconsModule$Errors.class b/node_modules/react-native-vector-icons/android/bin/src/newarch/java/com/oblador/vectoricons/VectorIconsModule$Errors.class
new file mode 100644
index 0000000..212fbc1
Binary files /dev/null and b/node_modules/react-native-vector-icons/android/bin/src/newarch/java/com/oblador/vectoricons/VectorIconsModule$Errors.class differ
diff --git a/node_modules/react-native-vector-icons/android/bin/src/newarch/java/com/oblador/vectoricons/VectorIconsModule.class b/node_modules/react-native-vector-icons/android/bin/src/newarch/java/com/oblador/vectoricons/VectorIconsModule.class
new file mode 100644
index 0000000..0664dfb
Binary files /dev/null and b/node_modules/react-native-vector-icons/android/bin/src/newarch/java/com/oblador/vectoricons/VectorIconsModule.class differ
diff --git a/node_modules/react-native-vector-icons/android/bin/src/oldarch/java/com/oblador/vectoricons/VectorIconsModule$Errors.class b/node_modules/react-native-vector-icons/android/bin/src/oldarch/java/com/oblador/vectoricons/VectorIconsModule$Errors.class
new file mode 100644
index 0000000..0e47952
Binary files /dev/null and b/node_modules/react-native-vector-icons/android/bin/src/oldarch/java/com/oblador/vectoricons/VectorIconsModule$Errors.class differ
diff --git a/node_modules/react-native-vector-icons/android/bin/src/oldarch/java/com/oblador/vectoricons/VectorIconsModule.class b/node_modules/react-native-vector-icons/android/bin/src/oldarch/java/com/oblador/vectoricons/VectorIconsModule.class
new file mode 100644
index 0000000..77e02f1
Binary files /dev/null and b/node_modules/react-native-vector-icons/android/bin/src/oldarch/java/com/oblador/vectoricons/VectorIconsModule.class differ
diff --git a/node_modules/react-native-vector-icons/lib/object-utils.js b/node_modules/react-native-vector-icons/lib/object-utils.js
index d03b55b..712b89b 100644
--- a/node_modules/react-native-vector-icons/lib/object-utils.js
+++ b/node_modules/react-native-vector-icons/lib/object-utils.js
@@ -17,4 +17,4 @@ const omit = (obj, ...keysToOmit) => {
     }, {});
 };

-module.exports = { pick, omit };
+export { omit, pick };

This issue body was partially generated by patch-package.

johnf commented 4 months ago

@sjkushwaha21 What problem did this solve for you?

sjkushwaha21 commented 4 months ago

Hi @johnf,

Changing module.exports = { pick, omit }; To export { omit, pick };

Helped my issue.

david-gettins commented 4 months ago

Hi @johnf,

Changing module.exports = { pick, omit }; To export { omit, pick };

Helped my issue.

You could clean up your patch file by only including:

diff --git a/node_modules/react-native-vector-icons/lib/object-utils.js b/node_modules/react-native-vector-icons/lib/object-utils.js
index d03b55b..712b89b 100644
--- a/node_modules/react-native-vector-icons/lib/object-utils.js
+++ b/node_modules/react-native-vector-icons/lib/object-utils.js
@@ -17,4 +17,4 @@ const omit = (obj, ...keysToOmit) => {
     }, {});
 };

-module.exports = { pick, omit };
+export { omit, pick };

But, this looks more like a config issue you can solve here without having to patch, CJS/ESM thing. module.exports is for CJS modules which are pulled into other code via require. export is for ESM modules, which are pulled in via import.

It would be good to know what your issue was not just the fix.

sjkushwaha21 commented 4 months ago

Hi @johnf, @david-gettins

I am facing following issue. Please find the attachment as you requested.

Screenshot 2024-07-09 at 5 11 56 PM
johnf commented 3 months ago

@sjkushwaha21 Can you provide the code you are using? If you can provide an entire example repository that would be even better.

It looks like you are using RNVI via react-native-paper and I'm wondering if there is something strange about how it's being used there?

The error you are seeing is quite strage.

johnf commented 2 months ago

@sjkushwaha21 If this is still an issue let me know and I'll reopen