facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.18k stars 24.32k forks source link

Popups Do Not Appear In React Native WebView #22802

Closed Shivendra30 closed 5 years ago

Shivendra30 commented 5 years ago

I'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?

react-native-bot commented 5 years ago

We are automatically closing this issue because it does not appear to follow any of the provided issue templates.

Please make use of the bug report template to let us know about a reproducible bug or regression in the core React Native library.

If you'd like to propose a change or discuss a feature request, there is a repository dedicated to Discussions and Proposals you may use for this purpose.

vnlebaoduy commented 5 years ago

@Shivendra30 Where i can add them ?