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/docs/guides/01-getting-started.md
+18-9Lines changed: 18 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,13 +6,13 @@ title: Getting Started
6
6
7
7
## Installation
8
8
9
-
* Open a Terminal in your project's folder and run:
9
+
- Open a Terminal in your project's folder and run:
10
10
11
11
```bash npm2yarn
12
12
npm install react-native-paper
13
13
```
14
14
15
-
* From `v5` there is a need to install [react-native-safe-area-context](https://github.com/th3rdwave/react-native-safe-area-context) for handling safe area.
15
+
- From `v5` there is a need to install [react-native-safe-area-context](https://github.com/th3rdwave/react-native-safe-area-context) for handling safe area.
16
16
17
17
```bash npm2yarn
18
18
npm install react-native-safe-area-context
@@ -24,19 +24,25 @@ Additionaly for `iOS` platform there is a requirement to link the native parts o
24
24
npx pod-install
25
25
```
26
26
27
-
* If you're on a vanilla React Native project, you also need to install and link [react-native-vector-icons](https://github.com/oblador/react-native-vector-icons).
27
+
- If you're on a vanilla React Native project, you also need to install and link [@react-native-vector-icons/common](https://github.com/oblador/react-native-vector-icons).
28
28
29
-
Specifically `MaterialCommunityIcons` icon pack needs to be included in the project, because some components use those internally (e.g. `AppBar.BackAction` on Android).
29
+
Specifically `MaterialDesignIcons` icon pack needs to be included in the project, because some components use those internally (e.g. `AppBar.BackAction` on Android).
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
+
:::
36
38
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
37
42
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
38
44
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
40
46
41
47
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:
42
48
@@ -54,7 +60,7 @@ module.exports = {
54
60
If you created your project using Expo, it'll look something like this:
Copy file name to clipboardExpand all lines: docs/docs/guides/03-icons.mdx
+32-26Lines changed: 32 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,27 +8,28 @@ import IconsList from '@site/src/components/IconsList.tsx';
8
8
9
9
## Configuring icons
10
10
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.
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](./01-getting-started.md).
12
12
13
+
:::note
13
14
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.
15
+
:::
14
16
15
17
## Using the `icon` prop
16
18
17
19
Many components such as `Button` accept an `icon` prop which is used to display an icon. The `icon` prop supports the following types of values:
18
20
19
21
### 1. An icon name
20
22
21
-
You can pass the name of an icon from [`MaterialCommunityIcons`](https://materialdesignicons.com). This will use the [`react-native-vector-icons`](https://github.com/oblador/react-native-vector-icons) library to display the icon.
23
+
You can pass the name of an icon from [`MaterialDesignIcons`](https://pictogrammers.com/library/mdi/). This will use the [`@react-native-vector-icons/material-design-icons`](https://github.com/oblador/react-native-vector-icons/tree/master/packages/material-design-icons) library to display the icon.
22
24
23
25
Example:
24
26
25
27
```js
26
-
<Button icon="camera">
27
-
Press me
28
-
</Button>
28
+
<Button icon="camera">Press me</Button>
29
29
```
30
30
31
-
<details><summary>See the list of supported icons</summary>
31
+
<details>
32
+
<summary>See the list of supported icons</summary>
32
33
<IconsList />
33
34
</details>
34
35
@@ -39,17 +40,17 @@ You can pass an image source, such as an object of shape `{ uri: 'https://path.t
You can also use a render function. Along with `size` and `color`, you have access to `direction` which will either be `'rtl'` or `'ltr'`. You can then decide how to render your icon component accordingly.
@@ -131,8 +137,8 @@ Example of using a render function:
@@ -230,7 +231,7 @@ Use `asset/resource`, since `file-loader` was deprecated in webpack v5.
230
231
}
231
232
```
232
233
233
-
## Load the Material Community Icons
234
+
## Load the Material Design Icons
234
235
235
236
If you followed the getting started guide, you should have the following code in your root component:
236
237
@@ -240,16 +241,16 @@ If you followed the getting started guide, you should have the following code in
240
241
</PaperProvider>
241
242
```
242
243
243
-
Now we need tweak this section to load the Material Community Icons from the [`react-native-vector-icons`](https://github.com/oblador/react-native-vector-icons) library:
244
+
Now we need tweak this section to load the Material Design Icons from the [`react-native-vector-icons`](https://github.com/oblador/react-native-vector-icons) library:
0 commit comments