You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
7.6 KiB
1 line
7.6 KiB
{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/objectSpread2\";\nimport UIManager from \"../../exports/UIManager\";\nimport createDOMProps from \"../createDOMProps\";\nimport useStable from \"../useStable\";\nimport { useRef } from 'react';\nvar didWarn = false;\nvar emptyObject = {};\nfunction setNativeProps(node, nativeProps, pointerEvents, style, previousStyleRef) {\n if (!didWarn) {\n console.warn('setNativeProps is deprecated. Please update props using React state instead.');\n didWarn = true;\n }\n if (node != null && nativeProps) {\n var domProps = createDOMProps(null, _objectSpread(_objectSpread({\n pointerEvents: pointerEvents\n }, nativeProps), {}, {\n style: [style, nativeProps.style]\n }));\n var nextDomStyle = domProps.style;\n if (previousStyleRef.current != null) {\n if (domProps.style == null) {\n domProps.style = {};\n }\n for (var styleName in previousStyleRef.current) {\n if (domProps.style[styleName] == null) {\n domProps.style[styleName] = '';\n }\n }\n }\n previousStyleRef.current = nextDomStyle;\n UIManager.updateView(node, domProps);\n }\n}\nexport default function usePlatformMethods(_ref) {\n var pointerEvents = _ref.pointerEvents,\n style = _ref.style;\n var previousStyleRef = useRef(null);\n var setNativePropsArgsRef = useRef(null);\n setNativePropsArgsRef.current = {\n pointerEvents: pointerEvents,\n style: style\n };\n var ref = useStable(function () {\n return function (hostNode) {\n if (hostNode != null) {\n hostNode.measure = function (callback) {\n return UIManager.measure(hostNode, callback);\n };\n hostNode.measureLayout = function (relativeToNode, success, failure) {\n return UIManager.measureLayout(hostNode, relativeToNode, failure, success);\n };\n hostNode.measureInWindow = function (callback) {\n return UIManager.measureInWindow(hostNode, callback);\n };\n hostNode.setNativeProps = function (nativeProps) {\n var _ref2 = setNativePropsArgsRef.current || emptyObject,\n style = _ref2.style,\n pointerEvents = _ref2.pointerEvents;\n setNativeProps(hostNode, nativeProps, pointerEvents, style, previousStyleRef);\n };\n }\n };\n });\n return ref;\n}","map":{"version":3,"names":["_objectSpread","UIManager","createDOMProps","useStable","useRef","didWarn","emptyObject","setNativeProps","node","nativeProps","pointerEvents","style","previousStyleRef","console","warn","domProps","nextDomStyle","current","styleName","updateView","usePlatformMethods","_ref","setNativePropsArgsRef","ref","hostNode","measure","callback","measureLayout","relativeToNode","success","failure","measureInWindow","_ref2"],"sources":["/Users/thomaschazot/Documents/But2A/LaSuperMeteo/iut-expo-starter/node_modules/react-native-web/dist/modules/usePlatformMethods/index.js"],"sourcesContent":["import _objectSpread from \"@babel/runtime/helpers/objectSpread2\";\n\n/**\n * Copyright (c) Nicolas Gallagher.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\nimport UIManager from '../../exports/UIManager';\nimport createDOMProps from '../createDOMProps';\nimport useStable from '../useStable';\nimport { useRef } from 'react';\nvar didWarn = false;\nvar emptyObject = {};\n\nfunction setNativeProps(node, nativeProps, pointerEvents, style, previousStyleRef) {\n if (!didWarn) {\n console.warn('setNativeProps is deprecated. Please update props using React state instead.');\n didWarn = true;\n }\n\n if (node != null && nativeProps) {\n var domProps = createDOMProps(null, _objectSpread(_objectSpread({\n pointerEvents\n }, nativeProps), {}, {\n style: [style, nativeProps.style]\n }));\n var nextDomStyle = domProps.style;\n\n if (previousStyleRef.current != null) {\n if (domProps.style == null) {\n domProps.style = {};\n }\n\n for (var styleName in previousStyleRef.current) {\n if (domProps.style[styleName] == null) {\n domProps.style[styleName] = '';\n }\n }\n }\n\n previousStyleRef.current = nextDomStyle;\n UIManager.updateView(node, domProps);\n }\n}\n/**\n * Adds non-standard methods to the hode element. This is temporarily until an\n * API like `ReactNative.measure(hostRef, callback)` is added to React Native.\n */\n\n\nexport default function usePlatformMethods(_ref) {\n var pointerEvents = _ref.pointerEvents,\n style = _ref.style;\n var previousStyleRef = useRef(null);\n var setNativePropsArgsRef = useRef(null);\n setNativePropsArgsRef.current = {\n pointerEvents,\n style\n }; // Avoid creating a new ref on every render. The props only need to be\n // available to 'setNativeProps' when it is called.\n\n var ref = useStable(() => hostNode => {\n if (hostNode != null) {\n hostNode.measure = callback => UIManager.measure(hostNode, callback);\n\n hostNode.measureLayout = (relativeToNode, success, failure) => UIManager.measureLayout(hostNode, relativeToNode, failure, success);\n\n hostNode.measureInWindow = callback => UIManager.measureInWindow(hostNode, callback);\n\n hostNode.setNativeProps = nativeProps => {\n var _ref2 = setNativePropsArgsRef.current || emptyObject,\n style = _ref2.style,\n pointerEvents = _ref2.pointerEvents;\n\n setNativeProps(hostNode, nativeProps, pointerEvents, style, previousStyleRef);\n };\n }\n });\n return ref;\n}"],"mappings":"AAAA,OAAOA,aAAa,MAAM,sCAAsC;AAUhE,OAAOC,SAAS;AAChB,OAAOC,cAAc;AACrB,OAAOC,SAAS;AAChB,SAASC,MAAM,QAAQ,OAAO;AAC9B,IAAIC,OAAO,GAAG,KAAK;AACnB,IAAIC,WAAW,GAAG,CAAC,CAAC;AAEpB,SAASC,cAAc,CAACC,IAAI,EAAEC,WAAW,EAAEC,aAAa,EAAEC,KAAK,EAAEC,gBAAgB,EAAE;EACjF,IAAI,CAACP,OAAO,EAAE;IACZQ,OAAO,CAACC,IAAI,CAAC,8EAA8E,CAAC;IAC5FT,OAAO,GAAG,IAAI;EAChB;EAEA,IAAIG,IAAI,IAAI,IAAI,IAAIC,WAAW,EAAE;IAC/B,IAAIM,QAAQ,GAAGb,cAAc,CAAC,IAAI,EAAEF,aAAa,CAACA,aAAa,CAAC;MAC9DU,aAAa,EAAbA;IACF,CAAC,EAAED,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE;MACnBE,KAAK,EAAE,CAACA,KAAK,EAAEF,WAAW,CAACE,KAAK;IAClC,CAAC,CAAC,CAAC;IACH,IAAIK,YAAY,GAAGD,QAAQ,CAACJ,KAAK;IAEjC,IAAIC,gBAAgB,CAACK,OAAO,IAAI,IAAI,EAAE;MACpC,IAAIF,QAAQ,CAACJ,KAAK,IAAI,IAAI,EAAE;QAC1BI,QAAQ,CAACJ,KAA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