Skip to content

Commit c6a3544

Browse files
committed
Update README.md
1 parent b11ce18 commit c6a3544

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

README.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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
6466
module.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 = () => {
126146
export 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,7 +180,7 @@ const App = () => {
160180
};
161181
```
162182

163-
4. Start your React Native app!
183+
### 4. Start your React Native app!
164184

165185
## Demo
166186

0 commit comments

Comments
 (0)