Skip to content

Commit 77147cf

Browse files
committed
Update example
1 parent 5a7cd97 commit 77147cf

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

examples/DemoApp/WebApp/button.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import React from 'react';
2+
3+
export const Button = ({children, onClick}) => {
4+
return <button onClick={onClick}>{children}</button>;
5+
};

examples/DemoApp/WebApp/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
} from 'react-native-react-bridge/lib/web';
77
import './example.css';
88
import png from './Octocat.png';
9+
import {Button} from './button';
910

1011
const style = {
1112
width: '100vw',
@@ -16,7 +17,7 @@ const style = {
1617

1718
const Root = () => {
1819
const [data, setData] = useState('This is Web');
19-
useSubscribe((message) => {
20+
useSubscribe(message => {
2021
if (message.type === 'hello') {
2122
setData(message.data);
2223
}
@@ -26,11 +27,11 @@ const Root = () => {
2627
<div>
2728
<img src={png} width={100} height={'auto'} />
2829
</div>
29-
<textarea value={data} onChange={(e) => setData(e.target.value)} />
30+
<textarea value={data} onChange={e => setData(e.target.value)} />
3031
<div>
31-
<button onClick={() => emit({type: 'hi', data: data})}>
32+
<Button onClick={() => emit({type: 'hi', data: data})}>
3233
send to React Native
33-
</button>
34+
</Button>
3435
</div>
3536
</div>
3637
);

0 commit comments

Comments
 (0)