Skip to content

Commit 062a71d

Browse files
committed
Update demo
1 parent 9bc6f6b commit 062a71d

File tree

6 files changed

+20
-24
lines changed

6 files changed

+20
-24
lines changed

examples/DemoApp/App.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import webApp from './WebApp';
2121

2222
const App = () => {
2323
const [data, setData] = useState('This is React Native');
24-
const {ref, source, onMessage, emit} = useBridge(webApp, (message) => {
24+
const {ref, onMessage, emit} = useBridge((message) => {
2525
if (message.type === 'hi') {
2626
setData(message.data);
2727
}
@@ -30,7 +30,7 @@ const App = () => {
3030
return (
3131
<SafeAreaView style={styles.container}>
3232
<View style={styles.top}>
33-
<WebView ref={ref} source={source} onMessage={onMessage} />
33+
<WebView ref={ref} source={{html: webApp}} onMessage={onMessage} />
3434
</View>
3535
<View style={styles.bottom}>
3636
<TextInput

examples/DemoApp/package-lock.json

Lines changed: 7 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/DemoApp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"react": "16.13.1",
1515
"react-dom": "16.13.1",
1616
"react-native": "0.63.4",
17-
"react-native-react-bridge": "0.6.1",
17+
"react-native-react-bridge": "0.7.0",
1818
"react-native-webview": "11.0.2"
1919
},
2020
"devDependencies": {

examples/DemoAppExpo/App.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,16 @@ import webApp from "./WebApp";
1313

1414
export default function App() {
1515
const [data, setData] = useState("This is React Native");
16-
const { ref, source, onMessage, emit } = useBridge<string>(
17-
webApp,
18-
(message) => {
19-
if (message.type === "hi") {
20-
setData(message.data);
21-
}
16+
const { ref, onMessage, emit } = useBridge<string>((message) => {
17+
if (message.type === "hi") {
18+
setData(message.data);
2219
}
23-
);
20+
});
2421

2522
return (
2623
<SafeAreaView style={styles.container}>
2724
<View style={styles.top}>
28-
<WebView ref={ref} source={source} onMessage={onMessage} />
25+
<WebView ref={ref} source={{ html: webApp }} onMessage={onMessage} />
2926
</View>
3027
<View style={styles.bottom}>
3128
<TextInput

examples/DemoAppExpo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"react-dom": "16.13.1",
1616
"react-native": "~0.63.4",
1717
"react-native-gesture-handler": "~1.10.2",
18-
"react-native-react-bridge": "0.6.1",
18+
"react-native-react-bridge": "0.7.0",
1919
"react-native-reanimated": "~2.1.0",
2020
"react-native-screens": "~3.0.0",
2121
"react-native-unimodules": "~0.13.3",

examples/DemoAppExpo/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6760,10 +6760,10 @@ react-native-gesture-handler@~1.10.2:
67606760
invariant "^2.2.4"
67616761
prop-types "^15.7.2"
67626762

6763-
react-native-react-bridge@0.6.1:
6764-
version "0.6.1"
6765-
resolved "https://registry.yarnpkg.com/react-native-react-bridge/-/react-native-react-bridge-0.6.1.tgz#fc32e915c325579cc8785db1af7796d4bd024d06"
6766-
integrity sha512-J0u56h/3eGjb+//HUNdCOP5als+OQvzNIjw8/uS0bBHlpcqoZZh7ih5ajLMcdgQS68kilyPOUVR99sm7HhBF1w==
6763+
react-native-react-bridge@0.7.0:
6764+
version "0.7.0"
6765+
resolved "https://registry.yarnpkg.com/react-native-react-bridge/-/react-native-react-bridge-0.7.0.tgz#5c84dcace6107174ea33b37f0e2326fd76c2209b"
6766+
integrity sha512-lsmtfFzp0IUKRv+oCGlAFF+KAQ7FtraF7agZDa+LiEYX1BFNmvlF7X2Gt6jvIbmtTQ7udorirpDm9ll/Ww+vog==
67676767
dependencies:
67686768
babel-plugin-module-resolver "4.1.0"
67696769

0 commit comments

Comments
 (0)