Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module is not a registered callable module (calling onMessage) on Android #38

Open
aik117 opened this issue Apr 15, 2020 · 14 comments
Open

Comments

@aik117
Copy link

aik117 commented Apr 15, 2020

Hello i am experiencing a strange issue. When i press the save button, the app crashes with below error. Its happening only on android. Please guide me on this.
image

Environment
Android emulator api 26

@YanYuanFE
Copy link
Owner

Are you use expo init project?

@aik117
Copy link
Author

aik117 commented Apr 15, 2020

No i am using react native cli

@YanYuanFE
Copy link
Owner

Can you try to use react-native-webview normally?

import React, { Component } from 'react';
import { View } from 'react-native';
import { WebView } from 'react-native-webview';

export default class App extends Component {
  render() {
    const html = `
      <html>
      <head></head>
      <body>
        <script>
          setTimeout(function () {
            window.ReactNativeWebView.postMessage("Hello!")
          }, 2000)
        </script>
      </body>
      </html>
    `;

    return (
      <View style={{ flex: 1 }}>
        <WebView
          source={{ html }}
          onMessage={event => {
            alert(event.nativeEvent.data);
          }}
        />
      </View>
    );
  }
}

https://github.com/react-native-community/react-native-webview/blob/master/docs/Guide.md#communicating-between-js-and-native

@aik117
Copy link
Author

aik117 commented Apr 15, 2020

@YanYuanFE now i am getting this

image

@YanYuanFE
Copy link
Owner

crypto is your lib of project?

@aik117
Copy link
Author

aik117 commented Apr 15, 2020

@YanYuanFE no i didn't use any crypto library, it's giving error in webview library.

@YanYuanFE
Copy link
Owner

react-native-webview/react-native-webview#1295, this is a problem of react-native-webview, and fixed of this PR:react-native-webview/react-native-webview#1301, I need to update the version.

@YanYuanFE
Copy link
Owner

I has release v2.0, you can try to install it.

@aik117
Copy link
Author

aik117 commented Apr 15, 2020

@YanYuanFE still getting the same crypto error after updating both react-native-webview and react-native-signature-canvas.

@YanYuanFE
Copy link
Owner

And make sure to run development server with --reset-cache flag

@aik117
Copy link
Author

aik117 commented Apr 15, 2020

@YanYuanFE not resolved, still same issue.

@aik117
Copy link
Author

aik117 commented Apr 15, 2020

Followed this, issue solved
react-native-webview/react-native-webview#1312

@morganbigot
Copy link

I followed the post: (adding react-native-get-random-values package and importing it from index.js of my project.)
and now have that issue :
null is not an object (evaluating 'RNGetRandomValues.getRandomBase64')

@ivangafa
Copy link

I have this issue, with latest expo SDK version 39.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants