acaf0f3c5593d5ecdfea4be1d8319618.json 7.63 KB
{"ast":null,"code":"var _interopRequireWildcard=require(\"@babel/runtime/helpers/interopRequireWildcard\");var _interopRequireDefault=require(\"@babel/runtime/helpers/interopRequireDefault\");Object.defineProperty(exports,\"__esModule\",{value:true});exports.default=exports.accessibilityProps=void 0;var _extends2=_interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));var _objectWithoutProperties2=_interopRequireDefault(require(\"@babel/runtime/helpers/objectWithoutProperties\"));var React=_interopRequireWildcard(require(\"react\"));var _StyleSheet=_interopRequireDefault(require(\"react-native-web/dist/exports/StyleSheet\"));var _Text=_interopRequireDefault(require(\"react-native-web/dist/exports/Text\"));var _Platform=_interopRequireDefault(require(\"react-native-web/dist/exports/Platform\"));var _jsxFileName=\"/Users/satya/Workspace/Callstack/react-native-paper/src/components/MaterialCommunityIcon.tsx\";var MaterialCommunityIcons;try{MaterialCommunityIcons=require(\"@expo/vector-icons/MaterialCommunityIcons\").default;}catch(e){if(global.__expo&&global.__expo.Icon&&global.__expo.Icon.MaterialCommunityIcons){MaterialCommunityIcons=global.__expo.Icon.MaterialCommunityIcons;}else{var isErrorLogged=false;MaterialCommunityIcons=function MaterialCommunityIcons(_ref){var name=_ref.name,color=_ref.color,size=_ref.size,rest=(0,_objectWithoutProperties2.default)(_ref,[\"name\",\"color\",\"size\"]);if(!isErrorLogged){if(!/(Cannot find module|Module not found|Cannot resolve module)/.test(e.message)){console.error(e);}console.warn(\"Tried to use the icon '\"+name+\"' in a component from 'react-native-paper', but 'react-native-vector-icons' could not be loaded.\",\"To remove this warning, try installing 'react-native-vector-icons' or use another method to specify icon: https://callstack.github.io/react-native-paper/icons.html.\");isErrorLogged=true;}return React.createElement(_Text.default,(0,_extends2.default)({},rest,{style:[styles.icon,{color:color,fontSize:size}],pointerEvents:\"none\",__source:{fileName:_jsxFileName,lineNumber:55}}),\"\\u25A1\");};}}var accessibilityProps=_Platform.default.OS==='web'?{role:'img',focusable:false}:{accessibilityElementsHidden:true,importantForAccessibility:'no-hide-descendants'};exports.accessibilityProps=accessibilityProps;var defaultIcon=function defaultIcon(_ref2){var name=_ref2.name,color=_ref2.color,size=_ref2.size,direction=_ref2.direction;return React.createElement(MaterialCommunityIcons,(0,_extends2.default)({name:name,color:color,size:size,style:[{transform:[{scaleX:direction==='rtl'?-1:1}]},styles.icon],pointerEvents:\"none\"},accessibilityProps,{__source:{fileName:_jsxFileName,lineNumber:79}}));};var styles=_StyleSheet.default.create({icon:{backgroundColor:'transparent'}});var _default=defaultIcon;exports.default=_default;","map":{"version":3,"sources":["MaterialCommunityIcon.tsx"],"names":["MaterialCommunityIcons","require","global","isErrorLogged","name","color","size","rest","e","console","styles","fontSize","accessibilityProps","Platform","role","focusable","accessibilityElementsHidden","importantForAccessibility","defaultIcon","direction","transform","scaleX","StyleSheet","icon","backgroundColor"],"mappings":"mdAAA,oD,oXAUA,GAAA,CAAA,sBAAA,CAEA,GAAI,CAEFA,sBAAsB,CAAGC,OAAAA,6CAAAA,CAAzBD,OAAAA,CAEA,OAAA,CAAA,CAAU,CACV,GAEEE,MAAM,CAANA,MAAAA,EAEAA,MAAM,CAANA,MAAAA,CAFAA,IAAAA,EAIAA,MAAM,CAANA,MAAAA,CAAAA,IAAAA,CANF,sBAAA,CAOE,CAIAF,sBAAsB,CAAGE,MAAM,CAANA,MAAAA,CAAAA,IAAAA,CAAzBF,sBAAAA,CAXF,CAAA,IAYO,CACL,GAAIG,CAAAA,aAAa,CAAjB,KAAA,CAIAH,sBAAsB,CAAG,QAAA,CAAA,sBAAA,CAAA,IAAA,CAAoC,CAAjCI,GAAAA,CAAAA,IAAiC,CAAA,IAAA,CAAjCA,IAAAA,CAAMC,KAA2B,CAAA,IAAA,CAA3BA,KAAND,CAAaE,IAAoB,CAAA,IAAA,CAApBA,IAAbF,CAAsBG,IAAW,CAAA,sCAAA,IAAA,CAAA,CAAA,MAAA,CAAA,OAAA,CAAA,MAAA,CAAA,CAAjCH,CAE1B,GAAI,C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,GAATA,KAAAA,CAAsB,CAAtBA,CAAAA,CAFnB,CAES,CAAD,CADb,CADK,CAILT,MAAM,CARV,IAIS,CAJT,CAUE,aAAa,CAVf,MAAA,CAAA,CAAA,kBAAA,CAAA,CAAA,QAAA,CAAA,CAAA,QAAA,CAAA,YAAA,CAAA,UAAA,CADkB,EAClB,CAAA,CAAA,CAAA,CADkB,CAApB,CAAA,CAgBA,GAAMA,CAAAA,MAAM,CAAGY,oBAAAA,MAAAA,CAAkB,CAC/BC,IAAI,CAAE,CACJC,eAAe,CAFnB,aACQ,CADyB,CAAlBF,CAAf,C,aAMA,W","sourcesContent":["import * as React from 'react';\nimport { StyleSheet, Text, Platform } from 'react-native';\n\nexport type IconProps = {\n  name: string;\n  color: string;\n  size: number;\n  direction: 'rtl' | 'ltr';\n};\n\nlet MaterialCommunityIcons: any;\n\ntry {\n  // Optionally require vector-icons\n  MaterialCommunityIcons = require('react-native-vector-icons/MaterialCommunityIcons')\n    .default;\n} catch (e) {\n  if (\n    // @ts-ignore\n    global.__expo &&\n    // @ts-ignore\n    global.__expo.Icon &&\n    // @ts-ignore\n    global.__expo.Icon.MaterialCommunityIcons\n  ) {\n    // Snack doesn't properly bundle vector icons from subpath\n    // Use icons from the __expo global if available\n    // @ts-ignore\n    MaterialCommunityIcons = global.__expo.Icon.MaterialCommunityIcons;\n  } else {\n    let isErrorLogged = false;\n\n    // Fallback component for icons\n    // @ts-ignore\n    MaterialCommunityIcons = ({ name, color, size, ...rest }) => {\n      /* eslint-disable no-console */\n      if (!isErrorLogged) {\n        if (\n          !/(Cannot find module|Module not found|Cannot resolve module)/.test(\n            e.message\n          )\n        ) {\n          console.error(e);\n        }\n\n        console.warn(\n          `Tried to use the icon '${name}' in a component from 'react-native-paper', but 'react-native-vector-icons' could not be loaded.`,\n          `To remove this warning, try installing 'react-native-vector-icons' or use another method to specify icon: https://callstack.github.io/react-native-paper/icons.html.`\n        );\n\n        isErrorLogged = true;\n      }\n\n      return (\n        <Text\n          {...rest}\n          style={[styles.icon, { color, fontSize: size }]}\n          pointerEvents=\"none\"\n        >\n\n        </Text>\n      );\n    };\n  }\n}\n\nexport const accessibilityProps =\n  Platform.OS === 'web'\n    ? {\n        role: 'img',\n        focusable: false,\n      }\n    : {\n        accessibilityElementsHidden: true,\n        importantForAccessibility: 'no-hide-descendants' as 'no-hide-descendants',\n      };\n\nconst defaultIcon = ({ name, color, size, direction }: IconProps) => (\n  <MaterialCommunityIcons\n    name={name}\n    color={color}\n    size={size}\n    style={[\n      {\n        transform: [{ scaleX: direction === 'rtl' ? -1 : 1 }],\n      },\n      styles.icon,\n    ]}\n    pointerEvents=\"none\"\n    {...accessibilityProps}\n  />\n);\n\nconst styles = StyleSheet.create({\n  icon: {\n    backgroundColor: 'transparent',\n  },\n});\n\nexport default defaultIcon;\n"]},"metadata":{},"sourceType":"script"}