{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/extends\";\nimport _regeneratorRuntime from \"@babel/runtime/regenerator\";\nimport _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport _inherits from \"@babel/runtime/helpers/inherits\";\nimport _possibleConstructorReturn from \"@babel/runtime/helpers/possibleConstructorReturn\";\nimport _getPrototypeOf from \"@babel/runtime/helpers/getPrototypeOf\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nvar _jsxFileName = \"/Users/rohitsingh/Documents/projects/new-nativebase-setup/NativeBase/example/node_modules/@expo/vector-icons/build/createIconSet.js\";\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nimport * as Font from \"expo-font\";\nimport React from \"react\";\nimport Text from \"react-native-web/dist/exports/Text\";\nimport createIconSet from \"./vendor/react-native-vector-icons/lib/create-icon-set\";\nimport createIconButtonComponent from \"./vendor/react-native-vector-icons/lib/icon-button\";\nexport { DEFAULT_ICON_COLOR, DEFAULT_ICON_SIZE } from \"./vendor/react-native-vector-icons/lib/create-icon-set\";\nexport default function (glyphMap, fontName, expoAssetId, fontStyle) {\n  var _a;\n\n  var font = _defineProperty({}, fontName, expoAssetId);\n\n  var RNVIconComponent = createIconSet(glyphMap, fontName, null, fontStyle);\n  return _a = function (_React$Component) {\n    _inherits(Icon, _React$Component);\n\n    var _super = _createSuper(Icon);\n\n    function Icon() {\n      var _this;\n\n      _classCallCheck(this, Icon);\n\n      _this = _super.apply(this, arguments);\n      _this._mounted = false;\n      _this.state = {\n        fontIsLoaded: Font.isLoaded(fontName)\n      };\n      return _this;\n    }\n\n    _createClass(Icon, [{\n      key: \"componentDidMount\",\n      value: function componentDidMount() {\n        return _regeneratorRuntime.async(function componentDidMount$(_context) {\n          while (1) {\n            switch (_context.prev = _context.next) {\n              case 0:\n                this._mounted = true;\n\n                if (this.state.fontIsLoaded) {\n                  _context.next = 5;\n                  break;\n                }\n\n                _context.next = 4;\n                return _regeneratorRuntime.awrap(Font.loadAsync(font));\n\n              case 4:\n                this._mounted && this.setState({\n                  fontIsLoaded: true\n                });\n\n              case 5:\n              case \"end\":\n                return _context.stop();\n            }\n          }\n        }, null, this, null, Promise);\n      }\n    }, {\n      key: \"componentWillUnmount\",\n      value: function componentWillUnmount() {\n        this._mounted = false;\n      }\n    }, {\n      key: \"setNativeProps\",\n      value: function setNativeProps(props) {\n        if (this._icon) {\n          this._icon.setNativeProps(props);\n        }\n      }\n    }, {\n      key: \"render\",\n      value: function render() {\n        var _this2 = this;\n\n        if (!this.state.fontIsLoaded) {\n          return React.createElement(Text, null);\n        }\n\n        return React.createElement(RNVIconComponent, _extends({\n          ref: function ref(view) {\n            _this2._icon = view;\n          }\n        }, this.props));\n      }\n    }]);\n\n    return Icon;\n  }(React.Component), _a.defaultProps = RNVIconComponent.defaultProps, _a.Button = createIconButtonComponent(_a), _a.glyphMap = glyphMap, _a.getRawGlyphMap = function () {\n    return glyphMap;\n  }, _a.getFontFamily = function () {\n    return fontName;\n  }, _a.loadFont = function () {\n    return Font.loadAsync(font);\n  }, _a.font = font, _a;\n}","map":{"version":3,"sources":["../src/createIconSet.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,OAAO,KAAK,IAAZ,MAAsB,WAAtB;AACA,OAAO,KAAP,MAAsC,OAAtC;;AAGA,OAAO,aAAP;AACA,OAAO,yBAAP;AAEA,SACE,kBADF,EAEE,iB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;AAAA;AAAA,IAA0B,KAAK,CAAC,SAAhC,CAAA,EACS,EAAA,CAAA,YAAA,GAAe,gBAAgB,CAAC,YADzC,EAES,EAAA,CAAA,MAAA,GAAS,yBAAyB,CAAC,EAAD,CAF3C,EAGS,EAAA,CAAA,QAAA,GAAW,QAHpB,EAIS,EAAA,CAAA,cAAA,GAAiB;AAAA,WAAM,QAAN;AAAA,GAJ1B,EAKS,EAAA,CAAA,aAAA,GAAgB;AAAA,WAAM,QAAN;AAAA,GALzB,EAMS,EAAA,CAAA,QAAA,GAAW;AAAA,WAAM,IAAI,CAAC,SAAL,CAAe,IAAf,CAAN;AAAA,GANpB,EAOS,EAAA,CAAA,IAAA,GAAO,IAPhB,EAgDE,EAhDF;AAiDD","sourcesContent":["import * as Font from \"expo-font\";\nimport React, { ComponentClass } from \"react\";\nimport { Text, TextProps, TouchableHighlightProps, ViewProps, OpaqueColorValue } 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 IconButtonProps<GLYPHS extends string> extends ViewProps, TouchableHighlightProps {\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 IconProps<GLYPHS extends string> 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 type GlyphMap<G extends string> = { [K in G]: number }\n\nexport interface Icon<G extends string, FN extends string> {\n  defaultProps: any;\n  Button: ComponentClass<IconButtonProps<G>>;\n  glyphMap: GlyphMap<G>;\n  getRawGlyphMap: () => GlyphMap<G>;\n  getFontFamily: () => FN;\n  loadFont: () => Promise<void>;\n  font: { [x: string]: any };\n  new (props: IconProps<G>): React.Component<IconProps<G>>;\n}\n\nexport default function<G extends string, FN extends string>(\n  glyphMap: GlyphMap<G>,\n  fontName: FN,\n  expoAssetId,\n  fontStyle?: any\n): Icon<G, FN> {\n  const font = { [fontName]: expoAssetId };\n  const RNVIconComponent = createIconSet(glyphMap, fontName, null, fontStyle);\n\n  return class Icon extends React.Component<IconProps<G>> {\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 (!this.state.fontIsLoaded) {\n        return <Text />;\n      }\n\n      return (\n        <RNVIconComponent\n          ref={view => {\n            this._icon = view;\n          }}\n          {...this.props}\n        />\n      );\n    }\n  };\n}\n"],"sourceRoot":""},"metadata":{},"sourceType":"module"}