Popups Do Not Appear in React Native WebView
See original GitHub issueI’ve seen multiple questions regarding this on StackOverflow but unfortunately, none of them have been solved.
In my case, I’m using PayuMoney inside a WebView to execute a transaction. Payumoney by default opens up a new window while processing a transaction which is not visible inside the react native’s webview but is apparently visible in mobile browsers.
According to this answer - Enable Popups in React Native WebView, I added
// To enable these by default
WebSettings settings = webView.getSettings();
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setSupportMultipleWindows(true);
And also this,
//To add these as valid props for the WebView Component
@ReactProp(name = "javaScriptCanOpenWindowsAutomatically")
public void setJavaScriptCanOpenWindowsAutomatically(WebView view, boolean isCan) {
view.getSettings().setJavaScriptCanOpenWindowsAutomatically(isCan);
}
@ReactProp(name = "supportMultipleWindows")
public void setSupportMultipleWindows(WebView view, boolean supports) {
view.getSettings().setSupportMultipleWindows(supports);
}
Additionally, I have also tried multiple npm packages which provide different implementations of WebView but nothing seems to work.
What is the best way to enable this feature?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:13 (1 by maintainers)
Top Results From Across the Web
How to allow popup in reactnative web view - Stack Overflow
I'm using (https://www.npmjs.com/package/react-native-webview) for web view. current my code like this. import React from 'react'; import { ...
Read more >[Solved]-Enable Popups in React Native WebView-React Native
Coding example for the question Enable Popups in React Native WebView-React Native.
Read more >WebView - React Native
You can use this component to navigate back and forth in the web view's history and configure various properties for the web content....
Read more >Creating an embedded browser with React-Native ... - Medium
We are going to go over a basic browser implementation using react-native-webview, it is able to: use the search bar to go to...
Read more >Webviews and social authentication with React Native
TL;DR: The solution is to implement a communication bridge between the Webview and React Native (via postMessage/onMessage), so when the user clicks on ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Shivendra30 I’m also facing the same issue using razerpay. I added your code into react native code. but it doesn’t work. any other fix?
Can you tell me what did you changed? I’m having the same issue.