@@ -58,7 +58,9 @@ npm install preact
5858
5959## Usage
6060
61- 1 . Fix ` metro.config.js ` to use babelTransformer from this library.
61+ ### 1. Fix ` metro.config.js ` to use babelTransformer from this library.
62+
63+ #### React Native
6264
6365``` javascript
6466module .exports = {
@@ -77,7 +79,25 @@ module.exports = {
7779};
7880```
7981
80- 2 . Make entry file for web app.
82+ #### Expo
83+
84+ ``` javascript
85+ const { getDefaultConfig } = require (" expo/metro-config" );
86+
87+ const config = getDefaultConfig (__dirname );
88+
89+ module .exports = {
90+ ... config,
91+ transformer: {
92+ ... config .transformer ,
93+ babelTransformerPath: require .resolve (
94+ " react-native-react-bridge/lib/plugin"
95+ ),
96+ },
97+ };
98+ ```
99+
100+ ### 2. Make entry file for web app.
81101
82102- If you use React in web, import modules from ` react ` and ` react-native-react-bridge/lib/web ` .
83103- If you use Preact in web, import modules from ` preact ` and ` react-native-react-bridge/lib/web/preact ` .
@@ -126,7 +146,7 @@ const Root = () => {
126146export default webViewRender (< Root / > );
127147```
128148
129- 3 . Use the entry file in your React Native app with WebView.
149+ ### 3. Use the entry file in your React Native app with WebView.
130150
131151``` jsx
132152// App.js
@@ -160,12 +180,14 @@ const App = () => {
160180};
161181```
162182
163- 4 . Start your React Native app!
183+ ### 4. Start your React Native app!
164184
165185## Demo
166186
167187This repository includes demo app.
168188
189+ ### React Native
190+
169191Before running this app, please prepare environment for React Native (https://reactnative.dev/docs/environment-setup ).
170192
171193``` sh
@@ -174,3 +196,12 @@ cd examples/DemoApp
174196npm install
175197npm run ios # or npm run android
176198```
199+
200+ ### Expo
201+
202+ ``` sh
203+ git clone
[email protected] :inokawa/react-native-react-bridge.git
204+ cd examples/DemoAppExpo
205+ yarn
206+ expo start
207+ ```
0 commit comments