Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
inokawa committed May 5, 2024
1 parent 642f947 commit ad20ef7
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 88 deletions.
2 changes: 1 addition & 1 deletion src/common.js → src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const EVENT_KEY = "rn-web-bridge";
export const ROOT_ID = "root";
export const ROOT_ID = "rnrb-root";
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* @module
*/
export type { Message } from "./types";
export { useWebViewMessage } from "./hooks";
export { useWebViewMessage } from "./native";
4 changes: 2 additions & 2 deletions src/hooks.ts → src/native/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useCallback, useRef } from "react";
import type WebView from "react-native-webview";
import type { WebViewMessageEvent, WebViewProps } from "react-native-webview";
import { EVENT_KEY } from "./common";
import type { Message } from "./types";
import { EVENT_KEY } from "../constants";
import type { Message } from "../types";

/**
* A hook to subscribe messages from WebView.
Expand Down
144 changes: 72 additions & 72 deletions src/plugin/__snapshots__/index.spec.ts.snap

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions src/plugin/__snapshots__/metro.spec.ts.snap

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/plugin/html.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ROOT_ID } from "../common";
import { ROOT_ID } from "../constants";

export const createContent = (js: string): string => {
// https://github.com/inokawa/react-native-react-bridge/pull/133
Expand Down
2 changes: 1 addition & 1 deletion src/web/core.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EVENT_KEY, ROOT_ID } from "../common";
import { EVENT_KEY, ROOT_ID } from "../constants";
import type { Message } from "../types";

/**
Expand Down

0 comments on commit ad20ef7

Please sign in to comment.