Skip to content

Commit 5bb69bf

Browse files
committed
docs: update guides
1 parent c6680d4 commit 5bb69bf

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

docs/docs/guides/01-getting-started.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,17 @@ Specifically `MaterialDesignIcons` icon pack needs to be included in the project
3232
npm install @react-native-vector-icons/common @react-native-vector-icons/material-design-icons
3333
```
3434

35-
The library has specified dedicated steps for each platform. Please follow their [installation guide](https://github.com/oblador/react-native-vector-icons#installation) in order to properly use icon fonts.
35+
:::note
36+
The `react-native-vector-icons` library requires some additional setup steps for each platform. To ensure proper use of icon fonts, please follow their [installation guide](https://github.com/oblador/react-native-vector-icons?tab=readme-ov-file#setup).
37+
:::
3638

39+
If you use Expo, you don't need to install vector icons - those are the part of the expo package. However, if you have a `babel.config.js` or `.babelrc` file, make sure that it includes `babel-preset-expo`.
40+
41+
:::info
3742
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.
43+
:::note
3844

39-
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`.
45+
### Bundle size optimization
4046

4147
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:
4248

docs/docs/guides/03-icons.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
title: Icons
33
---
44

5-
import IconsList from '@site/src/components/IconsList.tsx';
6-
75
# Icons
86

97
## Configuring icons
108

11-
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 a vanilla React Native project, you need to link the library as described in the getting started guide.
9+
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 a vanilla React Native project, you need to link the library as described in the [getting started guide](./01-getting-started.md).
1210

11+
:::note
1312
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. Some components may not look correct without vector icons and might need extra configuration.
13+
:::
1414

1515
## Using the `icon` prop
1616

@@ -28,7 +28,6 @@ Example:
2828

2929
<details>
3030
<summary>See the list of supported icons</summary>
31-
<IconsList />
3231
</details>
3332

3433
### 2. An image source

docs/plugins/docusaurus-react-native-plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = function () {
1111
react: path.resolve('node_modules/react'),
1212
'react-native$': 'react-native-web',
1313
'react-native-paper': path.resolve('../src'),
14-
'@react-native-vector-icons/material-design-icons': path.resolve(
14+
'react-native-vector-icons/MaterialCommunityIcons': path.resolve(
1515
'node_modules/@react-native-vector-icons/material-design-icons'
1616
),
1717
},

src/components/MaterialCommunityIcon.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,8 @@ const loadIconModule = () => {
3131
return require('@react-native-vector-icons/material-design-icons')
3232
.default;
3333
} catch (e) {
34-
try {
35-
return require('react-native-vector-icons/MaterialCommunityIcons')
36-
.default;
37-
} catch (e) {
38-
return null;
39-
}
34+
return require('react-native-vector-icons/MaterialCommunityIcons')
35+
.default;
4036
}
4137
}
4238
};

0 commit comments

Comments
 (0)