From 12adc9d3a4a882d32613827fe785f9a776eb19ec Mon Sep 17 00:00:00 2001 From: wood1986 Date: Tue, 5 May 2020 09:59:31 -0700 Subject: [PATCH] fix(web): Allow createElement & unstable_createElement usage --- packages/expo-gl/CHANGELOG.md | 4 ++++ packages/expo-gl/build/Canvas.js | 4 +++- packages/expo-gl/build/Canvas.js.map | 2 +- packages/expo-gl/build/GLView.d.ts | 6 +++--- packages/expo-gl/build/createElement.native.d.ts | 1 + packages/expo-gl/build/createElement.native.js | 2 ++ packages/expo-gl/build/createElement.native.js.map | 1 + packages/expo-gl/build/createElement.web.d.ts | 2 ++ packages/expo-gl/build/createElement.web.js | 9 +++++++++ packages/expo-gl/build/createElement.web.js.map | 1 + packages/expo-gl/src/Canvas.tsx | 12 ++++-------- packages/expo-gl/src/createElement.native.tsx | 1 + packages/expo-gl/src/createElement.web.tsx | 11 +++++++++++ 13 files changed, 43 insertions(+), 13 deletions(-) create mode 100644 packages/expo-gl/build/createElement.native.d.ts create mode 100644 packages/expo-gl/build/createElement.native.js create mode 100644 packages/expo-gl/build/createElement.native.js.map create mode 100644 packages/expo-gl/build/createElement.web.d.ts create mode 100644 packages/expo-gl/build/createElement.web.js create mode 100644 packages/expo-gl/build/createElement.web.js.map create mode 100644 packages/expo-gl/src/createElement.native.tsx create mode 100644 packages/expo-gl/src/createElement.web.tsx diff --git a/packages/expo-gl/CHANGELOG.md b/packages/expo-gl/CHANGELOG.md index bf4d7deb06853..858d197368314 100644 --- a/packages/expo-gl/CHANGELOG.md +++ b/packages/expo-gl/CHANGELOG.md @@ -2,6 +2,10 @@ ## master +### 🐛 Bug fixes + +- Allow createElement & unstable_createElement usage for web. ([#7995](https://github.com/expo/expo/pull/7995) by [@wood1986](https://github.com/wood1986)) + ### 🛠 Breaking changes ### 🎉 New features diff --git a/packages/expo-gl/build/Canvas.js b/packages/expo-gl/build/Canvas.js index 37e24c7e3cb9d..bb03f05a68ab0 100644 --- a/packages/expo-gl/build/Canvas.js +++ b/packages/expo-gl/build/Canvas.js @@ -1,6 +1,8 @@ import * as React from 'react'; import { findDOMNode } from 'react-dom'; -import { createElement, PixelRatio, StyleSheet, View, } from 'react-native'; +import { PixelRatio, StyleSheet, View } from 'react-native'; +// @ts-ignore +import { createElement } from './createElement'; function getElement(component) { try { return findDOMNode(component); diff --git a/packages/expo-gl/build/Canvas.js.map b/packages/expo-gl/build/Canvas.js.map index c2ddf9922f3b5..44f9adcfc41b5 100644 --- a/packages/expo-gl/build/Canvas.js.map +++ b/packages/expo-gl/build/Canvas.js.map @@ -1 +1 @@ -{"version":3,"file":"Canvas.js","sourceRoot":"","sources":["../src/Canvas.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EACL,aAAa,EAEb,UAAU,EACV,UAAU,EACV,IAAI,GAEL,MAAM,cAAc,CAAC;AAEtB,SAAS,UAAU,CAAC,SAAS;IAC3B,IAAI;QACF,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC;KAC/B;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAED,SAAS,MAAM,CAAI,OAAqB,EAAE,GAAa;IACrD,IAAI,CAAC,OAAO;QAAE,OAAO;IAErB,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;QACjC,OAAO,CAAC,GAAG,CAAC,CAAC;KACd;SAAM,IAAI,SAAS,IAAI,OAAO,EAAE;QAC/B,aAAa;QACb,OAAO,CAAC,OAAO,GAAG,GAAG,CAAC;KACvB;AACH,CAAC;AAED,MAAM,MAAM,GAAQ,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AAEjG,MAAM,aAAa,GAEd,CAAC,EAAE,aAAa,EAAE,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ode } from 'react-dom';\nimport {\n createElement,\n LayoutChangeEvent,\n PixelRatio,\n StyleSheet,\n View,\n ViewProps,\n} from 'react-native';\n\nfunction getElement(component) {\n try {\n return findDOMNode(component);\n } catch (e) {\n return component;\n }\n}\n\nfunction setRef(refProp: React.Ref, ref: T | null) {\n if (!refProp) return;\n\n if (typeof refProp === 'function') {\n refProp(ref);\n } else if ('current' in refProp) {\n // @ts-ignore\n refProp.current = ref;\n }\n}\n\nconst Canvas: any = React.forwardRef((props, ref) => createElement('canvas', { ...props, ref }));\n\nconst CanvasWrapper: React.FunctionComponent;\n}> = ({ pointerEvents, children, ...props }) => {\n const [size, setSize] = React.useState<{ width: number; height: number } | null>(null);\n\n const ref = React.useRef(null);\n const _canvasRef = React.useRef(null);\n\n function updateCanvasSize(): void {\n const canvas = _canvasRef.current;\n if (canvas) {\n const size = getSize();\n const scale = PixelRatio.get();\n\n canvas.style.width = `${size.width}px`;\n canvas.style.height = `${size.height}px`;\n\n canvas.width = size.width * scale;\n canvas.height = size.height * scale;\n }\n }\n\n function getSize(): { width: number; height: number } {\n if (size) return size;\n if (!ref.current) return { width: 0, height: 0 };\n const element = getElement(ref.current);\n const { offsetWidth: width = 0, offsetHeight: height = 0 } = element;\n return { width, height };\n }\n\n function onLayout(event: LayoutChangeEvent): void {\n const {\n nativeEvent: {\n layout: { width, height },\n },\n } = event;\n\n setSize({ width, height });\n\n if (props.onLayout) {\n props.onLayout(event);\n }\n }\n\n React.useEffect(() => {\n if (ref.current != null) {\n setSize(getSize());\n }\n }, [ref]);\n\n React.useEffect(() => {\n updateCanvasSize();\n }, [size]);\n\n React.useEffect(() => {\n const canvas = _canvasRef.current;\n if (canvas) {\n updateCanvasSize();\n }\n setRef(props.canvasRef, canvas);\n }, [_canvasRef]);\n\n return (\n \n \n {children}\n \n );\n};\n\nexport default CanvasWrapper;\n"]} \ No newline at end of file +{"version":3,"file":"Canvas.js","sourceRoot":"","sources":["../src/Canvas.tsx"],"names":[],"mappings":"AAAA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,CAAC;SACpB;IACH,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEV,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,gBAAgB,EAAE,CAAC;IACrB,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC;QAClC,IAAI,MAAM,EAAE;YACV,gBAAgB,EAAE,CAAC;SACpB;QACD,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,OAAO,CACL,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACrE;MAAA,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,aAAa,CAAC,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,EACtF;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import * as React from 'react';\nimport { findDOMNode } from 'react-dom';\nimport { LayoutChangeEvent, PixelRatio, StyleSheet, View, ViewProps } from 'react-native';\n\n// @ts-ignore\nimport { createElement } from './createElement';\n\nfunction getElement(component) {\n try {\n return findDOMNode(component);\n } catch (e) {\n return component;\n }\n}\n\nfunction setRef(refProp: React.Ref, ref: T | null) {\n if (!refProp) return;\n\n if (typeof refProp === 'function') {\n refProp(ref);\n } else if ('current' in refProp) {\n // @ts-ignore\n refProp.current = ref;\n }\n}\n\nconst Canvas: any = React.forwardRef((props, ref) => createElement('canvas', { ...props, ref }));\n\nconst CanvasWrapper: React.FunctionComponent;\n}> = ({ pointerEvents, children, ...props }) => {\n const [size, setSize] = React.useState<{ width: number; height: number } | null>(null);\n\n const ref = React.useRef(null);\n const _canvasRef = React.useRef(null);\n\n function updateCanvasSize(): void {\n const canvas = _canvasRef.current;\n if (canvas) {\n const size = getSize();\n const scale = PixelRatio.get();\n\n canvas.style.width = `${size.width}px`;\n canvas.style.height = `${size.height}px`;\n\n canvas.width = size.width * scale;\n canvas.height = size.height * scale;\n }\n }\n\n function getSize(): { width: number; height: number } {\n if (size) return size;\n if (!ref.current) return { width: 0, height: 0 };\n const element = getElement(ref.current);\n const { offsetWidth: width = 0, offsetHeight: height = 0 } = element;\n return { width, height };\n }\n\n function onLayout(event: LayoutChangeEvent): void {\n const {\n nativeEvent: {\n layout: { width, height },\n },\n } = event;\n\n setSize({ width, height });\n\n if (props.onLayout) {\n props.onLayout(event);\n }\n }\n\n React.useEffect(() => {\n if (ref.current != null) {\n setSize(getSize());\n }\n }, [ref]);\n\n React.useEffect(() => {\n updateCanvasSize();\n }, [size]);\n\n React.useEffect(() => {\n const canvas = _canvasRef.current;\n if (canvas) {\n updateCanvasSize();\n }\n setRef(props.canvasRef, canvas);\n }, [_canvasRef]);\n\n return (\n \n \n {children}\n \n );\n};\n\nexport default CanvasWrapper;\n"]} \ No newline at end of file diff --git a/packages/expo-gl/build/GLView.d.ts b/packages/expo-gl/build/GLView.d.ts index 3d95d68c4630c..e618149d052b9 100644 --- a/packages/expo-gl/build/GLView.d.ts +++ b/packages/expo-gl/build/GLView.d.ts @@ -63,17 +63,17 @@ export declare class GLView extends React.Component { label?: string | undefined; }>[] | undefined> | undefined; accessibilityLabel?: PropTypes.Validator | undefined; - accessibilityRole?: PropTypes.Validator<"button" | "header" | "link" | "menu" | "menuitem" | "summary" | "image" | "switch" | "text" | "none" | "search" | "keyboardkey" | "adjustable" | "imagebutton" | "alert" | "checkbox" | "combobox" | "menubar" | "progressbar" | "radio" | "radiogroup" | "scrollbar" | "spinbutton" | "tab" | "tablist" | "timer" | "toolbar" | undefined> | undefined; + accessibilityRole?: PropTypes.Validator<"none" | "button" | "header" | "link" | "menu" | "menuitem" | "summary" | "image" | "switch" | "text" | "search" | "keyboardkey" | "adjustable" | "imagebutton" | "alert" | "checkbox" | "combobox" | "menubar" | "progressbar" | "radio" | "radiogroup" | "scrollbar" | "spinbutton" | "tab" | "tablist" | "timer" | "toolbar" | undefined> | undefined; accessibilityStates?: PropTypes.Validator | undefined; accessibilityState?: PropTypes.Validator | undefined; accessibilityHint?: PropTypes.Validator | undefined; accessibilityValue?: PropTypes.Validator | undefined; onAccessibilityAction?: PropTypes.Validator<((event: import("react-native").AccessibilityActionEvent) => void) | undefined> | undefined; - accessibilityComponentType?: PropTypes.Validator<"button" | "none" | "radiobutton_checked" | "radiobutton_unchecked" | undefined> | undefined; + accessibilityComponentType?: PropTypes.Validator<"none" | "button" | "radiobutton_checked" | "radiobutton_unchecked" | undefined> | undefined; accessibilityLiveRegion?: PropTypes.Validator<"none" | "polite" | "assertive" | undefined> | undefined; importantForAccessibility?: PropTypes.Validator<"auto" | "yes" | "no" | "no-hide-descendants" | undefined> | undefined; accessibilityElementsHidden?: PropTypes.Validator | undefined; - accessibilityTraits?: PropTypes.Validator<"button" | "header" | "link" | "summary" | "image" | "text" | "none" | "search" | "adjustable" | "disabled" | "selected" | "plays" | "key" | "frequentUpdates" | "startsMedia" | "allowsDirectInteraction" | "pageTurn" | import("react-native").AccessibilityTrait[] | undefined> | undefined; + accessibilityTraits?: PropTypes.Validator<"none" | "button" | "header" | "link" | "summary" | "image" | "text" | "search" | "adjustable" | "disabled" | "selected" | "plays" | "key" | "frequentUpdates" | "startsMedia" | "allowsDirectInteraction" | "pageTurn" | import("react-native").AccessibilityTrait[] | undefined> | undefined; accessibilityViewIsModal?: PropTypes.Validator | undefined; onAccessibilityEscape?: PropTypes.Validator<(() => void) | undefined> | undefined; onAccessibilityTap?: PropTypes.Validator<(() => void) | undefined> | undefined; diff --git a/packages/expo-gl/build/createElement.native.d.ts b/packages/expo-gl/build/createElement.native.d.ts new file mode 100644 index 0000000000000..7d22d263fae93 --- /dev/null +++ b/packages/expo-gl/build/createElement.native.d.ts @@ -0,0 +1 @@ +export { createElement } from 'react-native'; diff --git a/packages/expo-gl/build/createElement.native.js b/packages/expo-gl/build/createElement.native.js new file mode 100644 index 0000000000000..1c89c3f5a0fda --- /dev/null +++ b/packages/expo-gl/build/createElement.native.js @@ -0,0 +1,2 @@ +export { createElement } from 'react-native'; +//# sourceMappingURL=createElement.native.js.map \ No newline at end of file diff --git a/packages/expo-gl/build/createElement.native.js.map b/packages/expo-gl/build/createElement.native.js.map new file mode 100644 index 0000000000000..e101aa2504f84 --- /dev/null +++ b/packages/expo-gl/build/createElement.native.js.map @@ -0,0 +1 @@ +{"version":3,"file":"createElement.native.js","sourceRoot":"","sources":["../src/createElement.native.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export { createElement } from 'react-native';\n"]} \ No newline at end of file diff --git a/packages/expo-gl/build/createElement.web.d.ts b/packages/expo-gl/build/createElement.web.d.ts new file mode 100644 index 0000000000000..6076505ce7d66 --- /dev/null +++ b/packages/expo-gl/build/createElement.web.d.ts @@ -0,0 +1,2 @@ +import { createElement as cE } from 'react-native'; +export declare const createElement: typeof cE; diff --git a/packages/expo-gl/build/createElement.web.js b/packages/expo-gl/build/createElement.web.js new file mode 100644 index 0000000000000..133c4b1fc6ccc --- /dev/null +++ b/packages/expo-gl/build/createElement.web.js @@ -0,0 +1,9 @@ +// Due to https://github.com/necolas/react-native-web/blob/5287044f403d881a13e17f140c5575ce0661587f/packages/react-native-web/src/index.js#L1 +// See https://github.com/react-native-community/react-native-svg/blob/develop/src/ReactNativeSVG.web.ts +import { +// @ts-ignore +unstable_createElement as ucE, +// @ts-ignore +createElement as cE, } from 'react-native'; +export const createElement = cE || ucE; +//# sourceMappingURL=createElement.web.js.map \ No newline at end of file diff --git a/packages/expo-gl/build/createElement.web.js.map b/packages/expo-gl/build/createElement.web.js.map new file mode 100644 index 0000000000000..587d632c5129e --- /dev/null +++ b/packages/expo-gl/build/createElement.web.js.map @@ -0,0 +1 @@ +{"version":3,"file":"createElement.web.js","sourceRoot":"","sources":["../src/createElement.web.tsx"],"names":[],"mappings":"AAAA,6IAA6I;AAC7I,wGAAwG;AAExG,OAAO;AACL,aAAa;AACb,sBAAsB,IAAI,GAAG;AAC7B,aAAa;AACb,aAAa,IAAI,EAAE,GACpB,MAAM,cAAc,CAAC;AAEtB,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,IAAI,GAAG,CAAC","sourcesContent":["// Due to https://github.com/necolas/react-native-web/blob/5287044f403d881a13e17f140c5575ce0661587f/packages/react-native-web/src/index.js#L1\n// See https://github.com/react-native-community/react-native-svg/blob/develop/src/ReactNativeSVG.web.ts\n\nimport {\n // @ts-ignore\n unstable_createElement as ucE,\n // @ts-ignore\n createElement as cE,\n} from 'react-native';\n\nexport const createElement = cE || ucE;\n"]} \ No newline at end of file diff --git a/packages/expo-gl/src/Canvas.tsx b/packages/expo-gl/src/Canvas.tsx index 39f89456fcedd..f331bc0df27ea 100644 --- a/packages/expo-gl/src/Canvas.tsx +++ b/packages/expo-gl/src/Canvas.tsx @@ -1,13 +1,9 @@ import * as React from 'react'; import { findDOMNode } from 'react-dom'; -import { - createElement, - LayoutChangeEvent, - PixelRatio, - StyleSheet, - View, - ViewProps, -} from 'react-native'; +import { LayoutChangeEvent, PixelRatio, StyleSheet, View, ViewProps } from 'react-native'; + +// @ts-ignore +import { createElement } from './createElement'; function getElement(component) { try { diff --git a/packages/expo-gl/src/createElement.native.tsx b/packages/expo-gl/src/createElement.native.tsx new file mode 100644 index 0000000000000..7d22d263fae93 --- /dev/null +++ b/packages/expo-gl/src/createElement.native.tsx @@ -0,0 +1 @@ +export { createElement } from 'react-native'; diff --git a/packages/expo-gl/src/createElement.web.tsx b/packages/expo-gl/src/createElement.web.tsx new file mode 100644 index 0000000000000..033e5bb4ebd6e --- /dev/null +++ b/packages/expo-gl/src/createElement.web.tsx @@ -0,0 +1,11 @@ +// Due to https://github.com/necolas/react-native-web/blob/5287044f403d881a13e17f140c5575ce0661587f/packages/react-native-web/src/index.js#L1 +// See https://github.com/react-native-community/react-native-svg/blob/develop/src/ReactNativeSVG.web.ts + +import { + // @ts-ignore + unstable_createElement as ucE, + // @ts-ignore + createElement as cE, +} from 'react-native'; + +export const createElement = cE || ucE;