|
@@ -110,6 +110,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
110
|
110
|
public static final int COMMAND_POST_MESSAGE = 5;
|
111
|
111
|
public static final int COMMAND_INJECT_JAVASCRIPT = 6;
|
112
|
112
|
public static final int COMMAND_LOAD_URL = 7;
|
|
113
|
+ public static final int COMMAND_FOCUS = 8;
|
113
|
114
|
protected static final String REACT_CLASS = "RNCWebView";
|
114
|
115
|
protected static final String HTML_ENCODING = "UTF-8";
|
115
|
116
|
protected static final String HTML_MIME_TYPE = "text/html";
|
|
@@ -511,7 +512,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
511
|
512
|
@Override
|
512
|
513
|
public @Nullable
|
513
|
514
|
Map<String, Integer> getCommandsMap() {
|
514
|
|
- return MapBuilder.of(
|
|
515
|
+ Map map = MapBuilder.of(
|
515
|
516
|
"goBack", COMMAND_GO_BACK,
|
516
|
517
|
"goForward", COMMAND_GO_FORWARD,
|
517
|
518
|
"reload", COMMAND_RELOAD,
|
|
@@ -520,6 +521,8 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
520
|
521
|
"injectJavaScript", COMMAND_INJECT_JAVASCRIPT,
|
521
|
522
|
"loadUrl", COMMAND_LOAD_URL
|
522
|
523
|
);
|
|
524
|
+ map.put("requestFocus", COMMAND_FOCUS);
|
|
525
|
+ return map;
|
523
|
526
|
}
|
524
|
527
|
|
525
|
528
|
@Override
|
|
@@ -567,6 +570,9 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
567
|
570
|
}
|
568
|
571
|
root.loadUrl(args.getString(0));
|
569
|
572
|
break;
|
|
573
|
+ case COMMAND_FOCUS:
|
|
574
|
+ root.requestFocus();
|
|
575
|
+ break;
|
570
|
576
|
}
|
571
|
577
|
}
|
572
|
578
|
|