@@ -11,8 +11,10 @@ import {
1111 useWindowDimensions ,
1212 Button
1313} from 'react-native' ;
14- import * as IconPack from '@mrkpatchaa/react-native-ionicons' ;
15- const { IconContext, ...Icons } = IconPack ;
14+ import { Icon } from '@mrkpatchaa/react-native-ionicons' ;
15+ import { Icons } from '@mrkpatchaa/react-native-ionicons/src/map' ;
16+
17+ const names = Object . keys ( Icons ) ;
1618
1719function PickerItem ( { tag, selection, setSelection} ) {
1820 return (
@@ -39,7 +41,7 @@ const App = () => {
3941 const iconSize = ( width - 6 * 32 ) / 5 ;
4042 const [ color , setColor ] = useState ( '' ) ;
4143 const [ display , setDisplay ] = useState ( 'grid' ) ;
42- const [ mirrorActive , setMirrorActive ] = useState ( false ) ;
44+ const [ iconStyle , setIconStyle ] = useState ( 'outline' ) ;
4345
4446 return (
4547 < SafeAreaView style = { { flex : 1 } } >
@@ -81,7 +83,7 @@ const App = () => {
8183 maxLength = { 6 }
8284 />
8385 < View style = { { flex : 1 } } />
84- { /* <PickerItem
86+ < PickerItem
8587 tag = "outline"
8688 selection = { iconStyle }
8789 setSelection = { setIconStyle }
@@ -95,25 +97,26 @@ const App = () => {
9597 tag = "sharp"
9698 selection = { iconStyle }
9799 setSelection = { setIconStyle }
98- /> */ }
100+ />
99101 </ View >
100102 < FlatList
101103 contentContainerStyle = { { paddingHorizontal : 16 } }
102104 numColumns = { display === 'grid' ? 5 : 1 }
103- data = { Object . entries ( Icons ) . filter ( ( [ , Icon ] ) => ! ! Icon ) }
104- keyExtractor = { ( item ) => item [ 0 ] }
105+ data = { names . filter ( item => iconStyle === 'filled' && ! ( item . endsWith ( '-outline' ) || item . endsWith ( '-sharp' ) ) || item . endsWith ( `- ${ iconStyle } ` ) ) }
106+ keyExtractor = { item => item }
105107 key = { display }
106- renderItem = { ( { item : [ name , Icon ] } ) => (
108+ renderItem = { ( { item} ) => {
109+ return (
107110 < View style = { { padding : 16 , alignItems :'center' , flexDirection : display === 'list' ? 'row' : 'column' } } >
108111 < Icon
112+ name = { item }
109113 size = { iconSize }
110114 color = { color . length !== 6 ? '#000' : '#' + color }
111- mirrored = { mirrorActive }
112115 />
113- { display === 'list' && < Text style = { { marginLeft : 5 } } > { name } </ Text > }
116+ { display === 'list' && < Text style = { { marginLeft : 5 } } > { item } </ Text > }
114117 </ View >
115- )
116- }
118+ ) ;
119+ } }
117120 />
118121 </ SafeAreaView >
119122 ) ;
0 commit comments