Skip to content

Commit f1c7ccc

Browse files
committed
more Expo related docs updates
1 parent 9cf3256 commit f1c7ccc

File tree

8 files changed

+86
-18
lines changed

8 files changed

+86
-18
lines changed

docs/multiple-transformers.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ module.exports = (async () => {
7171

7272
---
7373

74-
#### For React Native v0.56 or older / Expo SDK v30.0.0 or older
74+
#### For React Native v0.56 or older
7575

7676
Add more extensions to `.babelrc`:
7777

@@ -103,7 +103,26 @@ module.exports = {
103103
};
104104
```
105105

106-
...or if you are using [Expo](https://expo.io/), to `app.json`:
106+
#### Expo SDK v30.0.0 or older
107+
108+
Add more extensions to `.babelrc`:
109+
110+
```json
111+
{
112+
"presets": ["babel-preset-expo"],
113+
"plugins": [
114+
"react-native-classname-to-style",
115+
[
116+
"react-native-platform-specific-extensions",
117+
{
118+
"extensions": ["css", "scss", "sass"]
119+
}
120+
]
121+
]
122+
}
123+
```
124+
125+
Instead of adding the `rn-cli.config.js` file, you need to add this to `app.json`:
107126

108127
```json
109128
{

docs/setup-css.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ yarn add babel-plugin-react-native-classname-to-style babel-plugin-react-native-
8585

8686
#### For Expo
8787

88-
`babel.config.js`
88+
`babel.config.js` (older Expo versions use `.babelrc`)
8989

9090
```js
9191
module.exports = function(api) {
@@ -138,7 +138,7 @@ If you are using [Expo](https://expo.io/), you also need to add this to `app.jso
138138

139139
---
140140

141-
#### For React Native v0.56 or older / Expo SDK v30.0.0 or older
141+
#### For React Native v0.56 or older
142142

143143
If you are using React Native without Expo, add this to `rn-cli.config.js` in your project's root (create the file if you don't have one already):
144144

@@ -153,6 +153,8 @@ module.exports = {
153153
};
154154
```
155155

156+
#### Expo SDK v30.0.0 or older
157+
156158
If you are using [Expo](https://expo.io/), instead of adding the `rn-cli.config.js` file, you need to add this to `app.json`:
157159

158160
```json

docs/setup-less.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ yarn add babel-plugin-react-native-classname-to-style babel-plugin-react-native-
8585

8686
#### For Expo
8787

88-
`babel.config.js`
88+
`babel.config.js` (older Expo versions use `.babelrc`)
8989

9090
```js
9191
module.exports = function(api) {
@@ -138,7 +138,7 @@ If you are using [Expo](https://expo.io/), you also need to add this to `app.jso
138138

139139
---
140140

141-
#### For React Native v0.56 or older / Expo SDK v30.0.0 or older
141+
#### For React Native v0.56 or older
142142

143143
If you are using React Native without Expo, add this to `rn-cli.config.js` in your project's root (create the file if you don't have one already):
144144

@@ -153,6 +153,8 @@ module.exports = {
153153
};
154154
```
155155

156+
#### Expo SDK v30.0.0 or older
157+
156158
If you are using [Expo](https://expo.io/), instead of adding the `rn-cli.config.js` file, you need to add this to `app.json`:
157159

158160
```json

docs/setup-postcss.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Add your PostCSS configuration to [one of the supported config formats](https://
9191

9292
#### For Expo
9393

94-
`babel.config.js`
94+
`babel.config.js` (older Expo versions use `.babelrc`)
9595

9696
```js
9797
module.exports = function(api) {
@@ -147,7 +147,7 @@ If you are using [Expo](https://expo.io/), you also need to add this to `app.jso
147147

148148
---
149149

150-
#### For React Native v0.56 or older / Expo SDK v30.0.0 or older
150+
#### For React Native v0.56 or older
151151

152152
If you are using React Native without Expo, add this to `rn-cli.config.js` in your project's root (create the file if you don't have one already):
153153

@@ -162,6 +162,8 @@ module.exports = {
162162
};
163163
```
164164

165+
#### Expo SDK v30.0.0 or older
166+
165167
If you are using [Expo](https://expo.io/), instead of adding the `rn-cli.config.js` file, you need to add this to `app.json`:
166168

167169
```json

docs/setup-responsive.md

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ react-native run-ios
4141
yarn add babel-plugin-react-native-classname-to-dynamic-style babel-plugin-react-native-platform-specific-extensions react-native-css-transformer --dev
4242
```
4343

44-
### Step 4: Setup your project's `.babelrc`
44+
### Step 4: Setup your project's Babel configuration
4545

4646
#### For React Native v0.57 or newer
4747

48+
`.babelrc`
49+
4850
```json
4951
{
5052
"presets": ["module:metro-react-native-babel-preset"],
@@ -64,6 +66,8 @@ yarn add babel-plugin-react-native-classname-to-dynamic-style babel-plugin-react
6466

6567
#### For React Native v0.56 or older
6668

69+
`.babelrc`
70+
6771
```json
6872
{
6973
"presets": ["react-native"],
@@ -79,9 +83,28 @@ yarn add babel-plugin-react-native-classname-to-dynamic-style babel-plugin-react
7983
}
8084
```
8185

86+
---
87+
88+
#### For Expo
89+
90+
`babel.config.js` (older Expo versions use `.babelrc`)
91+
92+
```js
93+
module.exports = function(api) {
94+
api.cache(true);
95+
return {
96+
presets: ["babel-preset-expo"],
97+
plugins: [
98+
"react-native-classname-to-dynamic-style",
99+
["react-native-platform-specific-extensions", { extensions: ["css"] }]
100+
]
101+
};
102+
};
103+
```
104+
82105
### Step 5: Setup `rn-cli.config.js` in your project
83106

84-
#### For React Native v0.57 or newer
107+
#### For React Native v0.57 or newer / Expo SDK v31.0.0 or newer
85108

86109
Add this to `rn-cli.config.js` in your project's root (create the file if you don't have one already):
87110

@@ -103,11 +126,23 @@ module.exports = (async () => {
103126
})();
104127
```
105128

129+
If you are using [Expo](https://expo.io/), you also need to add this to `app.json`:
130+
131+
```json
132+
{
133+
"expo": {
134+
"packagerOpts": {
135+
"config": "rn-cli.config.js"
136+
}
137+
}
138+
}
139+
```
140+
106141
---
107142

108143
#### For React Native v0.56 or older
109144

110-
Add this to `rn-cli.config.js` in your project's root (create the file if you don't have one already):
145+
If you are using React Native without Expo, add this to `rn-cli.config.js` in your project's root (create the file if you don't have one already):
111146

112147
```js
113148
module.exports = {
@@ -120,7 +155,9 @@ module.exports = {
120155
};
121156
```
122157

123-
...or if you are using [Expo](https://expo.io/), in `app.json`:
158+
#### Expo SDK v30.0.0 or older
159+
160+
If you are using [Expo](https://expo.io/), instead of adding the `rn-cli.config.js` file, you need to add this to `app.json`:
124161

125162
```json
126163
{

docs/setup-sass.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ yarn add babel-plugin-react-native-classname-to-style babel-plugin-react-native-
8585

8686
#### For Expo
8787

88-
`babel.config.js`
88+
`babel.config.js` (older Expo versions use `.babelrc`)
8989

9090
```js
9191
module.exports = function(api) {
@@ -141,7 +141,7 @@ If you are using [Expo](https://expo.io/), you also need to add this to `app.jso
141141

142142
---
143143

144-
#### For React Native v0.56 or older / Expo SDK v30.0.0 or older
144+
#### For React Native v0.56 or older
145145

146146
If you are using React Native without Expo, add this to `rn-cli.config.js` in your project's root (create the file if you don't have one already):
147147

@@ -156,6 +156,8 @@ module.exports = {
156156
};
157157
```
158158

159+
#### Expo SDK v30.0.0 or older
160+
159161
If you are using [Expo](https://expo.io/), instead of adding the `rn-cli.config.js` file, you need to add this to `app.json`:
160162

161163
```json

docs/setup-stylename.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ yarn add babel-plugin-react-native-stylename-to-style babel-plugin-react-native-
9999

100100
#### For Expo
101101

102-
`babel.config.js`
102+
`babel.config.js` (older Expo versions use `.babelrc`)
103103

104104
```js
105105
module.exports = function(api) {
@@ -162,7 +162,7 @@ If you are using [Expo](https://expo.io/), you also need to add this to `app.jso
162162

163163
---
164164

165-
#### For React Native v0.56 or older / Expo SDK v30.0.0 or older
165+
#### For React Native v0.56 or older
166166

167167
If you are using React Native without Expo, add this to `rn-cli.config.js` in your project's root (create the file if you don't have one already):
168168

@@ -177,6 +177,8 @@ module.exports = {
177177
};
178178
```
179179

180+
#### Expo SDK v30.0.0 or older
181+
180182
If you are using [Expo](https://expo.io/), instead of adding the `rn-cli.config.js` file, you need to add this to `app.json`:
181183

182184
```json

docs/setup-stylus.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ yarn add babel-plugin-react-native-classname-to-style babel-plugin-react-native-
8585

8686
#### For Expo
8787

88-
`babel.config.js`
88+
`babel.config.js` (older Expo versions use `.babelrc`)
8989

9090
```js
9191
module.exports = function(api) {
@@ -138,7 +138,7 @@ If you are using [Expo](https://expo.io/), you also need to add this to `app.jso
138138

139139
---
140140

141-
#### For React Native v0.56 or older / Expo SDK v30.0.0 or older
141+
#### For React Native v0.56 or older
142142

143143
If you are using React Native without Expo, add this to `rn-cli.config.js` in your project's root (create the file if you don't have one already):
144144

@@ -153,6 +153,8 @@ module.exports = {
153153
};
154154
```
155155

156+
#### Expo SDK v30.0.0 or older
157+
156158
If you are using [Expo](https://expo.io/), instead of adding the `rn-cli.config.js` file, you need to add this to `app.json`:
157159

158160
```json

0 commit comments

Comments
 (0)