@@ -164,7 +164,7 @@ module.exports = {
164164import React , { useState } from " react" ;
165165import {
166166 webViewRender ,
167- emit ,
167+ emitToNative ,
168168 useNativeMessage ,
169169} from " react-native-react-bridge/lib/web" ;
170170// Importing css is supported
@@ -189,7 +189,7 @@ const Root = () => {
189189 // emit sends message to React Native
190190 // type: event name
191191 // data: some data which will be serialized by JSON.stringify
192- emit ({ type: " hello" , data: 123 });
192+ emitToNative ({ type: " hello" , data: 123 });
193193 }}
194194 / >
195195 < / div>
@@ -208,7 +208,7 @@ export default webViewRender(<Root />);
208208
209209import React from " react" ;
210210import WebView from " react-native-webview" ;
211- import { emit , useWebViewMessage } from " react-native-react-bridge" ;
211+ import { emitToWebView , useWebViewMessage } from " react-native-react-bridge" ;
212212import webApp from " ./WebApp" ;
213213
214214const App = () => {
@@ -220,7 +220,7 @@ const App = () => {
220220 // type: event name
221221 // data: some data which will be serialized by JSON.stringify
222222 if (message .type === " hello" && message .data === 123 ) {
223- emit (ref, { type: " success" , data: " succeeded!" });
223+ emitToWebView (ref, { type: " success" , data: " succeeded!" });
224224 }
225225 });
226226
0 commit comments