Skip to content

Commit 1ff6b27

Browse files
committed
chore: update docs
1 parent 55eccf1 commit 1ff6b27

File tree

5 files changed

+71
-63
lines changed

5 files changed

+71
-63
lines changed

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ title: Getting Started
66

77
## Installation
88

9-
* Open a Terminal in your project's folder and run:
9+
- Open a Terminal in your project's folder and run:
1010

1111
```bash npm2yarn
1212
npm install react-native-paper
1313
```
1414

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.
1616

1717
```bash npm2yarn
1818
npm install react-native-safe-area-context
@@ -24,12 +24,12 @@ Additionaly for `iOS` platform there is a requirement to link the native parts o
2424
npx pod-install
2525
```
2626

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).
2828

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).
3030

3131
```bash npm2yarn
32-
npm install react-native-vector-icons
32+
npm install @react-native-vector-icons/common @react-native-vector-icons/material-design-icons
3333
```
3434

3535
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.
@@ -54,7 +54,7 @@ module.exports = {
5454
If you created your project using Expo, it'll look something like this:
5555

5656
```js
57-
module.exports = function(api) {
57+
module.exports = function (api) {
5858
api.cache(true);
5959
return {
6060
presets: ['babel-preset-expo'],
@@ -136,7 +136,10 @@ Example:
136136

137137
```js
138138
import * as React from 'react';
139-
import { MD3LightTheme as DefaultTheme, PaperProvider } from 'react-native-paper';
139+
import {
140+
MD3LightTheme as DefaultTheme,
141+
PaperProvider,
142+
} from 'react-native-paper';
140143
import App from './src/App';
141144

142145
const theme = {

docs/docs/guides/03-icons.mdx

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,16 @@ Many components such as `Button` accept an `icon` prop which is used to display
1818

1919
### 1. An icon name
2020

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.
21+
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.
2222

2323
Example:
2424

2525
```js
26-
<Button icon="camera">
27-
Press me
28-
</Button>
26+
<Button icon="camera">Press me</Button>
2927
```
3028

31-
<details><summary>See the list of supported icons</summary>
29+
<details>
30+
<summary>See the list of supported icons</summary>
3231
<IconsList />
3332
</details>
3433

@@ -39,17 +38,17 @@ You can pass an image source, such as an object of shape `{ uri: 'https://path.t
3938
Remote image:
4039

4140
```js
42-
<Button icon={{ uri: 'https://avatars0.githubusercontent.com/u/17571969?v=3&s=400' }}>
41+
<Button
42+
icon={{ uri: 'https://avatars0.githubusercontent.com/u/17571969?v=3&s=400' }}
43+
>
4344
Press me
4445
</Button>
4546
```
4647

4748
Local image:
4849

4950
```js
50-
<Button icon={require('../assets/chameleon.jpg')}>
51-
Press me
52-
</Button>
51+
<Button icon={require('../assets/chameleon.jpg')}>Press me</Button>
5352
```
5453

5554
### 3. A render function
@@ -73,22 +72,22 @@ Example:
7372

7473
### 4. Use custom icons
7574

76-
If you want to use icons other than `MaterialCommunityIcons` you need to import the icons and pass it to the `settings` prop within `PaperProvider`.
75+
If you want to use icons other than `MaterialDesignIcons` you need to import the icons and pass it to the `settings` prop within `PaperProvider`.
7776

7877
Example:
7978

8079
```js
81-
import AwesomeIcon from 'react-native-vector-icons/FontAwesome';
80+
import AwesomeIcon from '@react-native-vector-icons/fontawesome';
8281
// ...
8382

84-
<PaperProvider
85-
settings={{
86-
icon: props => <AwesomeIcon {...props} />,
87-
}}
88-
theme={this.state.theme}
89-
>
90-
// ...
91-
</PaperProvider>
83+
<PaperProvider
84+
settings={{
85+
icon: (props) => <AwesomeIcon {...props} />,
86+
}}
87+
theme={this.state.theme}
88+
>
89+
// ...
90+
</PaperProvider>;
9291
```
9392

9493
## RTL support
@@ -102,17 +101,22 @@ If you want your icon to behave properly in a RTL environment, you can pass an o
102101
Example for using an image source:
103102

104103
```js
105-
<Button icon={{ source: { uri: 'https://avatars0.githubusercontent.com/u/17571969?v=3&s=400' }, direction: 'rtl' }}>
104+
<Button
105+
icon={{
106+
source: {
107+
uri: 'https://avatars0.githubusercontent.com/u/17571969?v=3&s=400',
108+
},
109+
direction: 'rtl',
110+
}}
111+
>
106112
Press me
107113
</Button>
108114
```
109115

110116
Example for using an icon name:
111117

112118
```js
113-
<Button icon={{ source: "add-a-photo", direction: 'rtl' }}>
114-
Press me
115-
</Button>
119+
<Button icon={{ source: 'add-a-photo', direction: 'rtl' }}>Press me</Button>
116120
```
117121

118122
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 +135,8 @@ Example of using a render function:
131135
{
132136
width: size,
133137
height: size,
134-
tintColor: color
135-
}
138+
tintColor: color,
139+
},
136140
]}
137141
/>
138142
)}

docs/docs/guides/05-react-native-web.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,25 @@ module.exports = function override(config, env) {
3232
test: /\.js$/,
3333
exclude: /node_modules[/\\](?!react-native-vector-icons)/,
3434
use: {
35-
loader: "babel-loader",
35+
loader: 'babel-loader',
3636
options: {
3737
// Disable reading babel configuration
3838
babelrc: false,
3939
configFile: false,
4040

4141
// The configuration for compilation
4242
presets: [
43-
["@babel/preset-env", { useBuiltIns: "usage" }],
44-
"@babel/preset-react",
45-
"@babel/preset-flow",
46-
"@babel/preset-typescript"
43+
['@babel/preset-env', { useBuiltIns: 'usage' }],
44+
'@babel/preset-react',
45+
'@babel/preset-flow',
46+
'@babel/preset-typescript',
4747
],
4848
plugins: [
49-
"@babel/plugin-proposal-class-properties",
50-
"@babel/plugin-proposal-object-rest-spread"
51-
]
52-
}
53-
}
49+
'@babel/plugin-proposal-class-properties',
50+
'@babel/plugin-proposal-object-rest-spread',
51+
],
52+
},
53+
},
5454
});
5555

5656
return config;
@@ -102,13 +102,9 @@ module.exports = {
102102

103103
// Loaders and resolver config
104104
module: {
105-
rules: [
106-
107-
],
108-
},
109-
resolve: {
110-
105+
rules: [],
111106
},
107+
resolve: {},
112108

113109
// Development server config
114110
devServer: {
@@ -121,17 +117,22 @@ module.exports = {
121117
Also create a folder named `public` and add the following file named `index.html`:
122118

123119
```html
124-
<!doctype html>
120+
<!DOCTYPE html>
125121
<head>
126-
<meta charSet="utf-8" />
122+
<meta charset="utf-8" />
127123
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
128124

129-
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1" />
125+
<meta
126+
name="viewport"
127+
content="width=device-width,minimum-scale=1,initial-scale=1"
128+
/>
130129

131130
<title>App</title>
132131

133132
<style>
134-
html, body, #root {
133+
html,
134+
body,
135+
#root {
135136
height: 100%;
136137
}
137138
@@ -230,7 +231,7 @@ Use `asset/resource`, since `file-loader` was deprecated in webpack v5.
230231
}
231232
```
232233

233-
## Load the Material Community Icons
234+
## Load the Material Design Icons
234235

235236
If you followed the getting started guide, you should have the following code in your root component:
236237

@@ -240,16 +241,16 @@ If you followed the getting started guide, you should have the following code in
240241
</PaperProvider>
241242
```
242243

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:
244245

245246
```js
246247
<PaperProvider>
247248
<React.Fragment>
248249
{Platform.OS === 'web' ? (
249250
<style type="text/css">{`
250251
@font-face {
251-
font-family: 'MaterialCommunityIcons';
252-
src: url(${require('react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf')}) format('truetype');
252+
font-family: 'MaterialDesignIcons';
253+
src: url(${require('@react-native-vector-icons/material-design-icons/fonts/MaterialDesignIcons.ttf')}) format('truetype');
253254
}
254255
`}</style>
255256
) : null}

docs/docs/guides/09-bottom-navigation.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ navigation.jumpTo('Profile', { name: 'Michaś' });
195195

196196
```js
197197
import { createMaterialBottomTabNavigator } from 'react-native-paper/react-navigation';
198-
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
198+
import MaterialDesignIcons from '@react-native-vector-icons/material-design-icons';
199199

200200
const Tab = createMaterialBottomTabNavigator();
201201

@@ -212,7 +212,7 @@ function MyTabs() {
212212
options={{
213213
tabBarLabel: 'Home',
214214
tabBarIcon: ({ color }) => (
215-
<MaterialCommunityIcons name="home" color={color} size={26} />
215+
<MaterialDesignIcons name="home" color={color} size={26} />
216216
),
217217
}}
218218
/>
@@ -222,7 +222,7 @@ function MyTabs() {
222222
options={{
223223
tabBarLabel: 'Updates',
224224
tabBarIcon: ({ color }) => (
225-
<MaterialCommunityIcons name="bell" color={color} size={26} />
225+
<MaterialDesignIcons name="bell" color={color} size={26} />
226226
),
227227
}}
228228
/>
@@ -232,11 +232,11 @@ function MyTabs() {
232232
options={{
233233
tabBarLabel: 'Profile',
234234
tabBarIcon: ({ color }) => (
235-
<MaterialCommunityIcons name="account" color={color} size={26} />
235+
<MaterialDesignIcons name="account" color={color} size={26} />
236236
),
237237
}}
238238
/>
239239
</Tab.Navigator>
240240
);
241241
}
242-
```
242+
```

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ 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': path.resolve(
15-
'node_modules/react-native-vector-icons/dist'
14+
'@react-native-vector-icons/material-design-icons': path.resolve(
15+
'node_modules/@react-native-vector-icons/material-design-icons'
1616
),
1717
},
1818
extensions: ['.web.js'],

0 commit comments

Comments
 (0)