Skip to content

Commit 4fcf642

Browse files
committed
docs: rnvi version tabs and selection note
1 parent 0f769b5 commit 4fcf642

File tree

3 files changed

+6631
-6
lines changed

3 files changed

+6631
-6
lines changed

docs/docs/guides/03-icons.mdx

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

5+
import TabItem from '@theme/TabItem';
6+
import Tabs from '@theme/Tabs';
57
import IconsList from '@site/src/components/IconsList.tsx';
68

79
# Icons
@@ -28,10 +30,29 @@ Example:
2830
<Button icon="camera">Press me</Button>
2931
```
3032

31-
<details>
32-
<summary>See the list of supported icons</summary>
33-
<IconsList />
34-
</details>
33+
:::note
34+
Choose the correct tab below based on your `react-native-vector-icons` version:
35+
36+
- Use **latest** tab if you're using the latest version of `@react-native-vector-icons/material-design-icons`
37+
- Use **10.x** tab if you're still using the old single package `react-native-vector-icons`, version `10.x`
38+
39+
If you are using `@expo/vector-icons`, please check their [searchable list of icons](https://icons.expo.fyi/).
40+
:::
41+
42+
<Tabs>
43+
<TabItem value="material-design-icons" label="latest">
44+
<details>
45+
<summary>See the list of supported icons</summary>
46+
<IconsList latest />
47+
</details>
48+
</TabItem>
49+
<TabItem value="material-community-icons" label="10.x">
50+
<details>
51+
<summary>See the list of supported icons</summary>
52+
<IconsList />
53+
</details>
54+
</TabItem>
55+
</Tabs>
3556

3657
### 2. An image source
3758

docs/src/components/IconsList.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
import React, { useState } from 'react';
22

3-
const icons: { [key in string]: number } = {
3+
const latestIcons: { [key in string]: number } = {
44
...require('../../node_modules/@react-native-vector-icons/material-design-icons/glyphmaps/MaterialDesignIcons.json'),
55
};
66

7-
export default function IconsList() {
7+
const oldIcons: { [key in string]: number } = {
8+
...require('../utils/MaterialCommunityIcons.json'),
9+
};
10+
11+
export default function IconsList({ latest }: { latest?: boolean }) {
12+
const icons = latest ? latestIcons : oldIcons;
13+
814
const [query, setQuery] = useState('');
915

1016
const iconNames = Object.keys(icons).filter(

0 commit comments

Comments
 (0)