Skip to content

Commit 2688e0b

Browse files
committed
docs: update docs regarding babel and flow. fixes callstack#392
1 parent 302f4e2 commit 2688e0b

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

Diff for: .prettierrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
singleQuote: true
3+
tabWidth: 2
4+
trailingComma: "es5"
5+
useTabs: false

Diff for: docs/pages/2.getting-started.md

+17-6
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,24 @@ If you use CRNA or Expo, you don't need to install vector icons. But you will ne
2323

2424
```json
2525
{
26-
"presets": ["expo"]
26+
"presets": ["babel-preset-expo"]
2727
}
2828
```
2929

30-
To get smaller bundle size by excluding modules you don't use, you can use our optional babel plugin. The plugin automatically rewrites the import statements so that only the modules you use are imported instead of the whole library. Add `react-native-paper/babel` to the `plugins` section in your `.babelrc`:
30+
To get smaller bundle size by excluding modules you don't use, you can use our optional babel plugin. The plugin automatically rewrites the import statements so that only the modules you use are imported instead of the whole library. Add `react-native-paper/babel` to the `plugins` section in your `.babelrc` for production environment. It should look like this:
3131

3232
```json
3333
{
34-
"plugins": [
35-
"react-native-paper/babel"
36-
]
34+
"presets": ["babel-preset-react-native"],
35+
"env": {
36+
"production": {
37+
"plugins": ["react-native-paper/babel"]
38+
}
39+
}
3740
}
3841
```
3942

40-
If you created your project using CRNA or Expo, you'll have an `env` section. You can create a new `production` key and place it below so it looks like this:
43+
If you created your project using CRNA or Expo, it'll look something like this:
4144

4245
```json
4346
{
@@ -55,6 +58,14 @@ If you created your project using CRNA or Expo, you'll have an `env` section. Yo
5558

5659
**Note:** The plugin only works if you are importing the library using ES2015 import statements and not with `require`.
5760

61+
If you're using Flow for typechecking your code, you need to add the following under the `[options]` section in your `.flowconfig`:
62+
63+
```ini
64+
module.file_ext=.js
65+
module.file_ext=.android.js
66+
module.file_ext=.ios.js
67+
```
68+
5869
## Usage
5970

6071
Wrap your root component in `Provider` from `react-native-paper`. If you have a vanilla React Native project, it's a good idea to add it in the component which is passed to `AppRegistry.registerComponent`. This will usually be in the `index.js` file. If you have a CRNA or Expo project, you can do this inside the exported component in the `App.js` file.

0 commit comments

Comments
 (0)