LoginSignup
3
1

More than 3 years have passed since last update.

Androidでreact-native-webviewを呼び出せない問題の対応方法

Last updated at Posted at 2020-04-15

何が起こった?

react-native-webviewを利用しようとした時、以下のようなエラーが発生してWebViewを利用できませんでした。
少し調べたところreact-native-webviewのバグのようです。

Error: crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues -not-supported

スクリーンショット 2020-04-15 10.43.38.png

環境

react-native: 0.60.5
react-native-webview: ^9.2.1

解決策

react-native-get-random-valuesを利用することで解決しました。

インストール

$ yarn add react-native-get-random-values
$ cd ios && pod install

WebViewを利用するところの一行目に以下を追加。


import 'react-native-get-random-values'

これで解決するはずです。

最後に

誰かの参考になれば嬉しいです。
Twitterもやってます。
もしよければフォローよろしくお願いします! -> @kasssssy0000

参考

https://stackoverflow.com/questions/61135378/react-native-webview-crashes-application-when-invoked
https://github.com/react-native-community/react-native-webview/issues/1312
https://github.com/LinusU/react-native-get-random-values

3
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1