expo-gl 11.2.1 → 11.2.2

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 CHANGED
@@ -10,6 +10,12 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 11.2.2 — 2022-04-21
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Fix import errors when option `inlineRequires` is enabled in `metro.config.js`. ([#17141](https://github.com/expo/expo/pull/17141) by [@wkozyra95](https://github.com/wkozyra95))
18
+
13
19
  ## 11.2.1 — 2022-04-20
14
20
 
15
21
  _This version does not introduce any user-facing changes._
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '11.2.1'
6
+ version = '11.2.2'
7
7
 
8
8
  buildscript {
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -74,7 +74,7 @@ android {
74
74
  minSdkVersion safeExtGet("minSdkVersion", 21)
75
75
  targetSdkVersion safeExtGet("targetSdkVersion", 31)
76
76
  versionCode 31
77
- versionName "11.2.1"
77
+ versionName "11.2.2"
78
78
  }
79
79
 
80
80
  sourceSets.main {
@@ -1 +1 @@
1
- {"version":3,"file":"GLView.d.ts","sourceRoot":"","sources":["../src/GLView.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,yBAAyB,EACzB,eAAe,EACf,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;CACZ;AAMD,oBAAY,WAAW,GAAG;IACxB;;;OAGG;IACH,eAAe,CAAC,EAAE,EAAE,yBAAyB,GAAG,IAAI,CAAC;IAErD;;OAEG;IACH,WAAW,EAAE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AO,CAAC;IAO3D,iBAAiB,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,UAAU,CAAC;CAO5E"}
package/build/GLView.js CHANGED
@@ -2,6 +2,7 @@ import { NativeModulesProxy, UnavailabilityError, requireNativeViewManager, Code
2
2
  import * as React from 'react';
3
3
  import { Platform, View, findNodeHandle } from 'react-native';
4
4
  import { configureLogging } from './GLUtils';
5
+ import { createWorkletContextProvider } from './GLWorkletContextProvider';
5
6
  const { ExponentGLObjectManager, ExponentGLViewManager } = NativeModulesProxy;
6
7
  const NativeView = requireNativeViewManager('ExponentGLView');
7
8
  /**
@@ -24,22 +25,7 @@ export class GLView extends React.Component {
24
25
  const exglCtxId = getContextId(exgl);
25
26
  return ExponentGLObjectManager.takeSnapshotAsync(exglCtxId, options);
26
27
  }
27
- static getWorkletContext = (function () {
28
- try {
29
- // reanimated needs to be imported before any workletized code
30
- // is created, but we don't want to make it dependency on expo-gl.
31
- require('react-native-reanimated');
32
- return (contextId) => {
33
- 'worklet';
34
- return global.__EXGLContexts?.[String(contextId)];
35
- };
36
- }
37
- catch {
38
- return () => {
39
- throw new Error('Worklet runtime is not available');
40
- };
41
- }
42
- })();
28
+ static getWorkletContext = createWorkletContextProvider();
43
29
  nativeRef = null;
44
30
  exglCtxId;
45
31
  render() {
@@ -1 +1 @@
1
- {"version":3,"file":"GLView.js","sourceRoot":"","sources":["../src/GLView.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,UAAU,GACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAgB7C,MAAM,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,GAAG,kBAAkB,CAAC;AAoB9E,MAAM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,MAAM,KAAK,GAAG,CAAC,SAAiB,EAA6B,EAAE;IAC7D,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE;QAC1B,MAAM,IAAI,UAAU,CAClB,sBAAsB,EACtB,mHAAmH,CACpH,CAAC;KACH;IACD,MAAM,EAAE,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAEpD,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAErB,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,IAAyC,EAAU,EAAE;IACzE,MAAM,SAAS,GAAG,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;IAE3E,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;QAC/C,MAAM,IAAI,KAAK,CAAC,2BAA2B,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;KACjE;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import {\n NativeModulesProxy,\n UnavailabilityError,\n requireNativeViewManager,\n CodedError,\n} from 'expo-modules-core';\nimport * as React from 'react';\nimport { Platform, View, findNodeHandle } from 'react-native';\n\nimport { configureLogging } from './GLUtils';\nimport {\n ComponentOrHandle,\n SurfaceCreateEvent,\n GLSnapshot,\n ExpoWebGLRenderingContext,\n SnapshotOptions,\n BaseGLViewProps,\n} from './GLView.types';\n\nexport interface WebGLObject {\n id: number;\n}\n\ndeclare let global: any;\n\nconst { ExponentGLObjectManager, ExponentGLViewManager } = NativeModulesProxy;\n\nexport type GLViewProps = {\n /**\n * Called when the OpenGL context is created, with the context object as a parameter. The context\n * object has an API mirroring WebGL's WebGLRenderingContext.\n */\n onContextCreate(gl: ExpoWebGLRenderingContext): void;\n\n /**\n * [iOS only] Number of samples for Apple's built-in multisampling.\n */\n msaaSamples: number;\n\n /**\n * A ref callback for the native GLView\n */\n nativeRef_EXPERIMENTAL?(callback: ComponentOrHandle | null);\n} & BaseGLViewProps;\n\nconst NativeView = requireNativeViewManager('ExponentGLView');\n\n/**\n * A component that acts as an OpenGL render target\n */\nexport class GLView extends React.Component<GLViewProps> {\n static NativeView: any;\n\n static defaultProps = {\n msaaSamples: 4,\n };\n\n static async createContextAsync(): Promise<ExpoWebGLRenderingContext> {\n const { exglCtxId } = await ExponentGLObjectManager.createContextAsync();\n return getGl(exglCtxId);\n }\n\n static async destroyContextAsync(exgl?: ExpoWebGLRenderingContext | number): Promise<boolean> {\n const exglCtxId = getContextId(exgl);\n return ExponentGLObjectManager.destroyContextAsync(exglCtxId);\n }\n\n static async takeSnapshotAsync(\n exgl?: ExpoWebGLRenderingContext | number,\n options: SnapshotOptions = {}\n ): Promise<GLSnapshot> {\n const exglCtxId = getContextId(exgl);\n return ExponentGLObjectManager.takeSnapshotAsync(exglCtxId, options);\n }\n\n static getWorkletContext: (contextId: number) => ExpoWebGLRenderingContext | undefined =\n (function () {\n try {\n // reanimated needs to be imported before any workletized code\n // is created, but we don't want to make it dependency on expo-gl.\n require('react-native-reanimated');\n return (contextId: number): ExpoWebGLRenderingContext | undefined => {\n 'worklet';\n return global.__EXGLContexts?.[String(contextId)];\n };\n } catch {\n return () => {\n throw new Error('Worklet runtime is not available');\n };\n }\n })();\n\n nativeRef: ComponentOrHandle = null;\n exglCtxId?: number;\n\n render() {\n const {\n onContextCreate, // eslint-disable-line no-unused-vars\n msaaSamples,\n ...viewProps\n } = this.props;\n\n return (\n <View {...viewProps}>\n <NativeView\n ref={this._setNativeRef}\n style={{\n flex: 1,\n ...(Platform.OS === 'ios'\n ? {\n backgroundColor: 'transparent',\n }\n : {}),\n }}\n onSurfaceCreate={this._onSurfaceCreate}\n msaaSamples={Platform.OS === 'ios' ? msaaSamples : undefined}\n />\n </View>\n );\n }\n\n _setNativeRef = (nativeRef: ComponentOrHandle): void => {\n if (this.props.nativeRef_EXPERIMENTAL) {\n this.props.nativeRef_EXPERIMENTAL(nativeRef);\n }\n this.nativeRef = nativeRef;\n };\n\n _onSurfaceCreate = ({ nativeEvent: { exglCtxId } }: SurfaceCreateEvent): void => {\n const gl = getGl(exglCtxId);\n\n this.exglCtxId = exglCtxId;\n\n if (this.props.onContextCreate) {\n this.props.onContextCreate(gl);\n }\n };\n\n async startARSessionAsync(): Promise<any> {\n if (!ExponentGLViewManager.startARSessionAsync) {\n throw new UnavailabilityError('expo-gl', 'startARSessionAsync');\n }\n return await ExponentGLViewManager.startARSessionAsync(findNodeHandle(this.nativeRef));\n }\n\n async createCameraTextureAsync(cameraRefOrHandle: ComponentOrHandle): Promise<WebGLTexture> {\n if (!ExponentGLObjectManager.createCameraTextureAsync) {\n throw new UnavailabilityError('expo-gl', 'createCameraTextureAsync');\n }\n\n const { exglCtxId } = this;\n\n if (!exglCtxId) {\n throw new Error(\"GLView's surface is not created yet!\");\n }\n\n const cameraTag = findNodeHandle(cameraRefOrHandle);\n const { exglObjId } = await ExponentGLObjectManager.createCameraTextureAsync(\n exglCtxId,\n cameraTag\n );\n return { id: exglObjId } as WebGLTexture;\n }\n\n async destroyObjectAsync(glObject: WebGLObject): Promise<boolean> {\n if (!ExponentGLObjectManager.destroyObjectAsync) {\n throw new UnavailabilityError('expo-gl', 'destroyObjectAsync');\n }\n return await ExponentGLObjectManager.destroyObjectAsync(glObject.id);\n }\n\n async takeSnapshotAsync(options: SnapshotOptions = {}): Promise<GLSnapshot> {\n if (!GLView.takeSnapshotAsync) {\n throw new UnavailabilityError('expo-gl', 'takeSnapshotAsync');\n }\n const { exglCtxId } = this;\n return await GLView.takeSnapshotAsync(exglCtxId, options);\n }\n}\n\nGLView.NativeView = NativeView;\n\n// Get the GL interface from an EXGLContextId\nconst getGl = (exglCtxId: number): ExpoWebGLRenderingContext => {\n if (!global.__EXGLContexts) {\n throw new CodedError(\n 'ERR_GL_NOT_AVAILABLE',\n 'GL is currently not available. (Have you enabled remote debugging? GL is not available while debugging remotely.)'\n );\n }\n const gl = global.__EXGLContexts[String(exglCtxId)];\n\n configureLogging(gl);\n\n return gl;\n};\n\nconst getContextId = (exgl?: ExpoWebGLRenderingContext | number): number => {\n const exglCtxId = exgl && typeof exgl === 'object' ? exgl.contextId : exgl;\n\n if (!exglCtxId || typeof exglCtxId !== 'number') {\n throw new Error(`Invalid EXGLContext id: ${String(exglCtxId)}`);\n }\n return exglCtxId;\n};\n"]}
1
+ {"version":3,"file":"GLView.js","sourceRoot":"","sources":["../src/GLView.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,UAAU,GACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAS7C,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAQ1E,MAAM,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,GAAG,kBAAkB,CAAC;AAoB9E,MAAM,UAAU,GAAG,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,KAAK,CAAC,SAAsB;IACtD,MAAM,CAAC,UAAU,CAAM;IAEvB,MAAM,CAAC,YAAY,GAAG;QACpB,WAAW,EAAE,CAAC;KACf,CAAC;IAEF,MAAM,CAAC,KAAK,CAAC,kBAAkB;QAC7B,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,uBAAuB,CAAC,kBAAkB,EAAE,CAAC;QACzE,OAAO,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,IAAyC;QACxE,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CA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AAE,CAAC,CAAC;IACvE,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,UAA2B,EAAE;QACnD,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE;YAC7B,MAAM,IAAI,mBAAmB,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;SAC/D;QACD,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;QAC3B,OAAO,MAAM,MAAM,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;;AAGH,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC;AAE/B,6CAA6C;AAC7C,MAAM,KAAK,GAAG,CAAC,SAAiB,EAA6B,EAAE;IAC7D,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE;QAC1B,MAAM,IAAI,UAAU,CAClB,sBAAsB,EACtB,mHAAmH,CACpH,CAAC;KACH;IACD,MAAM,EAAE,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAEpD,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAErB,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,IAAyC,EAAU,EAAE;IACzE,MAAM,SAAS,GAAG,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;IAE3E,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;QAC/C,MAAM,IAAI,KAAK,CAAC,2BAA2B,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;KACjE;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import {\n NativeModulesProxy,\n UnavailabilityError,\n requireNativeViewManager,\n CodedError,\n} from 'expo-modules-core';\nimport * as React from 'react';\nimport { Platform, View, findNodeHandle } from 'react-native';\n\nimport { configureLogging } from './GLUtils';\nimport {\n ComponentOrHandle,\n SurfaceCreateEvent,\n GLSnapshot,\n ExpoWebGLRenderingContext,\n SnapshotOptions,\n BaseGLViewProps,\n} from './GLView.types';\nimport { createWorkletContextProvider } from './GLWorkletContextProvider';\n\nexport interface WebGLObject {\n id: number;\n}\n\ndeclare let global: any;\n\nconst { ExponentGLObjectManager, ExponentGLViewManager } = NativeModulesProxy;\n\nexport type GLViewProps = {\n /**\n * Called when the OpenGL context is created, with the context object as a parameter. The context\n * object has an API mirroring WebGL's WebGLRenderingContext.\n */\n onContextCreate(gl: ExpoWebGLRenderingContext): void;\n\n /**\n * [iOS only] Number of samples for Apple's built-in multisampling.\n */\n msaaSamples: number;\n\n /**\n * A ref callback for the native GLView\n */\n nativeRef_EXPERIMENTAL?(callback: ComponentOrHandle | null);\n} & BaseGLViewProps;\n\nconst NativeView = requireNativeViewManager('ExponentGLView');\n\n/**\n * A component that acts as an OpenGL render target\n */\nexport class GLView extends React.Component<GLViewProps> {\n static NativeView: any;\n\n static defaultProps = {\n msaaSamples: 4,\n };\n\n static async createContextAsync(): Promise<ExpoWebGLRenderingContext> {\n const { exglCtxId } = await ExponentGLObjectManager.createContextAsync();\n return getGl(exglCtxId);\n }\n\n static async destroyContextAsync(exgl?: ExpoWebGLRenderingContext | number): Promise<boolean> {\n const exglCtxId = getContextId(exgl);\n return ExponentGLObjectManager.destroyContextAsync(exglCtxId);\n }\n\n static async takeSnapshotAsync(\n exgl?: ExpoWebGLRenderingContext | number,\n options: SnapshotOptions = {}\n ): Promise<GLSnapshot> {\n const exglCtxId = getContextId(exgl);\n return ExponentGLObjectManager.takeSnapshotAsync(exglCtxId, options);\n }\n\n static getWorkletContext: (contextId: number) => ExpoWebGLRenderingContext | undefined =\n createWorkletContextProvider();\n\n nativeRef: ComponentOrHandle = null;\n exglCtxId?: number;\n\n render() {\n const {\n onContextCreate, // eslint-disable-line no-unused-vars\n msaaSamples,\n ...viewProps\n } = this.props;\n\n return (\n <View {...viewProps}>\n <NativeView\n ref={this._setNativeRef}\n style={{\n flex: 1,\n ...(Platform.OS === 'ios'\n ? {\n backgroundColor: 'transparent',\n }\n : {}),\n }}\n onSurfaceCreate={this._onSurfaceCreate}\n msaaSamples={Platform.OS === 'ios' ? msaaSamples : undefined}\n />\n </View>\n );\n }\n\n _setNativeRef = (nativeRef: ComponentOrHandle): void => {\n if (this.props.nativeRef_EXPERIMENTAL) {\n this.props.nativeRef_EXPERIMENTAL(nativeRef);\n }\n this.nativeRef = nativeRef;\n };\n\n _onSurfaceCreate = ({ nativeEvent: { exglCtxId } }: SurfaceCreateEvent): void => {\n const gl = getGl(exglCtxId);\n\n this.exglCtxId = exglCtxId;\n\n if (this.props.onContextCreate) {\n this.props.onContextCreate(gl);\n }\n };\n\n async startARSessionAsync(): Promise<any> {\n if (!ExponentGLViewManager.startARSessionAsync) {\n throw new UnavailabilityError('expo-gl', 'startARSessionAsync');\n }\n return await ExponentGLViewManager.startARSessionAsync(findNodeHandle(this.nativeRef));\n }\n\n async createCameraTextureAsync(cameraRefOrHandle: ComponentOrHandle): Promise<WebGLTexture> {\n if (!ExponentGLObjectManager.createCameraTextureAsync) {\n throw new UnavailabilityError('expo-gl', 'createCameraTextureAsync');\n }\n\n const { exglCtxId } = this;\n\n if (!exglCtxId) {\n throw new Error(\"GLView's surface is not created yet!\");\n }\n\n const cameraTag = findNodeHandle(cameraRefOrHandle);\n const { exglObjId } = await ExponentGLObjectManager.createCameraTextureAsync(\n exglCtxId,\n cameraTag\n );\n return { id: exglObjId } as WebGLTexture;\n }\n\n async destroyObjectAsync(glObject: WebGLObject): Promise<boolean> {\n if (!ExponentGLObjectManager.destroyObjectAsync) {\n throw new UnavailabilityError('expo-gl', 'destroyObjectAsync');\n }\n return await ExponentGLObjectManager.destroyObjectAsync(glObject.id);\n }\n\n async takeSnapshotAsync(options: SnapshotOptions = {}): Promise<GLSnapshot> {\n if (!GLView.takeSnapshotAsync) {\n throw new UnavailabilityError('expo-gl', 'takeSnapshotAsync');\n }\n const { exglCtxId } = this;\n return await GLView.takeSnapshotAsync(exglCtxId, options);\n }\n}\n\nGLView.NativeView = NativeView;\n\n// Get the GL interface from an EXGLContextId\nconst getGl = (exglCtxId: number): ExpoWebGLRenderingContext => {\n if (!global.__EXGLContexts) {\n throw new CodedError(\n 'ERR_GL_NOT_AVAILABLE',\n 'GL is currently not available. (Have you enabled remote debugging? GL is not available while debugging remotely.)'\n );\n }\n const gl = global.__EXGLContexts[String(exglCtxId)];\n\n configureLogging(gl);\n\n return gl;\n};\n\nconst getContextId = (exgl?: ExpoWebGLRenderingContext | number): number => {\n const exglCtxId = exgl && typeof exgl === 'object' ? exgl.contextId : exgl;\n\n if (!exglCtxId || typeof exglCtxId !== 'number') {\n throw new Error(`Invalid EXGLContext id: ${String(exglCtxId)}`);\n }\n return exglCtxId;\n};\n"]}
@@ -0,0 +1,3 @@
1
+ import { ExpoWebGLRenderingContext } from './GLView.types';
2
+ export declare function createWorkletContextProvider(): (contextId: number) => ExpoWebGLRenderingContext | undefined;
3
+ //# sourceMappingURL=GLWorkletContextProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GLWorkletContextProvider.d.ts","sourceRoot":"","sources":["../src/GLWorkletContextProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAU3D,wBAAgB,4BAA4B,gBAKrB,MAAM,KAAG,yBAAyB,GAAG,SAAS,CASpE"}
@@ -0,0 +1,25 @@
1
+ // This method needs to be in a separate file because react-native-reanimated
2
+ // import wrapped in try catch does not work correctly with inlineRequires option
3
+ // in metro.config.js
4
+ //
5
+ // It looks like in generated bundle "react-native-reanimated" is not present
6
+ // in _dependencyMap, but references to it count it as if it was, e.g. bundle contains
7
+ // a line "(0, _$$_REQUIRE(_dependencyMap[15], "./GLUtils").configureLogging)(gl);"
8
+ // but dependencyMap contains only 15 elements
9
+ export function createWorkletContextProvider() {
10
+ try {
11
+ // reanimated needs to be imported before any workletized code
12
+ // is created, but we don't want to make it dependency on expo-gl.
13
+ require('react-native-reanimated');
14
+ return (contextId) => {
15
+ 'worklet';
16
+ return global.__EXGLContexts?.[String(contextId)];
17
+ };
18
+ }
19
+ catch {
20
+ return () => {
21
+ throw new Error('Worklet runtime is not available');
22
+ };
23
+ }
24
+ }
25
+ //# sourceMappingURL=GLWorkletContextProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GLWorkletContextProvider.js","sourceRoot":"","sources":["../src/GLWorkletContextProvider.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,iFAAiF;AACjF,qBAAqB;AACrB,EAAE;AACF,6EAA6E;AAC7E,sFAAsF;AACtF,mFAAmF;AACnF,8CAA8C;AAC9C,MAAM,UAAU,4BAA4B;IAC1C,IAAI;QACF,8DAA8D;QAC9D,kEAAkE;QAClE,OAAO,CAAC,yBAAyB,CAAC,CAAC;QACnC,OAAO,CAAC,SAAiB,EAAyC,EAAE;YAClE,SAAS,CAAC;YACV,OAAO,MAAM,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QACpD,CAAC,CAAC;KACH;IAAC,MAAM;QACN,OAAO,GAAG,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACtD,CAAC,CAAC;KACH;AACH,CAAC","sourcesContent":["import { ExpoWebGLRenderingContext } from './GLView.types';\n\n// This method needs to be in a separate file because react-native-reanimated\n// import wrapped in try catch does not work correctly with inlineRequires option\n// in metro.config.js\n//\n// It looks like in generated bundle \"react-native-reanimated\" is not present\n// in _dependencyMap, but references to it count it as if it was, e.g. bundle contains\n// a line \"(0, _$$_REQUIRE(_dependencyMap[15], \"./GLUtils\").configureLogging)(gl);\"\n// but dependencyMap contains only 15 elements\nexport function createWorkletContextProvider() {\n try {\n // reanimated needs to be imported before any workletized code\n // is created, but we don't want to make it dependency on expo-gl.\n require('react-native-reanimated');\n return (contextId: number): ExpoWebGLRenderingContext | undefined => {\n 'worklet';\n return global.__EXGLContexts?.[String(contextId)];\n };\n } catch {\n return () => {\n throw new Error('Worklet runtime is not available');\n };\n }\n}\n"]}
@@ -6,30 +6,30 @@
6
6
  <array>
7
7
  <dict>
8
8
  <key>LibraryIdentifier</key>
9
- <string>ios-arm64</string>
9
+ <string>ios-arm64_x86_64-simulator</string>
10
10
  <key>LibraryPath</key>
11
11
  <string>EXGL.framework</string>
12
12
  <key>SupportedArchitectures</key>
13
13
  <array>
14
14
  <string>arm64</string>
15
+ <string>x86_64</string>
15
16
  </array>
16
17
  <key>SupportedPlatform</key>
17
18
  <string>ios</string>
19
+ <key>SupportedPlatformVariant</key>
20
+ <string>simulator</string>
18
21
  </dict>
19
22
  <dict>
20
23
  <key>LibraryIdentifier</key>
21
- <string>ios-arm64_x86_64-simulator</string>
24
+ <string>ios-arm64</string>
22
25
  <key>LibraryPath</key>
23
26
  <string>EXGL.framework</string>
24
27
  <key>SupportedArchitectures</key>
25
28
  <array>
26
29
  <string>arm64</string>
27
- <string>x86_64</string>
28
30
  </array>
29
31
  <key>SupportedPlatform</key>
30
32
  <string>ios</string>
31
- <key>SupportedPlatformVariant</key>
32
- <string>simulator</string>
33
33
  </dict>
34
34
  </array>
35
35
  <key>CFBundlePackageType</key>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-gl",
3
- "version": "11.2.1",
3
+ "version": "11.2.2",
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",
@@ -50,5 +50,5 @@
50
50
  "peerDependencies": {
51
51
  "expo": "*"
52
52
  },
53
- "gitHead": "2b35d9008fef42cb53473331c37693ca12e9bf12"
53
+ "gitHead": "0f796e10a2b2f258c40f9d56aa141c372cd63fc1"
54
54
  }
package/src/GLView.tsx CHANGED
@@ -16,6 +16,7 @@ import {
16
16
  SnapshotOptions,
17
17
  BaseGLViewProps,
18
18
  } from './GLView.types';
19
+ import { createWorkletContextProvider } from './GLWorkletContextProvider';
19
20
 
20
21
  export interface WebGLObject {
21
22
  id: number;
@@ -74,21 +75,7 @@ export class GLView extends React.Component<GLViewProps> {
74
75
  }
75
76
 
76
77
  static getWorkletContext: (contextId: number) => ExpoWebGLRenderingContext | undefined =
77
- (function () {
78
- try {
79
- // reanimated needs to be imported before any workletized code
80
- // is created, but we don't want to make it dependency on expo-gl.
81
- require('react-native-reanimated');
82
- return (contextId: number): ExpoWebGLRenderingContext | undefined => {
83
- 'worklet';
84
- return global.__EXGLContexts?.[String(contextId)];
85
- };
86
- } catch {
87
- return () => {
88
- throw new Error('Worklet runtime is not available');
89
- };
90
- }
91
- })();
78
+ createWorkletContextProvider();
92
79
 
93
80
  nativeRef: ComponentOrHandle = null;
94
81
  exglCtxId?: number;
@@ -0,0 +1,25 @@
1
+ import { ExpoWebGLRenderingContext } from './GLView.types';
2
+
3
+ // This method needs to be in a separate file because react-native-reanimated
4
+ // import wrapped in try catch does not work correctly with inlineRequires option
5
+ // in metro.config.js
6
+ //
7
+ // It looks like in generated bundle "react-native-reanimated" is not present
8
+ // in _dependencyMap, but references to it count it as if it was, e.g. bundle contains
9
+ // a line "(0, _$$_REQUIRE(_dependencyMap[15], "./GLUtils").configureLogging)(gl);"
10
+ // but dependencyMap contains only 15 elements
11
+ export function createWorkletContextProvider() {
12
+ try {
13
+ // reanimated needs to be imported before any workletized code
14
+ // is created, but we don't want to make it dependency on expo-gl.
15
+ require('react-native-reanimated');
16
+ return (contextId: number): ExpoWebGLRenderingContext | undefined => {
17
+ 'worklet';
18
+ return global.__EXGLContexts?.[String(contextId)];
19
+ };
20
+ } catch {
21
+ return () => {
22
+ throw new Error('Worklet runtime is not available');
23
+ };
24
+ }
25
+ }
@@ -0,0 +1,3 @@
1
+ declare const global: Global & {
2
+ __EXGLContexts?: Record<string, any>;
3
+ };