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C,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;iBAClC;YACH,CAAC;YAED,MAAM;gBACJ,IAAI,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,QAAQ,CAAC,EAAE;oBAChE,OAAO,CAAC,IAAI,CACV,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,0CAA0C,QAAQ,GAAG,CACzE,CAAC;iBACH;gBAED,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE;oBAC5B,OAAO,CAAC,IAAI,CAAC,AAAD,EAAG,CAAC;iBACjB;gBAED,OAAO,CACL,CAAC,gBAAgB,CACf,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE;oBACZ,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;gBACpB,CAAC,CAAC,CACF,IAAI,IAAI,CAAC,KAAK,CAAC,EACf,CACH,CAAC;YACJ,CAAC;SACF;QArDQ,eAAY,GAAG,gBAAgB,CAAC,YAAa;QAC7C,SAAM,GAAG,yBAAyB,CAAC,EAAI,CAAE;QACzC,WAAQ,GAAG,QAAS;QACpB,iBAAc,GAAG,GAAG,EAAE,CAAC,QAAS;QAChC,gBAAa,GAAG,GAAG,EAAE,CAAC,QAAS;QAC/B,WAAQ,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAE;QACtC,OAAI,GAAG,IAAK;WA+CnB;AACJ,CAAC","sourcesContent":["import * as Font from \"expo-font\";\nimport React, { ComponentClass } from \"react\";\nimport {\n Text,\n TextProps,\n TouchableHighlightProps,\n ViewProps,\n OpaqueColorValue,\n TextStyle,\n ViewStyle,\n} from \"react-native\";\n\nimport createIconSet from \"./vendor/react-native-vector-icons/lib/create-icon-set\";\nimport createIconButtonComponent from \"./vendor/react-native-vector-icons/lib/icon-button\";\n\nexport {\n DEFAULT_ICON_COLOR,\n DEFAULT_ICON_SIZE,\n} from \"./vendor/react-native-vector-icons/lib/create-icon-set\";\n\nexport interface IconProps extends TextProps {\n /**\n * Size of the icon, can also be passed as fontSize in the style object.\n *\n * @default 12\n */\n size?: number;\n\n /**\n * Name of the icon to show\n *\n * See Icon Explorer app\n * {@link https://expo.github.io/vector-icons/}\n */\n name: GLYPHS;\n\n /**\n * Color of the icon. Can be a string or OpaqueColorValue (returned from\n * PlatformColor(..))\n *\n */\n color?: string | OpaqueColorValue;\n}\n\nexport interface IconButtonProps\n extends IconProps,\n ViewProps,\n TouchableHighlightProps {\n /**\n * Text and icon color\n * Use iconStyle or nest a Text component if you need different colors.\n * Can be a string or OpaqueColorValue (returned from PlatformColor(..))\n *\n * @default 'white'\n */\n color?: string | OpaqueColorValue;\n\n /**\n * Border radius of the button\n * Set to 0 to disable.\n *\n * @default 5\n */\n borderRadius?: number;\n\n /**\n * Styles applied to the icon only\n * Good for setting margins or a different color.\n *\n * @default {marginRight: 10}\n */\n iconStyle?: TextStyle;\n\n /**\n * Style prop inherited from TextProps and TouchableWithoutFeedbackProperties\n * Only exist here so we can have ViewStyle or TextStyle\n *\n */\n style?: ViewStyle | TextStyle;\n\n /**\n * Background color of the button. Can be a string or OpaqueColorValue (returned from\n * PlatformColor(..))\n *\n * @default '#007AFF'\n */\n backgroundColor?: string | OpaqueColorValue;\n}\n\nexport type GlyphMap = { [K in G]: number | string };\n\nexport interface Icon {\n defaultProps: any;\n Button: ComponentClass>;\n glyphMap: GlyphMap;\n getRawGlyphMap: () => GlyphMap;\n getFontFamily: () => FN;\n loadFont: () => Promise;\n font: { [x: string]: any };\n new (props: IconProps): React.Component>;\n}\n\nexport default function (\n glyphMap: GlyphMap,\n fontName: FN,\n expoAssetId,\n fontStyle?: any\n): Icon {\n const font = { [fontName]: expoAssetId };\n const RNVIconComponent = createIconSet(glyphMap, fontName, null, fontStyle);\n\n return class Icon extends React.Component> {\n static defaultProps = RNVIconComponent.defaultProps;\n static Button = createIconButtonComponent(Icon);\n static glyphMap = glyphMap;\n static getRawGlyphMap = () => glyphMap;\n static getFontFamily = () => fontName;\n static loadFont = () => Font.loadAsync(font);\n static font = font;\n\n _mounted = false;\n _icon?: any;\n\n state = {\n fontIsLoaded: Font.isLoaded(fontName),\n };\n\n async componentDidMount() {\n this._mounted = true;\n if (!this.state.fontIsLoaded) {\n await Font.loadAsync(font);\n this._mounted && this.setState({ fontIsLoaded: true });\n }\n }\n\n componentWillUnmount() {\n this._mounted = false;\n }\n\n setNativeProps(props) {\n if (this._icon) {\n this._icon.setNativeProps(props);\n }\n }\n\n render() {\n if (__DEV__ && this.props.name && !(this.props.name in glyphMap)) {\n console.warn(\n `\"${this.props.name}\" is not a valid icon name for family \"${fontName}\"`\n );\n }\n\n if (!this.state.fontIsLoaded) {\n return ;\n }\n\n return (\n {\n this._icon = view;\n }}\n {...this.props}\n />\n );\n }\n };\n}\n"]}