Ich habe eine Webview-Komponente von React Native. Der webview soll Eingabetyp ist Datei unterstützen, so dass ich es so:Reactive Native onActivityResult funktioniert nicht
und der Webansicht implementiert ActivityEventListener und außer Kraft setzen onActivityResult.But die onActivityResult funktioniert nicht.
Der Kodex ist
class RNWebView extends WebView implements ActivityEventListener {
protected class GeoWebChromeClient extends WebChromeClient {
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
...
mActivity.startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE);
return true;
}
}
public RNWebView(ReactContext reactContext, Activity activity) {
super(reactContext);
// Add the listener for `onActivityResult`
reactContext.addActivityEventListener(this);
...
}
@Override
public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) {
// Your logic here
Log.d("Tanck", "requestCode:" + requestCode + "----" + "resultCode:" + resultCode);
}
}
Ich habe auch ein Problem von onActivityResult nicht auf rn 27.0.2 und Android Marshmallow (6.0.1) - Nexus 5. – SudoPlz