You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/pages/2.getting-started.md
+28-31
Original file line number
Diff line number
Diff line change
@@ -19,56 +19,53 @@ react-native link react-native-vector-icons
19
19
20
20
If you don't want to install vector icons, you can use [babel-plugin-optional-require](https://github.com/satya164/babel-plugin-optional-require) to opt-out.
21
21
22
-
If you use CRNA or Expo, you don't need to install vector icons. But you will need to make sure that your `.babelrc`includes `babel-preset-expo`:
22
+
If you use Expo, you don't need to install vector icons. But if you have a `babel.config.js` or `.babelrc` file, make sure that it includes `babel-preset-expo`.
23
23
24
-
```json
25
-
{
26
-
"presets": ["babel-preset-expo"]
27
-
}
28
-
```
29
-
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:
24
+
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 `babel.config.js` for production environment. It should look like this:
If you created your project using CRNA or Expo, it'll look something like this:
37
+
If you created your project using Expo, it'll look something like this:
44
38
45
-
```json
46
-
{
47
-
"presets": ["babel-preset-expo"],
48
-
"env": {
49
-
"development": {
50
-
"plugins": ["transform-react-jsx-source"]
39
+
```js
40
+
module.exports=function(api) {
41
+
api.cache(true);
42
+
return {
43
+
presets: ['babel-preset-expo'],
44
+
env: {
45
+
production: {
46
+
plugins: ['react-native-paper/babel'],
47
+
},
51
48
},
52
-
"production": {
53
-
"plugins": ["react-native-paper/babel"]
54
-
}
55
-
}
56
-
}
49
+
};
50
+
};
57
51
```
58
52
59
-
**Note:** The plugin only works if you are importing the library using ES2015 import statements and not with `require`.
53
+
The plugin only works if you are importing the library using ES2015 import statements and not with `require`.
54
+
55
+
**Note:** The above examples are for the latest `react-native` using Babel 7. If you have `react-native <= 0.55`, you'll have a `.babelrc` file instead of a `babel.config.js` file and the content of the file will be different.
60
56
61
57
If you're using Flow for typechecking your code, you need to add the following under the `[options]` section in your `.flowconfig`:
62
58
63
59
```ini
64
60
module.file_ext=.js
61
+
module.file_ext=.native.js
65
62
module.file_ext=.android.js
66
63
module.file_ext=.ios.js
67
64
```
68
65
69
66
## Usage
70
67
71
-
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.
68
+
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 an Expo project, you can do this inside the exported component in the `App.js` file.
Copy file name to clipboardExpand all lines: docs/pages/4.icons.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ title: Icons
4
4
5
5
## Configuring icons
6
6
7
-
Many of the components require the [react-native-vector-icons](https://github.com/oblador/react-native-vector-icons) library to render correctly. If you're using CRNA or Expo, you don't need to do anything extra, but if it's vanilla React Native project, you need link the library as described in the getting started guide.
7
+
Many of the components require the [react-native-vector-icons](https://github.com/oblador/react-native-vector-icons) library to render correctly. If you're using Expo, you don't need to do anything extra, but if it's vanilla React Native project, you need link the library as described in the getting started guide.
8
8
9
9
If you opted out of vector icons support using [babel-plugin-optional-require](https://github.com/satya164/babel-plugin-optional-require), you won't be able to use icon names for the icon prop anymore. Some components may not look correct without vector icons and might need extra configuration.
0 commit comments