Skip to content
New issue

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

Fileview.close() #133

Open
my-name-is-nheo opened this issue Apr 21, 2022 · 3 comments
Open

Fileview.close() #133

my-name-is-nheo opened this issue Apr 21, 2022 · 3 comments

Comments

@my-name-is-nheo
Copy link

Is there a way we can trigger the close button on iOS when doing a swipe? Seems like android is behaving as expected, but not so on IOS

@jliuhtonen
Copy link

It would be nice to have an option to programmatically dismiss the Quicklook overlay. If the API needs to be backwards compatible, then one way to do it would be to enable using AbortController API and to provide a signal option to the .open() function in a similar fashion that Fetch API works in JS.

@Muzamil544
Copy link

Hello every one i have done this functionality on iOS, you can close the fileViewer any time you want by using following steps.

  1. Add this method in file node_modules->react-native-file-viewer->ios->RNFileViewerManager.m
    RCT_EXPORT_METHOD(close) { dispatch_async(dispatch_get_main_queue(), ^{ [[RNFileViewer topViewController] dismissViewControllerAnimated:true completion:nil]; }); }

  2. now add this method in node_modules->react-native-file-viewer->index.js
    function close() { if (Platform.OS == "ios") { return RNFileViewer.close(); } }

  3. after adding method now navigate to the bottom of index.js, change the export lines from
    export default { open }; export { open };
    to->
    this export default { open, close }; export { open, close };

  4. now navigate to node_modules->react-native-file-viewer->index.d.ts
    and add the following: declare function close()
    and in this file change this line declare namespace _default { export { open }; } like this declare namespace _default { export { open, close }; }

  5. now you can use this function like this FileViewer.close()

@MuhammadBilal164
Copy link

MuhammadBilal164 commented Aug 8, 2024

Thanks... My issue is resolved now @Muzamil544

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants