huangzuizui / react-native-file-opener Goto Github PK
View Code? Open in Web Editor NEWA React Native module that allows you to open a file (mp3, mp4, pdf, word, excel, dwg etc.) on your device with its default application
A React Native module that allows you to open a file (mp3, mp4, pdf, word, excel, dwg etc.) on your device with its default application
I've tried to use your sample app and open an issue there at huangzuizui/react-native-file-opener-demo#2
The FileOpener.open
call is not returning even not an exception (??)
I see in the logcat the following
Android打开文件报exposed beyond app through Intent.getData()错误,
由于项目中还使用了rn-fetch-blob和其他的组件,和reawct-native-file-opener中的AndroidMenifest配置provider有点冲突,合并后现在是:
AndroidMenifest.xml:
provider_paths.xml:
真机:306手机vizza, Android版本:7.1.1
项目环境:
OS: Windows 7
Node: 10.8.0
Yarn: 1.9.4
npm: 6.2.0
Watchman: Not Found
Xcode: N/A
Android Studio: Not Found
Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: ^0.55.4 => 0.55.4
Hi!
I have an issue with your amazing tool. I'm using Android and react-native-fetch-blob to get DocumentDir path. When I save the files its destination path is the App document dir (/data/user/0/my.package/files) but tell me if I'm right, if I try to open files in this directory I'll not be able because only the app of my.package can do it. Then, how can I open my files in another app with your tool?
Many thanks and good job
Error: Open error
at createErrorFromErrorData (http://localhost:8081/index.ios.bundle?platform=ios&dev=true:7005:11)
at http://localhost:8081/index.ios.bundle?platform=ios&dev=true:6960:11
at MessageQueue.__invokeCallback (http://localhost:8081/index.ios.bundle?platform=ios&dev=true:6837:10)
at http://localhost:8081/index.ios.bundle?platform=ios&dev=true:6720:8
at guard (http://localhost:8081/index.ios.bundle?platform=ios&dev=true:6665:1)
at MessageQueue.invokeCallbackAndReturnFlushedQueue (http://localhost:8081/index.ios.bundle?platform=ios&dev=true:6719:1)
at DedicatedWorkerGlobalScope.onmessage (http://localhost:8081/debuggerWorker.js:39:56)
类似于你的图片上展示的效果,不过是想用 wps 或者微软的应用在 iOS 上打开 远程的文件。
Hello, is this module still working? I'm having trouble to use it.
I followed the usage on readme like this:
var FileOpener = require('react-native-file-opener')
FileOpener
.open( 'someUrl', 'someMime',)
.then(
() => { console.info('success!!'); },
() => { console.info('error!!');
});
and I ended up with this error, as if there's nothing exported from the package:
Any idea?
Could you please elaborate on your explanation
<paths xmlns:android="http://schemas.android.com/apk/res/android">
...
<files-path name="img" path="images/"/>
...
</paths>
For react-native 0.29.0 and higher, do the above in MainApplication.java
Does this mean that android/app/src/main/res/xml/file_paths.xml (should be deleted)?
Where and what should I be putting in MainApplication.java?
Hi,
Can you please add the license information for the package, in my company quality team not allowing to use this package with out the license information.
Best Regards
Narayana.
Hi
I can't open downloaded file on iOS, but on Android is okay
device: iPhone 5 & 6 ( simulator )
iOS version: 10.0
react: 15.3.2
react-native: 0.34.1
code:
const path = '/Users/ramin/Library/Developer/CoreSimulator/Devices/26051E4B-3C32-49A0-8FC9-EBCFA1C73157/data/Containers/Data/Application/F4CC8448-4115-495C-825A-00D912664820/Library/Caches/video.mp4'
// file is downloaded by react-native-fetch-blob
FileOpener.open(path, 'video/mp4')
.then((msg) => {
console.log('success!!')
}, e => {
console.log('error!!', e) //error!! Error: Open error(…)
})
0.2.0 is 11 months old as of this writing...
Hi!
I'm trying to open a pdf file but can you help me to make it open the file instead of copying it?
Thank you!
I noticed the following when compiling
Note: C:\devl\ehb-mobile\node_modules\react-native-file-opener\android\src\main\java\com\fileopener\FileOpener.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.
Perhaps an update is in order?
React native version 0.49.1
TargetSdk version 28
the component doesn't support higher level target in android
console.log message :
index.ios.bundle:1287 its exists true file:///Users/kabir/Library/Developer/CoreSimulator/Devices/42EBB3A3-21A7-4…Data/Application/FA09E9A6-7886-4BC3-B744-E25FFDD84B97/Documents/sample.doc
error!!
RNFS.exists(the_path)
.then((result) => {
// ALWAYS FALSE
console.log('its exists',result,the_path);
FileOpener.open(
the_path,
'application/msword'
).then(() => {
console.log('success!!');
}).catch((e) => {
console.log('error!!');
});
})
.catch((err) => {
console.log(err)
})
There are files exists at location, even RNFS returns true, but I always get error .
I tried prefix file:// , did not work either.
"react": "16.0.0-alpha.6",
"react-native": "0.44.0",
"react-native-file-opener": "^0.2.0",
"react-native-fs": "^2.3.2"
如果targetSdkVersion >= 24, 在Android N设备上使用file://打开文件会崩溃. 应使用content://替代.
In ios pdf is not opening(Not opening option for opening pdf), it is showing opening error, In android it is working fine and giving opening pdf option with compatible apps.
Here is code that i use to open pdf
FileOpener.open(
rowPath,
'application/pdf'
).then(() => {
console.log('success!!');
},(e) => {
console.log('error!!',e);
});
here rowPath:
In android = RNFS.ExternalDirectoryPath/filename.pdf,
in ios = RNFS.DocumentDirectoryPath/filename.pdf
In android it is working fine. but in ios it is not working.
This kind of issue I also got earlier with react-native-image-crop-picker recently after .48.0 , they updated library and issue is solved now, similar issue I get with react-native-file-opener too.
In file included from /Applications/myproject/node_modules/react-native-file-opener/ios/RNFileOpener/RNFileOpener.m:1:
In file included from /Applications/myproject/node_modules/react-native-file-opener/ios/RNFileOpener/RNFileOpener.h:2:
In file included from ../../react-native/React/Base/RCTBridge.h:13:
/Applications/myproject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridgeModule.h:54:16: error: redefinition of 'RCTMethodInfo'
typedef struct RCTMethodInfo {
^
In file included from /Applications/myproject/node_modules/react-native-file-opener/ios/RNFileOpener/RNFileOpener.m:1:
In file included from /Applications/myproject/node_modules/react-native-file-opener/ios/RNFileOpener/RNFileOpener.h:1:
../../react-native/React/Base/RCTBridgeModule.h:54:16: note: previous definition is here
typedef struct RCTMethodInfo {
^
In file included from /Applications/myproject/node_modules/react-native-file-opener/ios/RNFileOpener/RNFileOpener.m:1:
In file included from /Applications/myproject/node_modules/react-native-file-opener/ios/RNFileOpener/RNFileOpener.h:2:
In file included from ../../react-native/React/Base/RCTBridge.h:13:
/Applications/myproject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridgeModule.h:58:3: error: typedef redefinition with different types ('struct (anonymous struct at /Applications/myproject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridgeModule.h:54:16)' vs 'struct RCTMethodInfo')
} RCTMethodInfo;
^
In file included from /Applications/myproject/node_modules/react-native-file-opener/ios/RNFileOpener/RNFileOpener.m:1:
In file included from /Applications/myproject/node_modules/react-native-file-opener/ios/RNFileOpener/RNFileOpener.h:1:
../../react-native/React/Base/RCTBridgeModule.h:58:3: note: previous definition is here
} RCTMethodInfo;
^
In file included from /Applications/myproject/node_modules/react-native-file-opener/ios/RNFileOpener/RNFileOpener.m:1:
In file included from /Applications/myproject/node_modules/react-native-file-opener/ios/RNFileOpener/RNFileOpener.h:2:
In file included from ../../react-native/React/Base/RCTBridge.h:13:
/Applications/myproject/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridgeModule.h:65:11: warning: duplicate protocol definition of 'RCTBridgeModule' is ignored
@protocol RCTBridgeModule
^
In file included from /Applications/myproject/node_modules/react-native-file-opener/ios/RNFileOpener/RNFileOpener.m:1:
In file included from /Applications/myproject/node_modules/react-native-file-opener/ios/RNFileOpener/RNFileOpener.h:1:
../../react-native/React/Base/RCTBridgeModule.h:65:11: note: previous definition is here
@protocol RCTBridgeModule
^
/Applications/myproject/node_modules/react-native-file-opener/ios/RNFileOpener/RNFileOpener.m:29:30: warning: assigning to 'id _Nullable' from incompatible type 'FileOpener *const __strong'
self.FileOpener.delegate = self;
The app is showing no dialog boxes for opening files on iPad. But i'm getting success response in the react-native side.
The code in ios/RNFileOpener/RNFileOpener.m
as per the commit kristikristo@89ba83e by @kristikristo throws the following errors in xcode
Expected a type (in line 14
fromRect:(CGRectMake)rect
)
Sending '_strong id' to parameter of incompatible type 'CGRect' (aka 'struct CGRect') (in line 37
wasOpened = [self.FileOpener presentOptionsMenuFromRect:rect inView:ctrl.view animated:YES];
)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.