expo-gl 15.1.2 → 15.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/android/build.gradle +2 -2
- package/build/Canvas.d.ts.map +1 -1
- package/build/Canvas.js +25 -22
- package/build/Canvas.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.aar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.aar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.aar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.aar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/{15.1.2/expo.modules.gl-15.1.2.module → 15.1.3/expo.modules.gl-15.1.3.module} +17 -17
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.module.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/{15.1.2/expo.modules.gl-15.1.2.pom → 15.1.3/expo.modules.gl-15.1.3.pom} +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.pom.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/maven-metadata.xml +4 -4
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/maven-metadata.xml.sha512 +1 -1
- package/package.json +2 -2
- package/src/Canvas.tsx +51 -35
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.aar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.aar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.aar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.aar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.module.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.module.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.module.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.module.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.pom.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.pom.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.pom.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.pom.sha512 +0 -1
- /package/local-maven-repo/host/exp/exponent/expo.modules.gl/{15.1.2/expo.modules.gl-15.1.2-sources.jar → 15.1.3/expo.modules.gl-15.1.3-sources.jar} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.gl/{15.1.2/expo.modules.gl-15.1.2-sources.jar.md5 → 15.1.3/expo.modules.gl-15.1.3-sources.jar.md5} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.gl/{15.1.2/expo.modules.gl-15.1.2-sources.jar.sha1 → 15.1.3/expo.modules.gl-15.1.3-sources.jar.sha1} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.gl/{15.1.2/expo.modules.gl-15.1.2-sources.jar.sha256 → 15.1.3/expo.modules.gl-15.1.3-sources.jar.sha256} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.gl/{15.1.2/expo.modules.gl-15.1.2-sources.jar.sha512 → 15.1.3/expo.modules.gl-15.1.3-sources.jar.sha512} +0 -0
package/CHANGELOG.md
CHANGED
package/android/build.gradle
CHANGED
|
@@ -9,7 +9,7 @@ def reactNativeArchitectures() {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
group = 'host.exp.exponent'
|
|
12
|
-
version = '15.1.
|
|
12
|
+
version = '15.1.3'
|
|
13
13
|
|
|
14
14
|
android {
|
|
15
15
|
if (rootProject.hasProperty("ndkPath")) {
|
|
@@ -22,7 +22,7 @@ android {
|
|
|
22
22
|
namespace "expo.modules.gl"
|
|
23
23
|
defaultConfig {
|
|
24
24
|
versionCode 31
|
|
25
|
-
versionName "15.1.
|
|
25
|
+
versionName "15.1.3"
|
|
26
26
|
|
|
27
27
|
externalNativeBuild {
|
|
28
28
|
cmake {
|
package/build/Canvas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../src/Canvas.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAmD,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../src/Canvas.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAmD,SAAS,EAAE,MAAM,cAAc,CAAC;AAgD1F,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,iBAAiB,CAC1C,SAAS,GAAG;IACV,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;CACzC,CAmEF,CAAC;AAQF,eAAe,aAAa,CAAC"}
|
package/build/Canvas.js
CHANGED
|
@@ -21,45 +21,48 @@ function setRef(refProp, ref) {
|
|
|
21
21
|
refProp.current = ref;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
function getSize({ size, ref }) {
|
|
25
|
+
if (size) {
|
|
26
|
+
return size;
|
|
27
|
+
}
|
|
28
|
+
else if (!ref.current || typeof window === 'undefined') {
|
|
29
|
+
return { width: 0, height: 0 };
|
|
30
|
+
}
|
|
31
|
+
const element = getElement(ref.current);
|
|
32
|
+
const { offsetWidth: width = 0, offsetHeight: height = 0 } = element;
|
|
33
|
+
return { width, height };
|
|
34
|
+
}
|
|
24
35
|
const Canvas = React.forwardRef((props, ref) => createElement('canvas', { ...props, ref }));
|
|
25
36
|
const CanvasWrapper = ({ pointerEvents, children, style, ...props }) => {
|
|
26
37
|
const [size, setSize] = React.useState(null);
|
|
27
38
|
const ref = React.useRef(null);
|
|
28
39
|
const _canvasRef = React.useRef(null);
|
|
29
|
-
|
|
40
|
+
const updateCanvasSize = React.useCallback(() => {
|
|
30
41
|
const canvas = _canvasRef.current;
|
|
31
42
|
if (typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement) {
|
|
32
|
-
const
|
|
43
|
+
const currentSize = getSize({
|
|
44
|
+
size,
|
|
45
|
+
ref,
|
|
46
|
+
});
|
|
33
47
|
const scale = PixelRatio.get();
|
|
34
|
-
canvas.style.width = `${
|
|
35
|
-
canvas.style.height = `${
|
|
36
|
-
canvas.width =
|
|
37
|
-
canvas.height =
|
|
48
|
+
canvas.style.width = `${currentSize.width}px`;
|
|
49
|
+
canvas.style.height = `${currentSize.height}px`;
|
|
50
|
+
canvas.width = currentSize.width * scale;
|
|
51
|
+
canvas.height = currentSize.height * scale;
|
|
38
52
|
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (size) {
|
|
42
|
-
return size;
|
|
43
|
-
}
|
|
44
|
-
else if (!ref.current || typeof window === 'undefined') {
|
|
45
|
-
return { width: 0, height: 0 };
|
|
46
|
-
}
|
|
47
|
-
const element = getElement(ref.current);
|
|
48
|
-
const { offsetWidth: width = 0, offsetHeight: height = 0 } = element;
|
|
49
|
-
return { width, height };
|
|
50
|
-
}
|
|
51
|
-
const onLayout = (event) => {
|
|
53
|
+
}, [size?.width, size?.height]);
|
|
54
|
+
const onLayout = React.useCallback((event) => {
|
|
52
55
|
const { nativeEvent: { layout: { width, height }, }, } = event;
|
|
53
|
-
if (width !== size?.width || height !== size
|
|
56
|
+
if (width !== size?.width || height !== size?.height) {
|
|
54
57
|
setSize({ width, height });
|
|
55
58
|
if (props.onLayout) {
|
|
56
59
|
props.onLayout(event);
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
|
-
};
|
|
62
|
+
}, [size?.width, size?.height, props.onLayout]);
|
|
60
63
|
React.useEffect(() => {
|
|
61
64
|
if (ref.current != null) {
|
|
62
|
-
setSize(getSize());
|
|
65
|
+
setSize(getSize({ size, ref }));
|
|
63
66
|
}
|
|
64
67
|
}, [ref]);
|
|
65
68
|
React.useEffect(() => {
|
package/build/Canvas.js.map
CHANGED
|
@@ -1 +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,EAAqB,UAAU,EAAE,UAAU,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;AAC1F,OAAO,aAAa,MAAM,6CAA6C,CAAC;
|
|
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,EAAqB,UAAU,EAAE,UAAU,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;AAC1F,OAAO,aAAa,MAAM,6CAA6C,CAAC;AAYxE,SAAS,UAAU,CAAC,SAA8B;IAChD,IAAI,CAAC;QACH,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CAAI,OAAqB,EAAE,GAAa;IACrD,IAAI,CAAC,OAAO;QAAE,OAAO;IAErB,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;SAAM,IAAI,SAAS,IAAI,OAAO,EAAE,CAAC;QAChC,aAAa;QACb,OAAO,CAAC,OAAO,GAAG,GAAG,CAAC;IACxB,CAAC;AACH,CAAC;AAED,SAAS,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,EAAiB;IAC3C,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,IAAI,CAAC;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ACnB,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,CAAC;YACX,gBAAgB,EAAE,CAAC;QACrB,CAAC;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,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAC5E;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,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE;QACP,aAAa,EAAE,UAAU;KAC1B;CACF,CAAC,CAAC;AAEH,eAAe,aAAa,CAAC","sourcesContent":["import * as React from 'react';\nimport { findDOMNode } from 'react-dom';\nimport { LayoutChangeEvent, PixelRatio, StyleSheet, View, ViewProps } from 'react-native';\nimport createElement from 'react-native-web/dist/exports/createElement';\n\ninterface Size {\n width: number;\n height: number;\n}\n\ninterface GetSizeParams {\n size: Size | null;\n ref: React.RefObject<View | null>;\n}\n\nfunction getElement(component: React.ReactInstance): React.ReactInstance | Element | null | Text {\n try {\n return findDOMNode(component);\n } catch {\n return component;\n }\n}\n\nfunction setRef<T>(refProp: React.Ref<T>, 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\nfunction getSize({ size, ref }: GetSizeParams): Size {\n if (size) {\n return size;\n } else if (!ref.current || typeof window === 'undefined') {\n return { width: 0, height: 0 };\n }\n const element = getElement(ref.current);\n const { offsetWidth: width = 0, offsetHeight: height = 0 } = element as HTMLElement;\n return { width, height };\n}\n\nconst Canvas = React.forwardRef(\n (props: React.ComponentProps<typeof View>, ref: React.Ref<HTMLCanvasElement>) =>\n createElement('canvas', { ...props, ref })\n);\n\nconst CanvasWrapper: React.FunctionComponent<\n ViewProps & {\n canvasRef: React.Ref<HTMLCanvasElement>;\n }\n> = ({ pointerEvents, children, style, ...props }) => {\n const [size, setSize] = React.useState<Size | null>(null);\n\n const ref = React.useRef<View>(null);\n const _canvasRef = React.useRef<HTMLCanvasElement>(null);\n\n const updateCanvasSize = React.useCallback(() => {\n const canvas = _canvasRef.current;\n if (typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement) {\n const currentSize = getSize({\n size,\n ref,\n });\n const scale = PixelRatio.get();\n\n canvas.style.width = `${currentSize.width}px`;\n canvas.style.height = `${currentSize.height}px`;\n\n canvas.width = currentSize.width * scale;\n canvas.height = currentSize.height * scale;\n }\n }, [size?.width, size?.height]);\n\n const onLayout = React.useCallback(\n (event: LayoutChangeEvent) => {\n const {\n nativeEvent: {\n layout: { width, height },\n },\n } = event;\n\n if (width !== size?.width || height !== size?.height) {\n setSize({ width, height });\n\n if (props.onLayout) {\n props.onLayout(event);\n }\n }\n },\n [size?.width, size?.height, props.onLayout]\n );\n\n React.useEffect(() => {\n if (ref.current != null) {\n setSize(getSize({ size, ref }));\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 <View {...props} style={[styles.wrapper, style]} ref={ref} onLayout={onLayout}>\n <Canvas ref={_canvasRef} pointerEvents={pointerEvents} style={StyleSheet.absoluteFill} />\n {children}\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n wrapper: {\n pointerEvents: 'box-none',\n },\n});\n\nexport default CanvasWrapper;\n"]}
|
package/expo-module.config.json
CHANGED
|
Binary file
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.aar.md5
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
bc2205946f52f8687796cf32c928e98b
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.aar.sha1
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ea4a22150ad11afe7d32c0fb5f56e9684c822ee6
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.aar.sha256
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
c222c645d235d4f68e0b94f3d9d054d413bfc53763daa19d4d4c01bca0050cde
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.aar.sha512
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
8f78010c50080eabf5f733bcf30b6c135eb8aff446d17427f408fc847f369b952f2905c1c63e90a562bb9a826ced38b7f27341067ee7ae973a0663107d1be74f
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "host.exp.exponent",
|
|
5
5
|
"module": "expo.modules.gl",
|
|
6
|
-
"version": "15.1.
|
|
6
|
+
"version": "15.1.3",
|
|
7
7
|
"attributes": {
|
|
8
8
|
"org.gradle.status": "release"
|
|
9
9
|
}
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
{
|
|
27
|
-
"name": "expo.modules.gl-15.1.
|
|
28
|
-
"url": "expo.modules.gl-15.1.
|
|
29
|
-
"size":
|
|
30
|
-
"sha512": "
|
|
31
|
-
"sha256": "
|
|
32
|
-
"sha1": "
|
|
33
|
-
"md5": "
|
|
27
|
+
"name": "expo.modules.gl-15.1.3.aar",
|
|
28
|
+
"url": "expo.modules.gl-15.1.3.aar",
|
|
29
|
+
"size": 1044040,
|
|
30
|
+
"sha512": "8f78010c50080eabf5f733bcf30b6c135eb8aff446d17427f408fc847f369b952f2905c1c63e90a562bb9a826ced38b7f27341067ee7ae973a0663107d1be74f",
|
|
31
|
+
"sha256": "c222c645d235d4f68e0b94f3d9d054d413bfc53763daa19d4d4c01bca0050cde",
|
|
32
|
+
"sha1": "ea4a22150ad11afe7d32c0fb5f56e9684c822ee6",
|
|
33
|
+
"md5": "bc2205946f52f8687796cf32c928e98b"
|
|
34
34
|
}
|
|
35
35
|
]
|
|
36
36
|
},
|
|
@@ -53,13 +53,13 @@
|
|
|
53
53
|
],
|
|
54
54
|
"files": [
|
|
55
55
|
{
|
|
56
|
-
"name": "expo.modules.gl-15.1.
|
|
57
|
-
"url": "expo.modules.gl-15.1.
|
|
58
|
-
"size":
|
|
59
|
-
"sha512": "
|
|
60
|
-
"sha256": "
|
|
61
|
-
"sha1": "
|
|
62
|
-
"md5": "
|
|
56
|
+
"name": "expo.modules.gl-15.1.3.aar",
|
|
57
|
+
"url": "expo.modules.gl-15.1.3.aar",
|
|
58
|
+
"size": 1044040,
|
|
59
|
+
"sha512": "8f78010c50080eabf5f733bcf30b6c135eb8aff446d17427f408fc847f369b952f2905c1c63e90a562bb9a826ced38b7f27341067ee7ae973a0663107d1be74f",
|
|
60
|
+
"sha256": "c222c645d235d4f68e0b94f3d9d054d413bfc53763daa19d4d4c01bca0050cde",
|
|
61
|
+
"sha1": "ea4a22150ad11afe7d32c0fb5f56e9684c822ee6",
|
|
62
|
+
"md5": "bc2205946f52f8687796cf32c928e98b"
|
|
63
63
|
}
|
|
64
64
|
]
|
|
65
65
|
},
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
},
|
|
74
74
|
"files": [
|
|
75
75
|
{
|
|
76
|
-
"name": "expo.modules.gl-15.1.
|
|
77
|
-
"url": "expo.modules.gl-15.1.
|
|
76
|
+
"name": "expo.modules.gl-15.1.3-sources.jar",
|
|
77
|
+
"url": "expo.modules.gl-15.1.3-sources.jar",
|
|
78
78
|
"size": 12381,
|
|
79
79
|
"sha512": "1cab724074b050f7459a884ac9e98fbf2d009d8239810ca6384c5113f52dd33e5ac40a72ec7174b297e1b10521e56682d73f533715316be5be66ce0e482356d8",
|
|
80
80
|
"sha256": "e8892c6837d1eb5093b2c3b063883d7511799b0e246940c5b70f1515cb4451cd",
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.module.md5
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a5e0b5b8325ec1781a75ea6aac916d58
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.module.sha1
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4cba9b1fdf6b9a694217778462086271a7aac442
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2e2ca5c3083df52b05f7b4e3fa9699e97cb80d1c1fba4e82efee3b08259a6938
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
b1c093682d8252d2c4571b80fa6889a59a81fadf00c0291ae7b7d660320cf43ba6d73506d2162103ad1915157f3e36b2a1eca9733912ad243a84febcfb04782e
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<modelVersion>4.0.0</modelVersion>
|
|
10
10
|
<groupId>host.exp.exponent</groupId>
|
|
11
11
|
<artifactId>expo.modules.gl</artifactId>
|
|
12
|
-
<version>15.1.
|
|
12
|
+
<version>15.1.3</version>
|
|
13
13
|
<packaging>aar</packaging>
|
|
14
14
|
<name>expo.modules.gl</name>
|
|
15
15
|
<url>https://github.com/expo/expo</url>
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.pom.md5
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a84c54bcedca3698d012788b1de62bdd
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.pom.sha1
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4a4b75d910bafda9959e551d613350a624b31871
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.pom.sha256
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
28146979c88071bee155097cfaeeac90ee4b1260ffef07bcd7c6987697df5268
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.3/expo.modules.gl-15.1.3.pom.sha512
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
63eed8341d652ac5ae17c539b138b44af5a2ff6ab4fb1d0e882a0003ae624216248c41f6fdeba4f5e0f1233df4fffb1342012861b15c16b06c8efc751f2b8270
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<groupId>host.exp.exponent</groupId>
|
|
4
4
|
<artifactId>expo.modules.gl</artifactId>
|
|
5
5
|
<versioning>
|
|
6
|
-
<latest>15.1.
|
|
7
|
-
<release>15.1.
|
|
6
|
+
<latest>15.1.3</latest>
|
|
7
|
+
<release>15.1.3</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>15.1.
|
|
9
|
+
<version>15.1.3</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20250421213338</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
45415ced62aeb7f1af589b64139d29f5
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4222179f4b6d7fd25b98fe3539f4df596db5cbea
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
291d415e2cba917775d886a852c231c4f9e42bb05b8b68da387ba4f2ab6686d1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
d22b0c84d6bf32003ffe24e947c51d686ad113376fd184413df4cb3e2aa6047424311f379529fdf8b0e04f88de1686cbfa355bf154b9b280632f1c4d680991c3
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-gl",
|
|
3
|
-
"version": "15.1.
|
|
3
|
+
"version": "15.1.3",
|
|
4
4
|
"description": "Provides GLView that acts as OpenGL ES render target and gives GL context object implementing WebGL 2.0 specification.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"optional": true
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "f1394f21ff2719a9a3037d7511db170704e5c492"
|
|
61
61
|
}
|
package/src/Canvas.tsx
CHANGED
|
@@ -3,6 +3,16 @@ import { findDOMNode } from 'react-dom';
|
|
|
3
3
|
import { LayoutChangeEvent, PixelRatio, StyleSheet, View, ViewProps } from 'react-native';
|
|
4
4
|
import createElement from 'react-native-web/dist/exports/createElement';
|
|
5
5
|
|
|
6
|
+
interface Size {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface GetSizeParams {
|
|
12
|
+
size: Size | null;
|
|
13
|
+
ref: React.RefObject<View | null>;
|
|
14
|
+
}
|
|
15
|
+
|
|
6
16
|
function getElement(component: React.ReactInstance): React.ReactInstance | Element | null | Text {
|
|
7
17
|
try {
|
|
8
18
|
return findDOMNode(component);
|
|
@@ -22,6 +32,17 @@ function setRef<T>(refProp: React.Ref<T>, ref: T | null) {
|
|
|
22
32
|
}
|
|
23
33
|
}
|
|
24
34
|
|
|
35
|
+
function getSize({ size, ref }: GetSizeParams): Size {
|
|
36
|
+
if (size) {
|
|
37
|
+
return size;
|
|
38
|
+
} else if (!ref.current || typeof window === 'undefined') {
|
|
39
|
+
return { width: 0, height: 0 };
|
|
40
|
+
}
|
|
41
|
+
const element = getElement(ref.current);
|
|
42
|
+
const { offsetWidth: width = 0, offsetHeight: height = 0 } = element as HTMLElement;
|
|
43
|
+
return { width, height };
|
|
44
|
+
}
|
|
45
|
+
|
|
25
46
|
const Canvas = React.forwardRef(
|
|
26
47
|
(props: React.ComponentProps<typeof View>, ref: React.Ref<HTMLCanvasElement>) =>
|
|
27
48
|
createElement('canvas', { ...props, ref })
|
|
@@ -32,55 +53,50 @@ const CanvasWrapper: React.FunctionComponent<
|
|
|
32
53
|
canvasRef: React.Ref<HTMLCanvasElement>;
|
|
33
54
|
}
|
|
34
55
|
> = ({ pointerEvents, children, style, ...props }) => {
|
|
35
|
-
const [size, setSize] = React.useState<
|
|
56
|
+
const [size, setSize] = React.useState<Size | null>(null);
|
|
36
57
|
|
|
37
58
|
const ref = React.useRef<View>(null);
|
|
38
59
|
const _canvasRef = React.useRef<HTMLCanvasElement>(null);
|
|
39
60
|
|
|
40
|
-
|
|
61
|
+
const updateCanvasSize = React.useCallback(() => {
|
|
41
62
|
const canvas = _canvasRef.current;
|
|
42
63
|
if (typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement) {
|
|
43
|
-
const
|
|
64
|
+
const currentSize = getSize({
|
|
65
|
+
size,
|
|
66
|
+
ref,
|
|
67
|
+
});
|
|
44
68
|
const scale = PixelRatio.get();
|
|
45
69
|
|
|
46
|
-
canvas.style.width = `${
|
|
47
|
-
canvas.style.height = `${
|
|
48
|
-
|
|
49
|
-
canvas.width = size.width * scale;
|
|
50
|
-
canvas.height = size.height * scale;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
70
|
+
canvas.style.width = `${currentSize.width}px`;
|
|
71
|
+
canvas.style.height = `${currentSize.height}px`;
|
|
53
72
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return size;
|
|
57
|
-
} else if (!ref.current || typeof window === 'undefined') {
|
|
58
|
-
return { width: 0, height: 0 };
|
|
73
|
+
canvas.width = currentSize.width * scale;
|
|
74
|
+
canvas.height = currentSize.height * scale;
|
|
59
75
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
props.onLayout(event);
|
|
76
|
+
}, [size?.width, size?.height]);
|
|
77
|
+
|
|
78
|
+
const onLayout = React.useCallback(
|
|
79
|
+
(event: LayoutChangeEvent) => {
|
|
80
|
+
const {
|
|
81
|
+
nativeEvent: {
|
|
82
|
+
layout: { width, height },
|
|
83
|
+
},
|
|
84
|
+
} = event;
|
|
85
|
+
|
|
86
|
+
if (width !== size?.width || height !== size?.height) {
|
|
87
|
+
setSize({ width, height });
|
|
88
|
+
|
|
89
|
+
if (props.onLayout) {
|
|
90
|
+
props.onLayout(event);
|
|
91
|
+
}
|
|
77
92
|
}
|
|
78
|
-
}
|
|
79
|
-
|
|
93
|
+
},
|
|
94
|
+
[size?.width, size?.height, props.onLayout]
|
|
95
|
+
);
|
|
80
96
|
|
|
81
97
|
React.useEffect(() => {
|
|
82
98
|
if (ref.current != null) {
|
|
83
|
-
setSize(getSize());
|
|
99
|
+
setSize(getSize({ size, ref }));
|
|
84
100
|
}
|
|
85
101
|
}, [ref]);
|
|
86
102
|
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.aar
DELETED
|
Binary file
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.aar.md5
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
abbfb2cd09e7dc57d480c0d623e7fe90
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.aar.sha1
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
38f6d9e29f69a67ff7f07c60b7579c8215210c96
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.aar.sha256
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
6d8b8667da77b17356443b62170d2e4be9ecc56ab3d134456bb93334d0ea6584
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.aar.sha512
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
f91f6be8c66741bf857a39bfbbe858f34193ba0eb1cf2f00e0b48734bb5b2d7c43d2bfb5a6cffac2b01c28d3c958dbd6549334ff11e122dd9ed80bb5b75a7194
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.module.md5
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
29e561f8ebb945a330ee02c0a75c2737
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.module.sha1
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
444fa02a8e892d377e3d4bcd9b0692974fc7804d
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
c446f7e365c70ba89cce0e41dc7a9fd23fdcbf2ac36c5d1abe787c4d80b21009
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
e53ac2d909f8d988faff892e026efc28617a2a3c8b9793c96cc81ca123bfee09abfd35e2a98ef88bd20de7d6c1fe534bba75bbeeb4122d98ee28686ea2c5ae67
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.pom.md5
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
03d7e62564cefcfe24b0aed8cbf9718f
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.pom.sha1
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
8baf6165b52b9bfceec96d084732e5f7833e45b2
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.pom.sha256
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
7693fbe2a0ade6abefe8c4fd3e5fa5ad7011cf3fc24f5d1bae987f5affaf5087
|
package/local-maven-repo/host/exp/exponent/expo.modules.gl/15.1.2/expo.modules.gl-15.1.2.pom.sha512
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0eae926ad3cdc9e01377942b26957dab2c772c032bf4f027877606ac9e8cfb78bb18a036ecb3861e6b6385f59284c041a7f0b840e7d5216f8f0edb59bdb80ced
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|