GithubHelp home page GithubHelp logo

huangzuizui / react-native-file-opener Goto Github PK

View Code? Open in Web Editor NEW
145.0 145.0 86.0 5.01 MB

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

Java 61.67% Objective-C 38.33%

react-native-file-opener's People

Contributors

dabit1 avatar huangzuizui avatar kristikristo avatar pedramsaleh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

react-native-file-opener's Issues

Failed using your library

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

'%cUnhandled rejection convertError@http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:69920:20\ntryCatcher@http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:74737:20\n_settlePromiseFromHandler@http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:72841:25\n_settlePromiseAt@http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:72915:31\n_settlePromises@http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:73031:22\n_drainQueue@http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:70318:19\n_drainQueues@http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:70328:17\ndrainQueues@http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:70210:18\nhttp://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:4476:18\ncallTimer@http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:4022:9\ncallImmediatesPass@http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:4080:28\ncallImmediates@http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:4095:43\nhttp://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:3354:57\nguard@http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:3268:3\n__callImmediates@http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:3354:6\nhttp://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:3324:24\nguard@http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:3268:3\ninvokeCallbackAndReturnFlushedQueue@http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:3322:6\ninvokeCallbackAndReturnFlushedQueue@[native code]\nglobal code', 'color: red'

Android打开文件报exposed beyond app through Intent.getData()错误

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

Can't open file

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

没有办法打开在ios 模拟器上

undefined is not an object (evaluating 'FileOpener.open')

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?

ambiguous instructions for react-native 0.29.0 and higher

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?

LICENSE Information missing for this package

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.

can not open file on ios

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(…)
})

Open, not copy file

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!

Outdated Lib Calls

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?

There is always error showing up

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"

PDF is not opening in ios

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.

ios Build fail with react-native .48.3

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;

Opening files in iPad is not working.

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];)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.