Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Ionicons: Icon props?

So I am writing a functional component right, I written a props.
So I wanted it to able to auto suggest name attributes. Something like this

import { Ionicons } from "@expo/vector-icons";

export interface ownWrittenProps {
  leftIcon?: ????????;
}

so when people start typing <FunctionalComponent leftIcon=" it can suggest the acceptable icon names from Ionicons the reason I want to use it because it pack into the ios/apk package anyway. What should I put in ???????? so that it can suggest the name?

Another question, if I have a textbox in my ChildComponent how do I retrieve the text/value from parent?

like image 582
Eric Avatar asked Nov 01 '25 18:11

Eric


1 Answers

@expo-vector-icons exposes a glyphMap for each icon type. You can use this to generate the name suggestions.

import { Ionicons } from '@expo/vector-icons';

export interface ownWrittenProps {
  leftIcon?: keyof typeof Ionicons.glyphMap;
}

This will create a type from the map, then make sure that only keys of that type can be used when setting leftIcon.

like image 105
nipuna777 Avatar answered Nov 03 '25 12:11

nipuna777