@refineui/react-native-icons 0.1.4
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 +468 -0
- package/package.json +45 -0
- package/src/metadata.json +37709 -0
package/README.md
ADDED
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
# @refineui/react-native-icons
|
|
2
|
+
|
|
3
|
+
React Native components for RefineUI System Icons with TypeScript support.
|
|
4
|
+
|
|
5
|
+
## 📦 Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @refineui/react-native-icons
|
|
9
|
+
# or
|
|
10
|
+
yarn add @refineui/react-native-icons
|
|
11
|
+
# or
|
|
12
|
+
pnpm add @refineui/react-native-icons
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 🚀 Quick Start
|
|
16
|
+
|
|
17
|
+
### Basic Usage
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import React from "react";
|
|
21
|
+
import { View, Text } from "react-native";
|
|
22
|
+
import { Icon } from "@refineui/react-native-icons";
|
|
23
|
+
|
|
24
|
+
function App() {
|
|
25
|
+
return (
|
|
26
|
+
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
|
|
27
|
+
{/* Basic usage */}
|
|
28
|
+
<Icon name="home" size={24} />
|
|
29
|
+
|
|
30
|
+
{/* With custom color */}
|
|
31
|
+
<Icon name="search" size={20} color="#0078d4" />
|
|
32
|
+
|
|
33
|
+
{/* With custom style */}
|
|
34
|
+
<Icon name="settings" size={16} style={{ marginTop: 10 }} />
|
|
35
|
+
|
|
36
|
+
{/* With onPress handler */}
|
|
37
|
+
<Icon
|
|
38
|
+
name="heart"
|
|
39
|
+
size={24}
|
|
40
|
+
onPress={() => console.log("Heart pressed!")}
|
|
41
|
+
style={{ marginTop: 10 }}
|
|
42
|
+
/>
|
|
43
|
+
</View>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default App;
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Touchable Icon
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import { Icon } from "@refineui/react-native-icons";
|
|
54
|
+
|
|
55
|
+
function TouchableIcon() {
|
|
56
|
+
return (
|
|
57
|
+
<Icon
|
|
58
|
+
name="star"
|
|
59
|
+
size={24}
|
|
60
|
+
onPress={() => console.log("Star pressed!")}
|
|
61
|
+
style={{
|
|
62
|
+
padding: 8,
|
|
63
|
+
borderRadius: 4,
|
|
64
|
+
backgroundColor: "#f0f0f0",
|
|
65
|
+
}}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 🎨 Available Icons
|
|
72
|
+
|
|
73
|
+
### Icon Categories
|
|
74
|
+
|
|
75
|
+
- **Navigation**: `home`, `search`, `menu`, `back`, `forward`, `up`, `down`, `left`, `right`
|
|
76
|
+
- **Actions**: `add`, `edit`, `delete`, `save`, `cancel`, `refresh`, `download`, `upload`
|
|
77
|
+
- **Communication**: `mail`, `phone`, `chat`, `notification`, `bell`, `message`
|
|
78
|
+
- **Media**: `play`, `pause`, `stop`, `volume`, `mute`, `camera`, `image`, `video`
|
|
79
|
+
- **System**: `settings`, `gear`, `user`, `lock`, `unlock`, `key`, `shield`
|
|
80
|
+
- **Files**: `folder`, `file`, `document`, `image`, `pdf`, `zip`, `download`
|
|
81
|
+
- **And many more...** (434+ icons total)
|
|
82
|
+
|
|
83
|
+
### Icon Sizes
|
|
84
|
+
|
|
85
|
+
- **16px**: `size={16}`
|
|
86
|
+
- **20px**: `size={20}`
|
|
87
|
+
- **24px**: `size={24}` (default)
|
|
88
|
+
- **32px**: `size={32}`
|
|
89
|
+
- **48px**: `size={48}`
|
|
90
|
+
|
|
91
|
+
## 🔧 Advanced Usage
|
|
92
|
+
|
|
93
|
+
### TypeScript Support
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
import { Icon, IconProps } from "@refineui/react-native-icons";
|
|
97
|
+
|
|
98
|
+
interface MyComponentProps {
|
|
99
|
+
iconName: IconProps["name"];
|
|
100
|
+
iconSize?: IconProps["size"];
|
|
101
|
+
iconColor?: IconProps["color"];
|
|
102
|
+
iconStyle?: IconProps["iconStyle"];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function MyComponent({ iconName, iconSize = 24, iconColor }: MyComponentProps) {
|
|
106
|
+
return <Icon name={iconName} size={iconSize} color={iconColor} />;
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Custom Styling
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
import { Icon } from "@refineui/react-native-icons";
|
|
114
|
+
|
|
115
|
+
function CustomIcon() {
|
|
116
|
+
return (
|
|
117
|
+
<Icon
|
|
118
|
+
name="star"
|
|
119
|
+
size={24}
|
|
120
|
+
color="#ffd700"
|
|
121
|
+
style={{
|
|
122
|
+
shadowColor: "#000",
|
|
123
|
+
shadowOffset: { width: 0, height: 2 },
|
|
124
|
+
shadowOpacity: 0.25,
|
|
125
|
+
shadowRadius: 3.84,
|
|
126
|
+
elevation: 5,
|
|
127
|
+
}}
|
|
128
|
+
/>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Dynamic Icon Selection
|
|
134
|
+
|
|
135
|
+
```tsx
|
|
136
|
+
import { Icon } from "@refineui/react-native-icons";
|
|
137
|
+
|
|
138
|
+
function DynamicIcon({
|
|
139
|
+
iconType,
|
|
140
|
+
}: {
|
|
141
|
+
iconType: "home" | "search" | "settings";
|
|
142
|
+
}) {
|
|
143
|
+
const iconConfig = {
|
|
144
|
+
home: { name: "home", color: "#0078d4" },
|
|
145
|
+
search: { name: "search", color: "#107c10" },
|
|
146
|
+
settings: { name: "settings", color: "#d83b01" },
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const config = iconConfig[iconType];
|
|
150
|
+
|
|
151
|
+
return <Icon name={config.name} size={24} color={config.color} />;
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## 🎯 Best Practices
|
|
156
|
+
|
|
157
|
+
### 1. **Performance Optimization**
|
|
158
|
+
|
|
159
|
+
- Use consistent icon sizes throughout your app
|
|
160
|
+
- Avoid unnecessary re-renders by memoizing icon components
|
|
161
|
+
- Consider using `useMemo` for dynamic icon selection
|
|
162
|
+
|
|
163
|
+
```tsx
|
|
164
|
+
import React, { useMemo } from "react";
|
|
165
|
+
import { Icon } from "@refineui/react-native-icons";
|
|
166
|
+
|
|
167
|
+
function OptimizedIcon({ iconName, size = 24 }) {
|
|
168
|
+
const iconProps = useMemo(
|
|
169
|
+
() => ({
|
|
170
|
+
name: iconName,
|
|
171
|
+
size,
|
|
172
|
+
color: "#0078d4",
|
|
173
|
+
}),
|
|
174
|
+
[iconName, size]
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
return <Icon {...iconProps} />;
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### 2. **Accessibility**
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
import { Icon } from "@refineui/react-native-icons";
|
|
185
|
+
|
|
186
|
+
function AccessibleIcon() {
|
|
187
|
+
return (
|
|
188
|
+
<Icon
|
|
189
|
+
name="search"
|
|
190
|
+
size={24}
|
|
191
|
+
accessible={true}
|
|
192
|
+
accessibilityLabel="Search"
|
|
193
|
+
accessibilityRole="button"
|
|
194
|
+
accessibilityHint="Double tap to search"
|
|
195
|
+
/>
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### 3. **Responsive Design**
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
import { Icon } from "@refineui/react-native-icons";
|
|
204
|
+
import { Dimensions } from "react-native";
|
|
205
|
+
|
|
206
|
+
function ResponsiveIcon() {
|
|
207
|
+
const { width } = Dimensions.get("window");
|
|
208
|
+
const iconSize = width < 768 ? 20 : 24;
|
|
209
|
+
|
|
210
|
+
return <Icon name="menu" size={iconSize} />;
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### 4. **Theme Integration**
|
|
215
|
+
|
|
216
|
+
```tsx
|
|
217
|
+
import { Icon } from "@refineui/react-native-icons";
|
|
218
|
+
import { useTheme } from "@react-navigation/native";
|
|
219
|
+
|
|
220
|
+
function ThemedIcon({ name, size = 24 }) {
|
|
221
|
+
const theme = useTheme();
|
|
222
|
+
|
|
223
|
+
return <Icon name={name} size={size} color={theme.colors.primary} />;
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## 📱 Platform-Specific Features
|
|
228
|
+
|
|
229
|
+
### iOS Specific
|
|
230
|
+
|
|
231
|
+
```tsx
|
|
232
|
+
import { Icon } from "@refineui/react-native-icons";
|
|
233
|
+
import { Platform } from "react-native";
|
|
234
|
+
|
|
235
|
+
function PlatformIcon() {
|
|
236
|
+
return (
|
|
237
|
+
<Icon
|
|
238
|
+
name="settings"
|
|
239
|
+
size={24}
|
|
240
|
+
color={Platform.OS === "ios" ? "#007AFF" : "#0078d4"}
|
|
241
|
+
/>
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Android Specific
|
|
247
|
+
|
|
248
|
+
```tsx
|
|
249
|
+
import { Icon } from "@refineui/react-native-icons";
|
|
250
|
+
import { Platform } from "react-native";
|
|
251
|
+
|
|
252
|
+
function AndroidIcon() {
|
|
253
|
+
return (
|
|
254
|
+
<Icon
|
|
255
|
+
name="menu"
|
|
256
|
+
size={24}
|
|
257
|
+
color={Platform.OS === "android" ? "#6200EA" : "#0078d4"}
|
|
258
|
+
/>
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## 🎨 Styling Examples
|
|
264
|
+
|
|
265
|
+
### Navigation Bar Icons
|
|
266
|
+
|
|
267
|
+
```tsx
|
|
268
|
+
import { Icon } from "@refineui/react-native-icons";
|
|
269
|
+
import { View, StyleSheet } from "react-native";
|
|
270
|
+
|
|
271
|
+
function NavigationBar() {
|
|
272
|
+
return (
|
|
273
|
+
<View style={styles.navBar}>
|
|
274
|
+
<Icon name="menu" size={24} style={styles.navIcon} />
|
|
275
|
+
<Icon name="search" size={20} style={styles.navIcon} />
|
|
276
|
+
<Icon name="notification" size={20} style={styles.navIcon} />
|
|
277
|
+
<Icon name="user" size={20} style={styles.navIcon} />
|
|
278
|
+
</View>
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const styles = StyleSheet.create({
|
|
283
|
+
navBar: {
|
|
284
|
+
flexDirection: "row",
|
|
285
|
+
justifyContent: "space-around",
|
|
286
|
+
alignItems: "center",
|
|
287
|
+
paddingVertical: 10,
|
|
288
|
+
backgroundColor: "#fff",
|
|
289
|
+
borderBottomWidth: 1,
|
|
290
|
+
borderBottomColor: "#e0e0e0",
|
|
291
|
+
},
|
|
292
|
+
navIcon: {
|
|
293
|
+
padding: 8,
|
|
294
|
+
},
|
|
295
|
+
});
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Button with Icon
|
|
299
|
+
|
|
300
|
+
```tsx
|
|
301
|
+
import { Icon } from "@refineui/react-native-icons";
|
|
302
|
+
import { TouchableOpacity, Text, StyleSheet } from "react-native";
|
|
303
|
+
|
|
304
|
+
function IconButton({ iconName, title, onPress }) {
|
|
305
|
+
return (
|
|
306
|
+
<TouchableOpacity style={styles.button} onPress={onPress}>
|
|
307
|
+
<Icon name={iconName} size={16} color="#fff" />
|
|
308
|
+
<Text style={styles.buttonText}>{title}</Text>
|
|
309
|
+
</TouchableOpacity>
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const styles = StyleSheet.create({
|
|
314
|
+
button: {
|
|
315
|
+
flexDirection: "row",
|
|
316
|
+
alignItems: "center",
|
|
317
|
+
backgroundColor: "#0078d4",
|
|
318
|
+
paddingHorizontal: 16,
|
|
319
|
+
paddingVertical: 8,
|
|
320
|
+
borderRadius: 4,
|
|
321
|
+
},
|
|
322
|
+
buttonText: {
|
|
323
|
+
color: "#fff",
|
|
324
|
+
marginLeft: 8,
|
|
325
|
+
fontSize: 16,
|
|
326
|
+
},
|
|
327
|
+
});
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### Icon Grid
|
|
331
|
+
|
|
332
|
+
```tsx
|
|
333
|
+
import { Icon } from "@refineui/react-native-icons";
|
|
334
|
+
import { View, Text, StyleSheet, FlatList } from "react-native";
|
|
335
|
+
|
|
336
|
+
function IconGrid() {
|
|
337
|
+
const icons = [
|
|
338
|
+
{ name: "home", label: "Home" },
|
|
339
|
+
{ name: "search", label: "Search" },
|
|
340
|
+
{ name: "settings", label: "Settings" },
|
|
341
|
+
{ name: "user", label: "User" },
|
|
342
|
+
{ name: "mail", label: "Mail" },
|
|
343
|
+
{ name: "phone", label: "Phone" },
|
|
344
|
+
];
|
|
345
|
+
|
|
346
|
+
const renderIcon = ({ item }) => (
|
|
347
|
+
<View style={styles.iconItem}>
|
|
348
|
+
<Icon name={item.name} size={24} />
|
|
349
|
+
<Text style={styles.iconLabel}>{item.label}</Text>
|
|
350
|
+
</View>
|
|
351
|
+
);
|
|
352
|
+
|
|
353
|
+
return (
|
|
354
|
+
<FlatList
|
|
355
|
+
data={icons}
|
|
356
|
+
renderItem={renderIcon}
|
|
357
|
+
keyExtractor={(item) => item.name}
|
|
358
|
+
numColumns={3}
|
|
359
|
+
contentContainerStyle={styles.grid}
|
|
360
|
+
/>
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
const styles = StyleSheet.create({
|
|
365
|
+
grid: {
|
|
366
|
+
padding: 16,
|
|
367
|
+
},
|
|
368
|
+
iconItem: {
|
|
369
|
+
flex: 1,
|
|
370
|
+
alignItems: "center",
|
|
371
|
+
padding: 16,
|
|
372
|
+
margin: 4,
|
|
373
|
+
backgroundColor: "#f5f5f5",
|
|
374
|
+
borderRadius: 8,
|
|
375
|
+
},
|
|
376
|
+
iconLabel: {
|
|
377
|
+
marginTop: 8,
|
|
378
|
+
fontSize: 12,
|
|
379
|
+
textAlign: "center",
|
|
380
|
+
},
|
|
381
|
+
});
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
## 🔍 Icon Search and Discovery
|
|
385
|
+
|
|
386
|
+
### Finding Icons by Category
|
|
387
|
+
|
|
388
|
+
```tsx
|
|
389
|
+
const iconCategories = {
|
|
390
|
+
navigation: ["home", "search", "menu", "back", "forward"],
|
|
391
|
+
actions: ["add", "edit", "delete", "save", "cancel"],
|
|
392
|
+
communication: ["mail", "phone", "chat", "notification"],
|
|
393
|
+
media: ["play", "pause", "stop", "volume", "camera"],
|
|
394
|
+
system: ["settings", "gear", "user", "lock", "unlock"],
|
|
395
|
+
files: ["folder", "file", "document", "image", "pdf"],
|
|
396
|
+
};
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### Icon Search Function
|
|
400
|
+
|
|
401
|
+
```tsx
|
|
402
|
+
function searchIcons(query: string) {
|
|
403
|
+
const allIcons = Object.values(iconCategories).flat();
|
|
404
|
+
return allIcons.filter((icon) =>
|
|
405
|
+
icon.toLowerCase().includes(query.toLowerCase())
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// Usage
|
|
410
|
+
const searchResults = searchIcons("home");
|
|
411
|
+
// Returns: ['home']
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
## 🛠️ Development
|
|
415
|
+
|
|
416
|
+
### Building from Source
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
# Clone the repository
|
|
420
|
+
git clone https://github.com/refineui/system-icons.git
|
|
421
|
+
cd system-icons
|
|
422
|
+
|
|
423
|
+
# Install dependencies
|
|
424
|
+
npm install
|
|
425
|
+
|
|
426
|
+
# Build React Native icons
|
|
427
|
+
npm run generate:react-native
|
|
428
|
+
npm run build:react-native
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
### Adding New Icons
|
|
432
|
+
|
|
433
|
+
1. Add SVG files to `src/icons/`
|
|
434
|
+
2. Run `npm run generate:metadata`
|
|
435
|
+
3. Run `npm run generate:react-native`
|
|
436
|
+
4. Test your changes in React Native app
|
|
437
|
+
|
|
438
|
+
## 🐛 Troubleshooting
|
|
439
|
+
|
|
440
|
+
### Common Issues
|
|
441
|
+
|
|
442
|
+
1. **Icon not displaying**
|
|
443
|
+
|
|
444
|
+
- Check if the icon name is correct
|
|
445
|
+
- Verify the package is installed
|
|
446
|
+
- Check Metro bundler logs
|
|
447
|
+
|
|
448
|
+
2. **Performance issues**
|
|
449
|
+
|
|
450
|
+
- Use `useMemo` for dynamic icon selection
|
|
451
|
+
- Avoid unnecessary re-renders
|
|
452
|
+
- Consider using `React.memo` for icon components
|
|
453
|
+
|
|
454
|
+
3. **Styling issues**
|
|
455
|
+
- Check for conflicting styles
|
|
456
|
+
- Verify style properties are supported
|
|
457
|
+
- Use `StyleSheet.create` for better performance
|
|
458
|
+
|
|
459
|
+
### Getting Help
|
|
460
|
+
|
|
461
|
+
- 📧 Email: support@refineui.com
|
|
462
|
+
- 🐛 Issues: [GitHub Issues](https://github.com/refineui/system-icons/issues)
|
|
463
|
+
- 📖 Documentation: [docs.refineui.com](https://docs.refineui.com)
|
|
464
|
+
- 💬 Community: [Discord](https://discord.gg/refineui)
|
|
465
|
+
|
|
466
|
+
## 📄 License
|
|
467
|
+
|
|
468
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@refineui/react-native-icons",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "RefineUI System Icons for React Native",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"src/metadata.json"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "rollup -c && npm run copy-fonts",
|
|
14
|
+
"copy-fonts": "mkdir -p dist/fonts && cp fonts/*.woff2 dist/fonts/ && cp fonts/*.css dist/fonts/",
|
|
15
|
+
"dev": "rollup -c -w",
|
|
16
|
+
"clean": "rimraf dist"
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"react": ">=16.8.0",
|
|
20
|
+
"react-native": ">=0.60.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@rollup/plugin-commonjs": "^21.0.0",
|
|
24
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
25
|
+
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
26
|
+
"@types/react": "^18.0.0",
|
|
27
|
+
"rimraf": "^3.0.2",
|
|
28
|
+
"rollup": "^2.60.0",
|
|
29
|
+
"rollup-plugin-typescript2": "^0.31.0",
|
|
30
|
+
"typescript": "^4.5.0"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"react-native",
|
|
34
|
+
"icons",
|
|
35
|
+
"refineui",
|
|
36
|
+
"system-icons",
|
|
37
|
+
"ui"
|
|
38
|
+
],
|
|
39
|
+
"author": "RefineUI Team",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "https://github.com/refineui/system-icons.git"
|
|
44
|
+
}
|
|
45
|
+
}
|