@react-native-vector-icons/common 0.0.1-alpha.2 → 0.0.1-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +410 -0
- package/android/build.gradle +4 -4
- package/ios/VectorIcons.mm +83 -69
- package/lib/commonjs/NativeVectorIcons.js.map +1 -1
- package/lib/commonjs/NativeVectorIcons.web.js.map +1 -1
- package/lib/commonjs/create-icon-set.js +7 -19
- package/lib/commonjs/create-icon-set.js.map +1 -1
- package/lib/commonjs/create-icon-source-cache.js.map +1 -1
- package/lib/commonjs/ensure-native-module-available.js +1 -1
- package/lib/commonjs/ensure-native-module-available.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/scripts/common.js +49 -0
- package/lib/commonjs/scripts/common.js.map +1 -0
- package/lib/commonjs/scripts/getFonts.js +6 -40
- package/lib/commonjs/scripts/getFonts.js.map +1 -1
- package/lib/commonjs/scripts/updatePlist.js +54 -0
- package/lib/commonjs/scripts/updatePlist.js.map +1 -0
- package/lib/module/NativeVectorIcons.js.map +1 -1
- package/lib/module/NativeVectorIcons.web.js.map +1 -1
- package/lib/module/create-icon-set.js +6 -18
- package/lib/module/create-icon-set.js.map +1 -1
- package/lib/module/create-icon-source-cache.js.map +1 -1
- package/lib/module/ensure-native-module-available.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/scripts/common.js +41 -0
- package/lib/module/scripts/common.js.map +1 -0
- package/lib/module/scripts/getFonts.js +6 -39
- package/lib/module/scripts/getFonts.js.map +1 -1
- package/lib/module/scripts/updatePlist.js +49 -0
- package/lib/module/scripts/updatePlist.js.map +1 -0
- package/lib/typescript/src/NativeVectorIcons.d.ts.map +1 -1
- package/lib/typescript/src/create-icon-set.d.ts.map +1 -1
- package/lib/typescript/src/create-icon-source-cache.d.ts.map +1 -1
- package/lib/typescript/src/scripts/common.d.ts +2 -0
- package/lib/typescript/src/scripts/common.d.ts.map +1 -0
- package/lib/typescript/src/scripts/updatePlist.d.ts +3 -0
- package/lib/typescript/src/scripts/updatePlist.d.ts.map +1 -0
- package/package.json +20 -51
- package/react-native-vector-icons.podspec +54 -10
- package/src/NativeVectorIcons.ts +2 -12
- package/src/create-icon-set.tsx +19 -43
- package/src/create-icon-source-cache.ts +3 -7
- package/src/ensure-native-module-available.ts +1 -1
- package/src/scripts/common.ts +52 -0
- package/src/scripts/getFonts.ts +6 -47
- package/src/scripts/updatePlist.ts +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
[](https://npmjs.com/package/@react-native-vector-icons/common.svg) [](https://npmjs.com/package/@react-native-vector-icons/common)
|
|
4
|
+
|
|
5
|
+
# React Native Vector Icons
|
|
6
|
+
|
|
7
|
+
Elevate your React Native applications with the power of customizable vector
|
|
8
|
+
icons. Ideal for embellishing buttons, logos, and navigation or tab bars, these
|
|
9
|
+
icons seamlessly integrate into your projects. Their versatility makes
|
|
10
|
+
extension and styling effortless.
|
|
11
|
+
|
|
12
|
+
For the integration of `.svg` files natively, you can explore [`react-native-vector-image`](https://github.com/oblador/react-native-vector-image).
|
|
13
|
+
|
|
14
|
+
> [!TIP]
|
|
15
|
+
> If you are still using the old single package `react-native-vector-icons` please visit https://github.com/oblador/react-native-vector-icons/tree/legacy
|
|
16
|
+
|
|
17
|
+
## Table of Contents
|
|
18
|
+
|
|
19
|
+
- [Sponsorship](#sponsorship)
|
|
20
|
+
- [Available Icon Sets](#available-icon-sets)
|
|
21
|
+
- [Installation](#installation)
|
|
22
|
+
- [iOS Setup](#ios-setup)
|
|
23
|
+
- [macOS Setup](#macos-setup)
|
|
24
|
+
- [Windows Setup](#windows-setup)
|
|
25
|
+
- [React-native-web Setup](#react-native-web-setup)
|
|
26
|
+
- [Web Setup](#web-setup)
|
|
27
|
+
- [Icon Component](#icon-component)
|
|
28
|
+
- [Usage as PNG Image/Source Object](#usage-as-png-imagesource-object)
|
|
29
|
+
- [Multi-Style Fonts](#multi-style-fonts)
|
|
30
|
+
- [Custom Fonts](#custom-fonts)
|
|
31
|
+
- [Animation](#animation)
|
|
32
|
+
- [Usage Examples](#usage-examples)
|
|
33
|
+
- [Generating Your Own Icon Package](#generating-your-own-icon-package)
|
|
34
|
+
- [Changelog](https://github.com/react-native-vector-icons/react-native-vector-icons/releases)
|
|
35
|
+
- [License](#license)
|
|
36
|
+
|
|
37
|
+
## Sponsorship
|
|
38
|
+
|
|
39
|
+
Should you find this library beneficial, kindly contemplate the option of
|
|
40
|
+
[sponsoring](https://github.com/sponsors/oblador).
|
|
41
|
+
|
|
42
|
+
## Available Icon Sets
|
|
43
|
+
|
|
44
|
+
[Explore all icons](https://react-native-vector-icons.github.io/react-native-vector-icons/).
|
|
45
|
+
|
|
46
|
+
RNVI comes with the following supported icons. You can [search NPM](https://www.npmjs.com/search?q=keywords%3Areact-native-vector-icons-icon) for third party icons.
|
|
47
|
+
|
|
48
|
+
### Actively maintained
|
|
49
|
+
- [`AntDesign`](https://ant.design/components/icon) from Ant Group (v4.4.2 with _449_ icons)
|
|
50
|
+
- [`Feather`](http://feathericons.com) created by Cole Bemis & Contributors (v4.29.2 featuring _287_ icons)
|
|
51
|
+
- [`FontAwesome 6`](https://fontawesome.com/search) designed by Fonticons, Inc. (v6.6.0 featuring _2050_ free and _30213_ pro icons)
|
|
52
|
+
- [`Foundation`](http://zurb.com/playground/foundation-icon-fonts-3) by ZURB, Inc. (v3.0 with _283_ icons)
|
|
53
|
+
- [`Ionicons`](https://ionic.io/ionicons) crafted by Ionic (v7.4.0 containing _1356_ icons)
|
|
54
|
+
- [`MaterialDesignIcons`](https://pictogrammers.com/library/mdi/) from MaterialDesignIcons.com (v7.4.47 including _7448_ icons)
|
|
55
|
+
- [`Octicons`](https://primer.style/foundations/icons) designed by Github, Inc. (v19.11.0 with _331_ icons)
|
|
56
|
+
|
|
57
|
+
### No longer maintained upstream
|
|
58
|
+
- [`Entypo`](http://entypo.com) by Daniel Bruce (v1.0.1 with _411_ icons)
|
|
59
|
+
- [`EvilIcons`](http://evil-icons.io) designed by Alexander Madyankin & Roman Shamin (v1.10.1 with _70_ icons)
|
|
60
|
+
- [`FontAwesome`](https://fontawesome.com/v4/icons) by Fonticons, Inc. (v4.7.0 containing _785_ icons)
|
|
61
|
+
- [`FontAwesome 5`](https://fontawesome.com/v5/search) from Fonticons, Inc. (v5.15.4 offering _1611_ free and _7869_ pro icons)
|
|
62
|
+
- [`Fontisto`](https://github.com/kenangundogan/fontisto) created by Kenan Gündoğan (v3.0.4 featuring _617_ icons)
|
|
63
|
+
- [`MaterialIcons`](https://fonts.google.com/icons?icon.set=Material+Icons) by Google, Inc. (v4.0.0 featuring _2234_ icons)
|
|
64
|
+
- [`SimpleLineIcons`](https://simplelineicons.github.io/) crafted by Sabbir & Contributors (v2.5.5 with _189_ icons)
|
|
65
|
+
- [`Zocial`](https://smcllns.github.io/css-social-buttons) by Sam Collins (v1.1.1 with _100_ icons)
|
|
66
|
+
|
|
67
|
+
## Migration
|
|
68
|
+
|
|
69
|
+
See [MIGRATION.md](MIGRATION.md) if you are migrating from `react-native-vector-icons`
|
|
70
|
+
|
|
71
|
+
## Installation
|
|
72
|
+
|
|
73
|
+
1. Install the common package
|
|
74
|
+
```sh
|
|
75
|
+
npm install --save @react-native-vector-icons/common
|
|
76
|
+
```
|
|
77
|
+
1. Install the packages for the icons you want use
|
|
78
|
+
```sh
|
|
79
|
+
npm install --save @react-native-vector-icons/fontawesome6 @react-native-vector-icons/evilicons
|
|
80
|
+
```
|
|
81
|
+
1. Depending on the platform you're targeting (iOS/Android/Windows), follow the appropriate setup instructions below.
|
|
82
|
+
1. If you are using one of the following fonts refer to their guides for further instructions
|
|
83
|
+
* [FontAwesome 6](packages/fontawesome6/README.md)
|
|
84
|
+
* [FontAwesome 6 Pro](packages/fontawesome6-pro/README.md)
|
|
85
|
+
* [FontAwesome 5](packages/fontawesome5/README.md)
|
|
86
|
+
* [FontAwesome 5 Pro](packages/fontawesome5-pro/README.md)
|
|
87
|
+
* [Fontello](packages/fontello/README.md)
|
|
88
|
+
* [Icomoon](packages/icomoon/README.md)
|
|
89
|
+
|
|
90
|
+
### Android
|
|
91
|
+
|
|
92
|
+
Nothing else needed.
|
|
93
|
+
|
|
94
|
+
### iOS
|
|
95
|
+
|
|
96
|
+
To use the bundled icons on iOS, follow these steps:
|
|
97
|
+
|
|
98
|
+
1. Edit `Info.plist` and add a property called **Fonts provided by application** (or **UIAppFonts** if Xcode autocomplete is not working):
|
|
99
|
+
<details>
|
|
100
|
+
<summary>List of all available fonts to copy & paste in Info.plist</summary>
|
|
101
|
+
```xml
|
|
102
|
+
<key>UIAppFonts</key>
|
|
103
|
+
<array>
|
|
104
|
+
<string>AntDesign.ttf</string>
|
|
105
|
+
<string>Entypo.ttf</string>
|
|
106
|
+
<string>EvilIcons.ttf</string>
|
|
107
|
+
<string>Feather.ttf</string>
|
|
108
|
+
<string>FontAwesome.ttf</string>
|
|
109
|
+
<string>FontAwesome5_Brands.ttf</string>
|
|
110
|
+
<string>FontAwesome5_Regular.ttf</string>
|
|
111
|
+
<string>FontAwesome5_Solid.ttf</string>
|
|
112
|
+
<string>FontAwesome6_Brands.ttf</string>
|
|
113
|
+
<string>FontAwesome6_Regular.ttf</string>
|
|
114
|
+
<string>FontAwesome6_Solid.ttf</string>
|
|
115
|
+
<string>Fontisto.ttf</string>
|
|
116
|
+
<string>Foundation.ttf</string>
|
|
117
|
+
<string>Ionicons.ttf</string>
|
|
118
|
+
<string>MaterialDesignIcons.ttf</string>
|
|
119
|
+
<string>MaterialIcons.ttf</string>
|
|
120
|
+
<string>Octicons.ttf</string>
|
|
121
|
+
<string>SimpleLineIcons.ttf</string>
|
|
122
|
+
<string>Zocial.ttf</string>
|
|
123
|
+
</array>
|
|
124
|
+
```
|
|
125
|
+
</details>
|
|
126
|
+
|
|
127
|
+
Alternatively you can use the included script to update it for you.
|
|
128
|
+
```sh
|
|
129
|
+
npm run rnvi-update-plist packages.json ios/AppName/Info.plist
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
1. Update your pods
|
|
133
|
+
```sh
|
|
134
|
+
cd ios && pod update
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### macOS
|
|
138
|
+
|
|
139
|
+
This needs more work, see details in #1624
|
|
140
|
+
|
|
141
|
+
### Windows
|
|
142
|
+
|
|
143
|
+
TBA: It should just work???
|
|
144
|
+
|
|
145
|
+
### React-native-web Setup
|
|
146
|
+
|
|
147
|
+
To port a react-native mobile app to web using `react-native-web` you just need to ensure the fonts are known on the web-app side.
|
|
148
|
+
|
|
149
|
+
You will need add the font-family for each font you use to your css
|
|
150
|
+
|
|
151
|
+
You can debug missing font-families by looking in the Developer console in your web browser when debugging your web app.
|
|
152
|
+
|
|
153
|
+
NOTE: if you're using webpack or similar you *may* need to configure webpack to handle loading of ttf fonts, using url-loader or file-loader. See [Web Setup](#web-setup) for more details.
|
|
154
|
+
|
|
155
|
+
In your `App.css` or similar add the font-family specifications:
|
|
156
|
+
|
|
157
|
+
```css
|
|
158
|
+
@font-face {
|
|
159
|
+
src: url(path/to/fonts/Ionicons.ttf);
|
|
160
|
+
font-family: "Ionicons";
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
@font-face {
|
|
164
|
+
src: url(path/to/fonts/FontAwesome.ttf);
|
|
165
|
+
font-family: "FontAwesome";
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@font-face {
|
|
169
|
+
src: url(path/to/fonts/FontAwesome5_Brands.ttf);
|
|
170
|
+
font-family: "FontAwesome5_Brands";
|
|
171
|
+
font-weight: 400; /* Regular weight */
|
|
172
|
+
font-style: normal;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
@font-face {
|
|
176
|
+
src: url(path/to/fonts/FontAwesome5_Regular.ttf);
|
|
177
|
+
font-family: "FontAwesome5_Regular";
|
|
178
|
+
font-weight: 400; /* Regular weight */
|
|
179
|
+
font-style: normal;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@font-face {
|
|
183
|
+
src: url(path/to/fonts/FontAwesome5_Solid.ttf);
|
|
184
|
+
font-family: "FontAwesome5_Solid";
|
|
185
|
+
font-weight: 900; /* Bold weight for solid */
|
|
186
|
+
font-style: normal;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@font-face {
|
|
190
|
+
src: url(path/to/fonts/MaterialIcons.ttf);
|
|
191
|
+
font-family: "MaterialIcons";
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
@font-face {
|
|
195
|
+
src: url(path/to/fonts/Feather.ttf);
|
|
196
|
+
font-family: "Feather";
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
@font-face {
|
|
200
|
+
src: url(path/to/fonts/MaterialCommunityIcons.ttf);
|
|
201
|
+
font-family: "MaterialCommunityIcons";
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* TODO: Add other icons fonts here */
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Web Setup
|
|
208
|
+
|
|
209
|
+
FIXME: Can we improve on this?
|
|
210
|
+
|
|
211
|
+
To integrate the library with your web project using [webpack](https://webpack.js.org/), follow these steps:
|
|
212
|
+
|
|
213
|
+
1. In your webpack configuration file, add a section to handle TTF files using `url-loader` or `file-loader`:
|
|
214
|
+
|
|
215
|
+
```js
|
|
216
|
+
{
|
|
217
|
+
test: /\.ttf$/,
|
|
218
|
+
loader: "url-loader", // or directly file-loader
|
|
219
|
+
include: path.resolve(__dirname, "node_modules/react-native-vector-icons"),
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
2. In your JavaScript entry point, consume the font files and inject the necessary style tag:
|
|
224
|
+
|
|
225
|
+
```js
|
|
226
|
+
import Icon from '@react-native-vector-icons/fontAwesome';
|
|
227
|
+
|
|
228
|
+
// Generate the required CSS
|
|
229
|
+
import iconFont from '@react-native-vector-icons/fontawesome/fonts/FontAwesome.ttf';
|
|
230
|
+
const iconFontStyles = `@font-face {
|
|
231
|
+
src: url(${iconFont});
|
|
232
|
+
font-family: FontAwesome;
|
|
233
|
+
}`;
|
|
234
|
+
|
|
235
|
+
// Create a stylesheet
|
|
236
|
+
const style = document.createElement('style');
|
|
237
|
+
style.type = 'text/css';
|
|
238
|
+
|
|
239
|
+
// Append the iconFontStyles to the stylesheet
|
|
240
|
+
if (style.styleSheet) {
|
|
241
|
+
style.styleSheet.cssText = iconFontStyles;
|
|
242
|
+
} else {
|
|
243
|
+
style.appendChild(document.createTextNode(iconFontStyles));
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Inject the stylesheet into the document head
|
|
247
|
+
document.head.appendChild(style);
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
By following these steps, you will seamlessly integrate the vector icons
|
|
251
|
+
library into your web project using [webpack](https://webpack.js.org/),
|
|
252
|
+
enabling you to effortlessly use the icons within your web application.
|
|
253
|
+
|
|
254
|
+
## `Icon` Component
|
|
255
|
+
|
|
256
|
+
You can either use one of the bundled icons above or roll your own custom font.
|
|
257
|
+
|
|
258
|
+
```js
|
|
259
|
+
import Icon from '@react-native-vector-icons/fontawesome';
|
|
260
|
+
const myIcon = <Icon name="rocket" size={30} color="#900" />;
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Properties
|
|
264
|
+
|
|
265
|
+
Any [Text property](https://reactnative.dev/docs/text.html) and the following:
|
|
266
|
+
|
|
267
|
+
| Prop | Description | Default |
|
|
268
|
+
| ----------- | ----------------------------------------------------------------------- | ----------- |
|
|
269
|
+
| **`size`** | Size of the icon, can also be passed as `fontSize` in the style object. | `12` |
|
|
270
|
+
| **`name`** | What icon to show, see Icon Explorer app or one of the links above. | _None_ |
|
|
271
|
+
| **`color`** | Color of the icon. | _Inherited_ |
|
|
272
|
+
|
|
273
|
+
### Static Methods
|
|
274
|
+
|
|
275
|
+
| Prop | Description |
|
|
276
|
+
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
277
|
+
| **`getImageSource`** | Returns a promise that resolving to the source of a bitmap version of the icon for use with `Image` component et al. Usage: `const source = await Icon.getImageSource(name, size, color)` |
|
|
278
|
+
| **`getImageSourceSync`** | Same as `getImageSource` but synchronous. Usage: `const source = Icon.getImageSourceSync(name, size, color)` |
|
|
279
|
+
|
|
280
|
+
### Styling
|
|
281
|
+
|
|
282
|
+
Since `Icon` builds on top of the `Text` component, most [style properties](https://reactnative.dev/docs/style.html) will work as expected, you might find it useful to play around with these:
|
|
283
|
+
|
|
284
|
+
- `backgroundColor`
|
|
285
|
+
- `borderWidth`
|
|
286
|
+
- `borderColor`
|
|
287
|
+
- `borderRadius`
|
|
288
|
+
- `padding`
|
|
289
|
+
- `margin`
|
|
290
|
+
- `color`
|
|
291
|
+
- `fontSize`
|
|
292
|
+
|
|
293
|
+
By combining some of these you can create for example :
|
|
294
|
+
|
|
295
|
+

|
|
296
|
+

|
|
297
|
+
|
|
298
|
+
## Usage as PNG Image/Source Object
|
|
299
|
+
|
|
300
|
+
Convenient way to plug this in into other components that rely on bitmap images rather than scalable vector icons. Takes the arguments `name`, `size` and `color` as described above.
|
|
301
|
+
|
|
302
|
+
```jsx
|
|
303
|
+
const source = Icon.getImageSourceSync('user', 20, 'red');
|
|
304
|
+
return <Image source={source} />;
|
|
305
|
+
);
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
Alternatively you may use the async method `Icon.getImageSource`.
|
|
309
|
+
|
|
310
|
+
Keep in mind that `Icon.getImageSourceSync` is blocking and might incur performance penalties. Subsequent calls will use cache however.
|
|
311
|
+
|
|
312
|
+
## Multi-Style Fonts
|
|
313
|
+
|
|
314
|
+
Some fonts today use multiple styles, FontAwesome 5 for example, which is supported by this library. The usage is pretty much the same as the standard `Icon` component:
|
|
315
|
+
|
|
316
|
+
```jsx
|
|
317
|
+
import Icon from '@react-native-vector-icons/fontawesome5';
|
|
318
|
+
|
|
319
|
+
const myIcon1 = <Icon name="comments" size={30} color="#900" />; // Defaults to solid
|
|
320
|
+
const myIcon2 = <Icon name="comments" size={30} color="#900" iconType="solid" />;
|
|
321
|
+
const myIcon3 = <Icon name="comments" size={30} color="#900" iconType="light" />; // Only in FA5 Pro
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Static methods
|
|
325
|
+
|
|
326
|
+
All static methods from `Icon` is supported by multi-styled fonts.
|
|
327
|
+
|
|
328
|
+
| Prop | Description |
|
|
329
|
+
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
330
|
+
| **`getImageSource`** | Returns a promise that resolving to the source of a bitmap version of the icon for use with `Image` component et al. Usage: `const source = await Icon.getImageSource(name, size, color)` |
|
|
331
|
+
| **`getImageSourceSync`** | Same as `getImageSource` but synchronous. Usage: `const source = Icon.getImageSourceSync(name, size, color)` |
|
|
332
|
+
|
|
333
|
+
## Custom Fonts
|
|
334
|
+
|
|
335
|
+
The best approach is to use our icon generator to create your own icon package.
|
|
336
|
+
|
|
337
|
+
See [CREATE_FONT_PACKAGE.md] to learn how to create your own font packages.
|
|
338
|
+
|
|
339
|
+
You can also use `createIconSet(glyphMap, fontFamily[, fontFile])` directly in your project. This
|
|
340
|
+
returns your own custom font based on the `glyphMap` where the key is the icon
|
|
341
|
+
name and the value is either a UTF-8 character or it's character code.
|
|
342
|
+
`fontFamily` is the name of the postscript font **NOT** the filename. Open the font in
|
|
343
|
+
Font Book.app or similar to learn the name. Optionally pass the third
|
|
344
|
+
`fontFile` argument for android support, it should be the custom font file
|
|
345
|
+
name.
|
|
346
|
+
|
|
347
|
+
```js
|
|
348
|
+
import { createIconSet } from '@react-native-vector-icons/common';
|
|
349
|
+
const glyphMap = { 'icon-name': 1234, test: '∆' };
|
|
350
|
+
const Icon = createIconSet(glyphMap, 'FontName', 'font-name.ttf');
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
You should place the font ttf file into `rnvi-fonts`. You can customise this location by adding the following snippet to your package.json
|
|
354
|
+
```json
|
|
355
|
+
{
|
|
356
|
+
"reactNativeVectorIcons": {
|
|
357
|
+
"fontDir": "src/assets/fonts"
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
## Animation
|
|
363
|
+
|
|
364
|
+
React Native comes with an amazing animation library called
|
|
365
|
+
[`Animated`](https://reactnative.dev/docs/animated.html). To use it with an
|
|
366
|
+
icon, simply create an animated component with this line: `const AnimatedIcon =
|
|
367
|
+
Animated.createAnimatedComponent(Icon)`. You can also use the higher level
|
|
368
|
+
animation library
|
|
369
|
+
[react-native-animatable](https://github.com/oblador/react-native-animatable).
|
|
370
|
+
|
|
371
|
+
## Usage Examples
|
|
372
|
+
|
|
373
|
+
### Icon Explorer
|
|
374
|
+
|
|
375
|
+
Try the `IconExplorer` project in `Examples/IconExplorer` folder, there you can also search for any icon.
|
|
376
|
+
|
|
377
|
+

|
|
378
|
+
|
|
379
|
+
### Basic Example
|
|
380
|
+
|
|
381
|
+
```js
|
|
382
|
+
import Icon from '@react-native-vector-icons/ionicons';
|
|
383
|
+
|
|
384
|
+
function ExampleView(props) {
|
|
385
|
+
return <Icon name="ios-person" size={30} color="#4F8EF7" />;
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Inline Icons
|
|
390
|
+
|
|
391
|
+
```js
|
|
392
|
+
import { Text } from 'react-native';
|
|
393
|
+
import Icon from '@react-native-vector-icons/ionicons';
|
|
394
|
+
|
|
395
|
+
function ExampleView(props) {
|
|
396
|
+
return (
|
|
397
|
+
<Text>
|
|
398
|
+
Lorem <Icon name="ios-book" color="#4F8EF7" /> Ipsum
|
|
399
|
+
</Text>
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
## [Changelog](https://github.com/react-native-vector-icons/react-native-vector-icons/releases)
|
|
405
|
+
|
|
406
|
+
## License
|
|
407
|
+
|
|
408
|
+
This project is licenced under the [MIT License](http://opensource.org/licenses/mit-license.html).
|
|
409
|
+
|
|
410
|
+
Any bundled fonts are copyright to their respective authors and mostly under MIT or [SIL OFL](http://scripts.sil.org/OFL).
|
package/android/build.gradle
CHANGED
|
@@ -79,12 +79,12 @@ android {
|
|
|
79
79
|
main {
|
|
80
80
|
if (isNewArchitectureEnabled()) {
|
|
81
81
|
java.srcDirs += [
|
|
82
|
-
|
|
82
|
+
"src/newarch",
|
|
83
83
|
// This is needed to build Kotlin project with NewArch enabled
|
|
84
84
|
"${project.buildDir}/generated/source/codegen/java"
|
|
85
85
|
]
|
|
86
86
|
} else {
|
|
87
|
-
java.srcDirs += [
|
|
87
|
+
java.srcDirs += ["src/oldarch"]
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -114,12 +114,12 @@ if (isNewArchitectureEnabled()) {
|
|
|
114
114
|
android.sourceSets.main.assets.srcDirs += file("$buildDir/intermediates/RNVI")
|
|
115
115
|
|
|
116
116
|
task copyFonts(type: Exec) {
|
|
117
|
-
commandLine 'node', '../lib/commonjs/scripts/getFonts.js', rootDir.parentFile.absolutePath
|
|
117
|
+
commandLine 'node', '../lib/commonjs/scripts/getFonts.js', "${rootDir.parentFile.absolutePath}/package.json"
|
|
118
118
|
def fonts = new ByteArrayOutputStream()
|
|
119
119
|
standardOutput = fonts
|
|
120
120
|
|
|
121
121
|
doLast {
|
|
122
|
-
def files = fonts.toString().trim().split('\n')
|
|
122
|
+
def files = fonts.toString().trim().split('\n').findAll { it }
|
|
123
123
|
copy {
|
|
124
124
|
from files
|
|
125
125
|
|