react-native-btr
Advanced tools
+1
-1
| MIT License | ||
| Copyright (c) 2021 Thakur Ballary | ||
| Copyright (c) 2022 Thakur Ballary | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
+3
-3
| { | ||
| "name": "react-native-btr", | ||
| "version": "2.1.4", | ||
| "version": "2.2.0", | ||
| "description": "React Native UI Components", | ||
@@ -34,5 +34,5 @@ "main": "src/index.ts", | ||
| "react-native-modal": "^13.0.1", | ||
| "react-native-radio-buttons-group": "^2.2.10", | ||
| "react-native-vector-icons": "^9.1.0" | ||
| "react-native-radio-buttons-group": "^2.2.11", | ||
| "react-native-vector-icons": "^9.2.0" | ||
| } | ||
| } |
@@ -1,25 +0,51 @@ | ||
| import React from "react"; | ||
| import { FlatList, TouchableOpacity, StyleSheet } from "react-native"; | ||
| import Icon from "react-native-vector-icons/MaterialIcons"; | ||
| import React from 'react'; | ||
| import { FlatList, TouchableOpacity, StyleSheet } from 'react-native'; | ||
| import { | ||
| AntDesign, | ||
| Entypo, | ||
| EvilIcons, | ||
| Feather, | ||
| FontAwesome, | ||
| FontAwesome5, | ||
| Fontisto, | ||
| Foundation, | ||
| Ionicons, | ||
| MaterialIcons, | ||
| MaterialCommunityIcons, | ||
| Octicons, | ||
| Zocial, | ||
| SimpleLineIcons, | ||
| } from 'react-native-vector-icons'; | ||
| export type Icon = { | ||
| name: string; | ||
| type?: string; | ||
| }; | ||
| export type IconPickerProps = { | ||
| icons?: string[]; | ||
| onSelect?: (icon: string) => void; | ||
| selectedIcon?: string; | ||
| icons?: Icon[]; | ||
| onSelect?: (icon: Icon) => void; | ||
| selectedIcon?: Icon; | ||
| }; | ||
| const defaultIcons = [ | ||
| { type: 'FontAwesome', name: 'comments' }, | ||
| { type: 'FontAwesome', name: 'font' }, | ||
| { type: 'FontAwesome', name: 'font-awesome' }, | ||
| { type: 'FontAwesome', name: 'rocket' }, | ||
| { type: 'MaterialCommunityIcons', name: 'account-circle' }, | ||
| { type: 'MaterialCommunityIcons', name: 'alarm' }, | ||
| { type: 'MaterialCommunityIcons', name: 'apps' }, | ||
| { type: 'MaterialCommunityIcons', name: 'attachment' }, | ||
| { type: 'MaterialCommunityIcons', name: 'autorenew' }, | ||
| { type: 'MaterialCommunityIcons', name: 'check' }, | ||
| { type: 'MaterialCommunityIcons', name: 'close' }, | ||
| { type: 'MaterialCommunityIcons', name: 'layers' }, | ||
| { type: 'MaterialCommunityIcons', name: 'star' }, | ||
| ] | ||
| export function IconPicker({ | ||
| icons = [ | ||
| "account-circle", | ||
| "alarm", | ||
| "apps", | ||
| "attachment", | ||
| "autorenew", | ||
| "check", | ||
| "close", | ||
| "layers", | ||
| "star", | ||
| ], | ||
| onSelect = (icon: string) => {}, | ||
| selectedIcon = "account-circle", | ||
| icons = defaultIcons, | ||
| onSelect = (icon: Icon) => {}, | ||
| selectedIcon = defaultIcons[0], | ||
| }: IconPickerProps) { | ||
@@ -39,6 +65,19 @@ return ( | ||
| > | ||
| <Icon name={item} style={styles.icon} /> | ||
| {item.type === 'AntDesign' && <AntDesign name={item.name} style={styles.icon} />} | ||
| {item.type === 'Entypo' && <Entypo name={item.name} style={styles.icon} />} | ||
| {item.type === 'EvilIcons' && <EvilIcons name={item.name} style={styles.icon} />} | ||
| {item.type === 'Feather' && <Feather name={item.name} style={styles.icon} />} | ||
| {item.type === 'FontAwesome' && <FontAwesome name={item.name} style={styles.icon} />} | ||
| {item.type === 'FontAwesome5' && <FontAwesome5 name={item.name} style={styles.icon} />} | ||
| {item.type === 'Fontisto' && <Fontisto name={item.name} style={styles.icon} />} | ||
| {item.type === 'Foundation' && <Foundation name={item.name} style={styles.icon} />} | ||
| {item.type === 'Ionicons' && <Ionicons name={item.name} style={styles.icon} />} | ||
| {item.type === 'MaterialIcons' && <MaterialIcons name={item.name} style={styles.icon} />} | ||
| {item.type === 'MaterialCommunityIcons' && <MaterialCommunityIcons name={item.name} style={styles.icon} />} | ||
| {item.type === 'Octicons' && <Octicons name={item.name} style={styles.icon} />} | ||
| {item.type === 'Zocial' && <Zocial name={item.name} style={styles.icon} />} | ||
| {item.type === 'SimpleLineIcons' && <SimpleLineIcons name={item.name} style={styles.icon} />} | ||
| </TouchableOpacity> | ||
| )} | ||
| keyExtractor={(item, index) => "key" + index} | ||
| keyExtractor={(item: Icon) => item.type + item.name} | ||
| horizontal={true} | ||
@@ -45,0 +84,0 @@ keyboardShouldPersistTaps="always" |
19743
12.06%458
8.79%