We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch [email protected] for the project I'm working on.
[email protected]
It came to my attention the following comment in the Android official guide:
https://developer.android.com/reference/androidx/core/content/FileProvider
It is possible to use FileProvider directly instead of extending it. However, this is not reliable and will causes crashes on some devices.
So for better compatibility, I suggest the modifications below:
diff --git a/node_modules/react-native-file-provider/android/src/main/java/com/artirigo/fileprovider/MyFileProvider.java b/node_modules/react-native-file-provider/android/src/main/java/com/artirigo/fileprovider/MyFileProvider.java new file mode 100644 index 0000000..23c735c --- /dev/null +++ b/node_modules/react-native-file-provider/android/src/main/java/com/artirigo/fileprovider/MyFileProvider.java @@ -0,0 +1,5 @@ +package com.artirigo.fileprovider; + +import androidx.core.content.FileProvider; + +public class MyFileProvider extends FileProvider { } diff --git a/node_modules/react-native-file-provider/android/src/main/java/com/artirigo/fileprovider/RNFileProviderModule.java b/node_modules/react-native-file-provider/android/src/main/java/com/artirigo/fileprovider/RNFileProviderModule.java index a9bc7d9..8141365 100644 --- a/node_modules/react-native-file-provider/android/src/main/java/com/artirigo/fileprovider/RNFileProviderModule.java +++ b/node_modules/react-native-file-provider/android/src/main/java/com/artirigo/fileprovider/RNFileProviderModule.java @@ -34,7 +34,7 @@ public class RNFileProviderModule extends ReactContextBaseJavaModule { // File file = new File(filepath); if (!file.exists()) throw new Exception("File does not exist"); - Uri contentUri = FileProvider.getUriForFile(this.getReactApplicationContext(), authority, file); + Uri contentUri = MyFileProvider.getUriForFile(this.getReactApplicationContext(), authority, file); promise.resolve(contentUri.toString()); } catch (Exception ex) { ex.printStackTrace();
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
[email protected]
for the project I'm working on.It came to my attention the following comment in the Android official guide:
https://developer.android.com/reference/androidx/core/content/FileProvider
So for better compatibility, I suggest the modifications below:
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered: