Skip to content

[iOS] ios.openDocument(path) does nothing if current screen is a modal #311

Closed

Description

@psegalen

Hi,
My app was using react-navigation's stack navigator which displays JS modals but I recently switched to native-stack navigator which displays a native modal.
In this modal I have a button allowing the user to download a file through this lib, Android generates a notification to open the downloaded file but not on iOS, so my app opens the downloaded document on iOS.
Everything works as intended but since I switched to a native-stack navigator ios.openDocument(path) just doesn't do anything, there is no exception thrown and the promise correctly returns void but nothing happens in the app.

I guess it has something to do with ViewController since I found this PR fixing the same kind of problem on another lib: https://github.com/vinzscam/react-native-file-viewer/pull/5/files - I'll try to apply it on this lib but since I've never been an Obj-C beast I'm not sure I'll succeed... :)

RN version: 0.72.4
RNBlobUtil version: 0.19.1

Activity

  1. jitenshah19 commented on Nov 20, 2023

    @jitenshah19

    Hi @psegalen. Were you able to find a solution to opening a file in ios using openDocument inside a modal?

  2. psegalen commented on Nov 20, 2023

    @psegalen
    Author

    Hi @jitenshah19 nope I couldn't find a solution using this package, I ended up sharing the path (through RN Share API: https://reactnative.dev/docs/share) in the "url" prop instead of trying to open it.

  3. jitenshah19 commented on Nov 21, 2023

    @jitenshah19

    I ended up using react-native-file-viewer package.

  4. dgrover-spotnana commented on Jun 30, 2024

    @dgrover-spotnana

    @RonRadtke Do you have any update on this ? The issue still exists for both ios.openDocument(path) and ios.previewDocument(path)

    "react-native": "0.72.12",
    "react-native-blob-util": "^0.19.9",
    "react-native-modal": "^13.0.1",
    
  5. saoudnazir commented on Jun 1, 2025

    @saoudnazir

    Same Issue

  6. PrimulaX commented on Jun 23, 2025

    @PrimulaX

    I have same problem, preview sheet is behind react navigation modal

  7. RonRadtke commented on Nov 9, 2026

    @RonRadtke
    Owner

    Fixed in 1.1.1 and 0.25.3 (npm install react-native-blob-util@support-0.25): the iOS document menus and the preview are presented from the view controller on top, so they appear over a native modal. In 1.1.1 that covers open.file, open.chooser and open.optionsMenu; in 0.25.3 it covers ios.presentOptionsMenu, ios.presentOpenInMenu and ios.presentPreview. The older ios.openDocument and ios.previewDocument use the same code in both versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions