Skip to content

Commit 9366b10

Browse files
committed
Improve emit API
1 parent 43cf30c commit 9366b10

22 files changed

+54
-46
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ module.exports = {
164164
import React, { useState } from "react";
165165
import {
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

209209
import React from "react";
210210
import WebView from "react-native-webview";
211-
import { emit, useWebViewMessage } from "react-native-react-bridge";
211+
import { emitToWebView, useWebViewMessage } from "react-native-react-bridge";
212212
import webApp from "./WebApp";
213213

214214
const 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

e2e/index.spec.tsx-snapshots/smoke-webview-app-export-commonjs-jsx-3-chromium.txt

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

e2e/index.spec.tsx-snapshots/smoke-webview-app-export-default-jsx-3-chromium.txt

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

e2e/index.spec.tsx-snapshots/smoke-webview-app-export-default-react-jsx-3-chromium.txt

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

e2e/index.spec.tsx-snapshots/smoke-webview-app-export-default-tsx-3-chromium.txt

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

e2e/index.spec.tsx-snapshots/smoke-webview-app-export-default-with-html-jsx-3-chromium.txt

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

e2e/index.spec.tsx-snapshots/smoke-webview-app-export-default-with-images-jsx-3-chromium.txt

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

e2e/index.spec.tsx-snapshots/smoke-webview-app-export-default-with-json-jsx-3-chromium.txt

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

e2e/index.spec.tsx-snapshots/smoke-webview-app-export-default-with-md-jsx-3-chromium.txt

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

e2e/index.spec.tsx-snapshots/smoke-webview-app-export-default-with-txt-jsx-3-chromium.txt

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)