Coder Social home page Coder Social logo

Comments (8)

TsplayerT avatar TsplayerT commented on April 28, 2024 1

Ok, I understand and thanks for the help 😁

from react-native.

github-actions avatar github-actions commented on April 28, 2024
⚠ī¸ Newer Version of React Native is Available!
ℹī¸ You are on a supported minor version, but it looks like there's a newer patch available - 0.73.6. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

from react-native.

frankcalise avatar frankcalise commented on April 28, 2024

Hello there! I don't believe Linking isn't used to open files, but known URL schemes for core functionality such as mail, SMS, etc.

You can find more about the supported Built-int URL Schemes here: https://reactnative.dev/docs/linking#built-in-url-schemes

I think what you may be looking to do here is follow it up with starting a specific Android intent for viewing an image, as mentioned in Expo's documentation as a follow up to getContentUriAsync. That looks like this:

FileSystem.getContentUriAsync(uri).then(cUri => {
  console.log(cUri);
  IntentLauncher.startActivityAsync('android.intent.action.VIEW', {
    data: cUri,
    flags: 1,
  });
});

But there is more details on that over at Expo's documentation: https://docs.expo.dev/versions/latest/sdk/filesystem/#filesystemgetcontenturiasyncfileuri

from react-native.

TsplayerT avatar TsplayerT commented on April 28, 2024

@frankcalise cool, this really works! 🎉
But I will also want to do the same for iOS, how can I do that? 🤔

I would like you to open a modal so that the user can choose which application should display the image, is there any way?
image

from react-native.

frankcalise avatar frankcalise commented on April 28, 2024

@TsplayerT I don't believe there is an equivalent of Android Intents system on iOS. That's why that getContentUriAsync method is labeled Android only

You'd probably have to change your workflow a little to save the image off to the user's media library, then they'll open it with their default photos app.

However, I think this is more of a implementation question and not a direct issue with react-native itself anymore.

from react-native.

TsplayerT avatar TsplayerT commented on April 28, 2024

@frankcalise i'm only using the getContentUriAsync method because I could only do it that way. 😭

By any chance, could you help me with the function to save the image to the user's media library and then he would open it with the default photo application? Please 🙏

It would be more interesting if it opened a modal so that the user can choose which application should display the image. đŸĨē

from react-native.

TsplayerT avatar TsplayerT commented on April 28, 2024

@frankcalise is there any way to open a native modal for the user to choose which application should display the content of the image downloaded from an API for Android and iOS? 🤔

from react-native.

frankcalise avatar frankcalise commented on April 28, 2024

@TsplayerT iOS doesn't allow for such a thing AFAIK.

I would reach out to a community for help such as Stack Overflow or any of the Company Based Communities listed where many developers can share their experiences on running into issues with feature parity such as this one.

But as we have solved the original issue in question, I think this can be closed now if you wouldn't mind

from react-native.

Related Issues (20)

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.