web-dev-qa-db-fra.com

react-native-webview plante l'application lorsqu'elle est appelée

J'utilise la bibliothèque react-native-webview pour charger la page Web, cela fonctionne bien dans le débogage, mais lorsque je crée une version de version. Et cliquez sur l'onglet pour charger la vue Web, l'application se bloque. voici l'erreur. J'ai également joint une trace d'erreur à la fin.

J'utilise react-native: "0.62.0" react-native-webview: "^ 9.0.2",

sve

c'est la trace lorsque je clique sur le bouton pour charger l'écran de visualisation Web.

> 2020-04-10 11:39:44.812 2584-2646/com.trackplayer E/ReactNativeJS:
> Error: crypto.getRandomValues() not supported. See
> https://github.com/uuidjs/uuid#getrandomvalues-not-supported
>     
>     This error is located at:
>         in n
>         in RCTView
>         in y
>         in Unknown
>         in Unknown
>         in Unknown
>         in Unknown
>         in RCTView
>         in S
>         in RCTView
>         in RCTView
>         in E
>         in RCTView
>         in c
>         in RCTView
>         in Unknown
>         in v
>         in Unknown
>         in w
>         in Unknown
>         in Unknown
>         in Unknown
>         in Unknown
>         in RCTView
>         in RCTView
>         in RCTView
>         in RCTView
>         in k
>         in ForwardRef
>         in PanGestureHandler
>         in RCTView
>         in k
>         in ForwardRef
>         in RCTView
>         in D
>         in Unknown
>         in RCTView
>         in C
>         in RCTView
>         in H
>         in S
>         in h
>         in RNCSafeAreaView
>         in Unknown
>         in Unknown
>         in GestureHandlerRootView
>         in Unknown
>         in b
>         in Unknown
>         in O
>         in Unknown
>         in ForwardRef
>         in Unknown
>         in ForwardRef
>         in S
>         in RCTView
>         in RCTView
>         in E 2020-04-10 11:39:44.818 2584-2646/com.trackplayer E/ReactNativeJS: Error: crypto.getRandomValues() not supported. See
> https://github.com/uuidjs/uuid#getrandomvalues-not-supported
>     
>     This error is located at:
>         in n
>         in RCTView
>         in y
>         in Unknown
>         in Unknown
>         in Unknown
>         in Unknown
>         in RCTView
>         in S
>         in RCTView
>         in RCTView
>         in E
>         in RCTView
>         in c
>         in RCTView
>         in Unknown
>         in v
>         in Unknown
>         in w
>         in Unknown
>         in Unknown
>         in Unknown
>         in Unknown
>         in RCTView
>         in RCTView
>         in RCTView
>         in RCTView
>         in k
>         in ForwardRef
>         in PanGestureHandler
>         in RCTView
>         in k
>         in ForwardRef
>         in RCTView
>         in D
>         in Unknown
>         in RCTView
>         in C
>         in RCTView
>         in H
>         in S
>         in h
>         in RNCSafeAreaView
>         in Unknown
>         in Unknown
>         in GestureHandlerRootView
>         in Unknown
>         in b
>         in Unknown
>         in O
>         in Unknown
>         in ForwardRef
>         in Unknown
>         in ForwardRef
>         in S
>         in RCTView
>         in RCTView
>         in E 2020-04-10 11:39:44.822 2584-2647/com.trackplayer E/unknown:ReactNative: Error: crypto.getRandomValues() not supported.
> See https://github.com/uuidjs/uuid#getrandomvalues-not-supported
>     
>     This error is located at:
>         in n
>         in RCTView
>         in y
>         in Unknown
>         in Unknown
>         in Unknown
>         in Unknown
>         in RCTView
>         in S
>         in RCTView
>         in RCTView
>         in E
>         in RCTView
>         in c
>         in RCTView
>         in Unknown
>         in v
>         in Unknown
>         in w
>         in Unknown
>         in Unknown
>         in Unknown
>         in Unknown
>         in RCTView
>         in RCTView
>         in RCTView
>         in RCTView
>         in k
>         in ForwardRef
>         in PanGestureHandler
>         in RCTView
>         in k
>         in ForwardRef
>         in RCTView
>         in D
>         in Unknown
>         in RCTView
>         in C
>         in RCTView
>         in H
>         in S
>         in h
>         in RNCSafeAreaView
>         in Unknown
>         in Unknown
>         in GestureHandlerRootView
>         in Unknown
>         in b
>         in Unknown
>         in O
>         in Unknown
>         in ForwardRef
>         in Unknown
>         in ForwardRef
>         in S
>         in RCTView
>         in RCTView
>         in E, stack:
>     default@717:132
>     f@722:329
>     n@714:2621
>     Bn@92:31529
>     ui@92:49357
>     ja@92:72034
>     Oa@92:71959
>     Ia@92:69253
>     Ia@-1
>     <unknown>@92:25480
>     unstable_runWithPriority@183:3503
>     dn@92:25427
>     fn@92:25362
>     Pe@92:90879
>     Re@92:13478
>     Ie@92:13664
>     receiveTouches@92:14448
>     value@27:3544
>     <unknown>@27:840
>     value@27:2798
>     value@27:812
>     value@-1 2020-04-10 11:39:44.831 2584-2647/com.trackplayer E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
>     Process: com.trackplayer, PID: 2584
>     com.facebook.react.common.JavascriptException: Error: crypto.getRandomValues() not supported. See
> https://github.com/uuidjs/uuid#getrandomvalues-not-supported
>     
>     This error is located at:
>         in n
>         in RCTView
>         in y
>         in Unknown
>         in Unknown
>         in Unknown
>         in Unknown
>         in RCTView
>         in S
>         in RCTView
>         in RCTView
>         in E
>         in RCTView
>         in c
>         in RCTView
>         in Unknown
>         in v
>         in Unknown
>         in w
>         in Unknown
>         in Unknown
>         in Unknown
>         in Unknown
>         in RCTView
>         in RCTView
>         in RCTView
>         in RCTView
>         in k
>         in ForwardRef
>         in PanGestureHandler
>         in RCTView
>         in k
>         in ForwardRef
>         in RCTView
>         in D
>         in Unknown
>         in RCTView
>         in C
>         in RCTView
>         in H
>         in S
>         in h
>         in RNCSafeAreaView
>         in Unknown
>         in Unknown
>         in GestureHandlerRootView
>         in Unknown
>         in b
>         in Unknown
>         in O
>         in Unknown
>         in ForwardRef
>         in Unknown
>         in ForwardRef
>         in S
>         in RCTView
>         in RCTView
>         in E, stack:
>     default@717:132
>     f@722:329
>     n@714:2621
>     Bn@92:31529
>     ui@92:49357
>     ja@92:72034
>     Oa@92:71959
>     Ia@92:69253
>     Ia@-1
>     <unknown>@92:25480
>     unstable_runWithPriority@183:3503
>     dn@92:25427
>     fn@92:25362
>     Pe@92:90879
>     Re@92:13478
>     Ie@92:13664
>     receiveTouches@92:14448
>     value@27:3544
>     <unknown>@27:840
>     value@27:2798
>     value@27:812
>     value@-1
>     
>         at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.Java:79)
>         at Java.lang.reflect.Method.invoke(Native Method)
>         at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.Java:372)
>         at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.Java:151)
>         at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
>         at Android.os.Handler.handleCallback(Handler.Java:883)
>         at Android.os.Handler.dispatchMessage(Handler.Java:100)
>         at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.Java:27)
>         at Android.os.Looper.loop(Looper.Java:214)
>         at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.Java:226)
>         at Java.lang.Thread.run(Thread.Java:919) 2020-04-10 11:39:44.850 2584-2647/com.trackplayer I/Process: Sending signal. PID:
> 2584 SIG: 9

a corrigé le problème pour moi: `react-native-webview:" 8.0.4 ",

2
Wasif Mustahid

Cela a fonctionné pour moi. Je viens de l'utiliser.

 expo install react-native-webview
 "react-native-webview": "8.1.1"

 import { WebView } from 'react-native-webview'
 <WebView source={{ uri: 'https://expo.io' }} style={{ marginTop: 20, height: 500 }} />
1
learner

Install react-native-get-random-values package .. Ensuite, essayez de déplacer l'importation tout en haut du fichier.

index.js

De cette façon, cela a fonctionné pour moi.

import 'react-native-get-random-values';
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);
0
ahmedfeyzi