proyecto26 / react-native-inappbrowser

📱InAppBrowser for React Native (Android & iOS) 🤘
https://www.npmjs.com/package/react-native-inappbrowser-reborn
MIT License
1.31k stars 223 forks source link

Return json from browser to app #319

Closed andrey-shostik closed 2 years ago

andrey-shostik commented 2 years ago

I need to return API response which I received in web to the app. I checked docs but I havn't found solution. I think solution could be set json in browser param url and then return somehow the url to app, but I can't get the url My code looks like this.

const data = await InAppBrowser.open(payUrl, {
  enableBarCollapsing: false,
  dismissButtonStyle: 'done',
  showTitle: true,
  modalEnabled: true,
  animated: true,
  enableUrlBarHiding: true,
});
console.log(data);

When I close browser using done button I receive {type: "cancel"} in data without any url. Any solution?

jdnichollsc commented 2 years ago

The suggestion here is using a deep linking redirection and sending data with a query param :) And then you can extract these query params using Linking

boyepanthera commented 10 months ago

@jdnichollsc Sorry I had to comment on closed issues, I am in a similar situation and need to send data back from the inappbrowser but I cannot seem to understand where to get value for my-host and scheme based on what the documentation says. I would appreciate some code examples if possible thank you.

stee1ix commented 3 months ago

@boyepanthera Did you find any way?