react-native-webgpu 0.16.0 → 0.17.0

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.
Files changed (71) hide show
  1. package/android/build.gradle +11 -1
  2. package/android/src/main/java/com/webgpu/BackingViewKind.java +38 -0
  3. package/android/src/main/java/com/webgpu/WebGPUSurfaceView.java +19 -2
  4. package/android/src/main/java/com/webgpu/WebGPUView.java +115 -63
  5. package/android/src/main/java/com/webgpu/WebGPUViewManager.java +13 -6
  6. package/cpp/jsi/NativeObject.h +84 -34
  7. package/cpp/rnwgpu/RNWebGPUManager.cpp +51 -48
  8. package/cpp/rnwgpu/RNWebGPUManager.h +10 -0
  9. package/cpp/rnwgpu/api/GPUFeatures.h +1 -0
  10. package/cpp/rnwgpu/api/GPUNativeBufferWrapper.h +1 -0
  11. package/cpp/rnwgpu/api/VideoFrame.h +2 -2
  12. package/lib/commonjs/Canvas.js +105 -8
  13. package/lib/commonjs/Canvas.js.map +1 -1
  14. package/lib/commonjs/WebGPUViewNativeComponent.js.map +1 -1
  15. package/lib/commonjs/WebGPUViewNativeComponent.web.js +3 -5
  16. package/lib/commonjs/WebGPUViewNativeComponent.web.js.map +1 -1
  17. package/lib/commonjs/external/reanimated/registerWebGPUForReanimated.js.map +1 -1
  18. package/lib/commonjs/install.js +26 -7
  19. package/lib/commonjs/install.js.map +1 -1
  20. package/lib/commonjs/mock.js +0 -1
  21. package/lib/commonjs/mock.js.map +1 -1
  22. package/lib/module/Canvas.js +105 -8
  23. package/lib/module/Canvas.js.map +1 -1
  24. package/lib/module/WebGPUViewNativeComponent.js.map +1 -1
  25. package/lib/module/WebGPUViewNativeComponent.web.js +3 -5
  26. package/lib/module/WebGPUViewNativeComponent.web.js.map +1 -1
  27. package/lib/module/external/reanimated/registerWebGPUForReanimated.js.map +1 -1
  28. package/lib/module/install.js +26 -7
  29. package/lib/module/install.js.map +1 -1
  30. package/lib/module/mock.js +0 -1
  31. package/lib/module/mock.js.map +1 -1
  32. package/lib/typescript/lib/commonjs/Canvas.d.ts +1 -2
  33. package/lib/typescript/lib/commonjs/Canvas.d.ts.map +1 -1
  34. package/lib/typescript/lib/commonjs/WebGPUViewNativeComponent.web.d.ts.map +1 -1
  35. package/lib/typescript/lib/commonjs/install.d.ts +10 -7
  36. package/lib/typescript/lib/commonjs/install.d.ts.map +1 -1
  37. package/lib/typescript/lib/commonjs/mock.d.ts +1 -2
  38. package/lib/typescript/lib/commonjs/mock.d.ts.map +1 -1
  39. package/lib/typescript/lib/module/Canvas.d.ts +1 -2
  40. package/lib/typescript/lib/module/Canvas.d.ts.map +1 -1
  41. package/lib/typescript/lib/module/WebGPUViewNativeComponent.web.d.ts.map +1 -1
  42. package/lib/typescript/lib/module/install.d.ts.map +1 -1
  43. package/lib/typescript/lib/module/mock.d.ts +1 -2
  44. package/lib/typescript/lib/module/mock.d.ts.map +1 -1
  45. package/lib/typescript/src/Canvas.d.ts +62 -16
  46. package/lib/typescript/src/Canvas.d.ts.map +1 -1
  47. package/lib/typescript/src/WebGPUViewNativeComponent.d.ts +3 -2
  48. package/lib/typescript/src/WebGPUViewNativeComponent.d.ts.map +1 -1
  49. package/lib/typescript/src/WebGPUViewNativeComponent.web.d.ts +3 -2
  50. package/lib/typescript/src/WebGPUViewNativeComponent.web.d.ts.map +1 -1
  51. package/lib/typescript/src/external/reanimated/registerWebGPUForReanimated.d.ts +1 -0
  52. package/lib/typescript/src/external/reanimated/registerWebGPUForReanimated.d.ts.map +1 -1
  53. package/lib/typescript/src/install.d.ts +10 -7
  54. package/lib/typescript/src/install.d.ts.map +1 -1
  55. package/lib/typescript/src/mock.d.ts +2 -2
  56. package/lib/typescript/src/mock.d.ts.map +1 -1
  57. package/lib/typescript/src/types.d.ts +1 -1
  58. package/package.json +8 -7
  59. package/plugin/build/index.js +2 -1
  60. package/plugin/build/setMinSdkVersion.d.ts +9 -0
  61. package/plugin/build/setMinSdkVersion.js +25 -0
  62. package/plugin/build/withMinSdkVersion.d.ts +11 -0
  63. package/plugin/build/withMinSdkVersion.js +20 -0
  64. package/src/Canvas.tsx +176 -33
  65. package/src/WebGPUViewNativeComponent.ts +6 -4
  66. package/src/WebGPUViewNativeComponent.web.ts +7 -5
  67. package/src/external/reanimated/registerWebGPUForReanimated.ts +4 -0
  68. package/src/index.tsx +3 -3
  69. package/src/install.ts +26 -7
  70. package/src/mock.ts +5 -7
  71. package/src/types.ts +1 -1
package/src/Canvas.tsx CHANGED
@@ -12,47 +12,196 @@ function generateContextId() {
12
12
  return CONTEXT_COUNTER++;
13
13
  }
14
14
 
15
- export type AndroidSurfaceType =
16
- "SurfaceView" | "TextureView" | "HardwareBufferView";
15
+ /** The Android view a canvas draws into, see {@link AndroidCanvasProps}. */
16
+ export type AndroidBackingView =
17
+ "TextureView" | "SurfaceView" | "HardwareBufferView";
17
18
 
18
- export interface AndroidCanvasProps {
19
+ /** The options of a canvas backed by a `TextureView`, the default. */
20
+ export interface AndroidTextureViewProps {
19
21
  /**
20
- * Backing view. Defaults to `SurfaceView` when the canvas is opaque and to
21
- * `TextureView` otherwise; both composite correctly in React Native
22
- * stacking order without further flags. `HardwareBufferView` (Android 10+,
23
- * a plain View that draws each frame's AHardwareBuffer inline with no extra
24
- * copy) is opt-in and experimental; on older devices it uses `TextureView`.
22
+ * A `TextureView`: a regular view, composited like any other (parent
23
+ * transforms, clipping, alpha and z-order apply), at the price of an extra
24
+ * texture copy and typically a frame of latency. The default.
25
25
  */
26
- surfaceType?: AndroidSurfaceType;
26
+ backingView?: "TextureView";
27
27
  /**
28
- * SurfaceView only: composite above every React Native view in the window,
29
- * ignoring `zIndex`. Ignored for TextureView. Defaults to false.
28
+ * Declares that the canvas covers every pixel of its bounds, so the UI
29
+ * toolkit skips blending the view. Defaults to false. Applied in place.
30
+ */
31
+ opaque?: boolean;
32
+ }
33
+
34
+ /** The options of a canvas backed by a `SurfaceView`. */
35
+ export interface AndroidSurfaceViewProps {
36
+ /**
37
+ * A `SurfaceView`: each frame goes to the system compositor as its own
38
+ * layer, the fastest path, with no extra copy. It is not view content:
39
+ * parent transforms, clipping, rounded corners and z-order with sibling
40
+ * views do not apply to it.
41
+ */
42
+ backingView: "SurfaceView";
43
+ /**
44
+ * Declares that the canvas covers every pixel of its bounds, so the
45
+ * compositor skips blending the layer and can show it through a hardware
46
+ * overlay. Defaults to true: a translucent `SurfaceView` blends against
47
+ * what is below the window, usually black, rather than the React Native
48
+ * views beneath it (pair it with `zOrderOnTop`). Applied in place.
49
+ */
50
+ opaque?: boolean;
51
+ /**
52
+ * Composite above every React Native view in the window, ignoring
53
+ * `zIndex`. Defaults to false. Applied in place on Android 11 and later;
54
+ * read once, at mount, before that.
30
55
  */
31
56
  zOrderOnTop?: boolean;
57
+ /**
58
+ * Composite above the other `SurfaceView`s below the window (video players,
59
+ * other canvases), while staying below the window itself. Defaults to
60
+ * false; `zOrderOnTop` takes precedence. Applied in place on Android 11 and
61
+ * later; read once, at mount, before that.
62
+ */
63
+ zOrderMediaOverlay?: boolean;
64
+ }
65
+
66
+ /** The options of a canvas backed by a `HardwareBufferView`. */
67
+ export interface AndroidHardwareBufferViewProps {
68
+ /**
69
+ * A plain view drawing each frame's `AHardwareBuffer` inline: composited
70
+ * like a `TextureView`, without its extra copy. Opt-in and experimental,
71
+ * on Android 10 and later; below that the canvas uses a `TextureView`,
72
+ * with a warning in development. Always composites with alpha.
73
+ */
74
+ backingView: "HardwareBufferView";
32
75
  }
33
76
 
77
+ /**
78
+ * Android-only rendering options: the native view behind the canvas and its
79
+ * options. The view is created when the canvas mounts and kept: a change of
80
+ * `backingView` is ignored, with a warning in development; remount the canvas
81
+ * (with a `key`) to change it. `opaque` applies in place, and so do the
82
+ * z-order options on Android 11 and later. Ignored on iOS and web.
83
+ */
84
+ export type AndroidCanvasProps =
85
+ | AndroidTextureViewProps
86
+ | AndroidSurfaceViewProps
87
+ | AndroidHardwareBufferViewProps;
88
+
34
89
  export interface CanvasProps extends ViewProps {
35
90
  /**
36
- * Defaults to true. Set to false to alpha-composite the canvas over the
37
- * views behind it (pair it with `alphaMode: "premultiplied"` and an alpha-0
38
- * clear color). Android and web only; on iOS `alphaMode` alone controls it.
91
+ * Android-only rendering options: the native view behind the canvas and its
92
+ * options, see {@link AndroidCanvasProps}. Ignored on iOS and web.
39
93
  */
40
- opaque?: boolean;
41
- /** Android-only rendering options. Ignored on iOS and web. */
42
94
  android?: AndroidCanvasProps;
43
95
  ref?: React.Ref<CanvasRef>;
44
96
  }
45
97
 
98
+ // The union read as one bag of options; which of them apply to the view is
99
+ // decided below, as it is on the native side.
100
+ type AndroidOptions = Partial<{
101
+ backingView: AndroidBackingView;
102
+ opaque: boolean;
103
+ zOrderOnTop: boolean;
104
+ zOrderMediaOverlay: boolean;
105
+ }>;
106
+
107
+ const options = (android?: AndroidCanvasProps): AndroidOptions =>
108
+ (android ?? {}) as AndroidOptions;
109
+
46
110
  // Anything else reaching the native component would hit the generated
47
111
  // string-enum parser, which aborts on unknown values.
48
- const resolveSurfaceType = (
49
- surfaceType: AndroidSurfaceType | undefined,
50
- ): "auto" | AndroidSurfaceType =>
51
- surfaceType === "SurfaceView" ||
52
- surfaceType === "TextureView" ||
53
- surfaceType === "HardwareBufferView"
54
- ? surfaceType
55
- : "auto";
112
+ const resolveBackingView = (
113
+ android?: AndroidCanvasProps,
114
+ ): AndroidBackingView => {
115
+ const { backingView } = options(android);
116
+ return backingView === "SurfaceView" || backingView === "HardwareBufferView"
117
+ ? backingView
118
+ : "TextureView";
119
+ };
120
+
121
+ // Whether the canvas composites as opaque, see BackingViewKind.resolveOpaque():
122
+ // a SurfaceView is opaque unless asked otherwise, a TextureView is translucent
123
+ // unless asked otherwise, and a HardwareBufferView always composites with
124
+ // alpha.
125
+ const resolveOpaque = (android?: AndroidCanvasProps): boolean => {
126
+ const { opaque } = options(android);
127
+ switch (resolveBackingView(android)) {
128
+ case "SurfaceView":
129
+ return opaque !== false;
130
+ case "TextureView":
131
+ return opaque === true;
132
+ case "HardwareBufferView":
133
+ return false;
134
+ }
135
+ };
136
+
137
+ // The native props the `android` prop resolves to.
138
+ const androidNativeProps = (android?: AndroidCanvasProps) => {
139
+ const backingView = resolveBackingView(android);
140
+ const { zOrderOnTop, zOrderMediaOverlay } = options(android);
141
+ const surfaceView = backingView === "SurfaceView";
142
+ return {
143
+ androidBackingView: backingView,
144
+ androidOpaque: resolveOpaque(android),
145
+ androidZOrderOnTop: surfaceView && !!zOrderOnTop,
146
+ androidZOrderMediaOverlay: surfaceView && !!zOrderMediaOverlay,
147
+ };
148
+ };
149
+
150
+ const warnIgnoredChange = (prop: string) =>
151
+ console.warn(
152
+ `Ignoring a change of ${prop} on a mounted canvas: the backing view is ` +
153
+ "chosen when the canvas mounts. Remount the canvas (give it a new key) " +
154
+ "to change it.",
155
+ );
156
+
157
+ // Warns, in development on Android, about an option a mounting canvas asks
158
+ // for that the native view cannot honour, and about a change of these props
159
+ // that the native view ignores: the backing view is created from them when
160
+ // the canvas mounts (see WebGPUView.java, whose setters these rules mirror).
161
+ // The native side only says so in logcat, which is not where a JS developer
162
+ // looks.
163
+ const useBackingViewWarning = (android?: AndroidCanvasProps) => {
164
+ const mount = useRef(android);
165
+ const prev = useRef(android);
166
+ useEffect(() => {
167
+ if (
168
+ __DEV__ &&
169
+ Platform.OS === "android" &&
170
+ resolveBackingView(mount.current) === "HardwareBufferView" &&
171
+ Number(Platform.Version) < 29
172
+ ) {
173
+ console.warn(
174
+ "android.backingView: HardwareBufferView needs Android 10, the " +
175
+ "canvas uses a TextureView.",
176
+ );
177
+ }
178
+ }, []);
179
+ useEffect(() => {
180
+ if (__DEV__ && Platform.OS === "android") {
181
+ const { current: before } = prev;
182
+ if (resolveBackingView(before) !== resolveBackingView(android)) {
183
+ warnIgnoredChange("android.backingView");
184
+ }
185
+ // Only a SurfaceView has a z-order of its own, which Android 11 and
186
+ // later changes in place.
187
+ const zOrderAtMount =
188
+ resolveBackingView(mount.current) === "SurfaceView" &&
189
+ Number(Platform.Version) < 30;
190
+ const was = options(before);
191
+ const is = options(android);
192
+ if (zOrderAtMount && !!was.zOrderOnTop !== !!is.zOrderOnTop) {
193
+ warnIgnoredChange("android.zOrderOnTop");
194
+ }
195
+ if (
196
+ zOrderAtMount &&
197
+ !!was.zOrderMediaOverlay !== !!is.zOrderMediaOverlay
198
+ ) {
199
+ warnIgnoredChange("android.zOrderMediaOverlay");
200
+ }
201
+ }
202
+ prev.current = android;
203
+ });
204
+ };
56
205
 
57
206
  // A view measured relative to itself gets its layout size, without the
58
207
  // transforms getBoundingClientRect() includes; measureLayout() calls back
@@ -72,14 +221,10 @@ const measureLayout = (view: View) => {
72
221
  return size;
73
222
  };
74
223
 
75
- export const Canvas = ({
76
- opaque = true,
77
- android,
78
- ref,
79
- ...props
80
- }: CanvasProps) => {
224
+ export const Canvas = ({ android, ref, ...props }: CanvasProps) => {
81
225
  const viewRef = useRef<View>(null);
82
226
  const [contextId, _] = useState(() => generateContextId());
227
+ useBackingViewWarning(android);
83
228
  // Retire the native registry entry for this contextId on unmount. When a
84
229
  // native surface is still attached, this is a no-op and the native view's
85
230
  // own teardown retires the entry instead — which keeps StrictMode's
@@ -123,9 +268,7 @@ export const Canvas = ({
123
268
  <WebGPUNativeView
124
269
  style={{ flex: 1 }}
125
270
  contextId={contextId}
126
- opaque={opaque}
127
- androidSurfaceType={resolveSurfaceType(android?.surfaceType)}
128
- androidZOrderOnTop={!!android?.zOrderOnTop}
271
+ {...androidNativeProps(android)}
129
272
  />
130
273
  </View>
131
274
  );
@@ -7,12 +7,14 @@ import type { ViewProps } from "react-native";
7
7
 
8
8
  export interface NativeProps extends ViewProps {
9
9
  contextId: Int32;
10
- opaque?: WithDefault<boolean, true>;
11
- androidSurfaceType?: WithDefault<
12
- "auto" | "SurfaceView" | "TextureView" | "HardwareBufferView",
13
- "auto"
10
+ // The `android` prop, resolved (see Canvas.tsx)
11
+ androidBackingView?: WithDefault<
12
+ "TextureView" | "SurfaceView" | "HardwareBufferView",
13
+ "TextureView"
14
14
  >;
15
+ androidOpaque?: WithDefault<boolean, false>;
15
16
  androidZOrderOnTop?: WithDefault<boolean, false>;
17
+ androidZOrderMediaOverlay?: WithDefault<boolean, false>;
16
18
  }
17
19
 
18
20
  // eslint-disable-next-line import/no-default-export
@@ -7,9 +7,11 @@ import { contextIdToId } from "./utils";
7
7
 
8
8
  export interface NativeProps extends ViewProps {
9
9
  contextId: Int32;
10
- opaque?: boolean;
11
- androidSurfaceType?: "auto" | "SurfaceView" | "TextureView";
10
+ // The `android` prop, resolved: Android-only, never reaches the DOM
11
+ androidBackingView?: "TextureView" | "SurfaceView" | "HardwareBufferView";
12
+ androidOpaque?: boolean;
12
13
  androidZOrderOnTop?: boolean;
14
+ androidZOrderMediaOverlay?: boolean;
13
15
  }
14
16
 
15
17
  // eslint-disable-next-line import/no-default-export
@@ -19,9 +21,10 @@ export default function WebGPUViewNativeComponent(
19
21
  const {
20
22
  contextId,
21
23
  style,
22
- opaque = true,
23
- androidSurfaceType: _androidSurfaceType,
24
+ androidBackingView: _androidBackingView,
25
+ androidOpaque: _androidOpaque,
24
26
  androidZOrderOnTop: _androidZOrderOnTop,
27
+ androidZOrderMediaOverlay: _androidZOrderMediaOverlay,
25
28
  ...rest
26
29
  } = props;
27
30
 
@@ -34,7 +37,6 @@ export default function WebGPUViewNativeComponent(
34
37
  style: {
35
38
  ...styles.view,
36
39
  ...styles.flex1,
37
- ...(opaque ? { backgroundColor: "white" } : {}),
38
40
  ...(typeof style === "object" ? style : {}),
39
41
  },
40
42
  });
@@ -10,6 +10,10 @@ interface WebGPUWorkletHelpers {
10
10
  // WebGPU prototype are rejected, and no JS property is ever read.
11
11
  isNativeObject: (value: unknown) => boolean;
12
12
  box: (value: object) => BoxedWebGPUObject;
13
+ // Installs the constructor of every WebGPU class on the calling runtime,
14
+ // skipping the ones already there. installWebGPU() calls it so `instanceof`
15
+ // works on worklet runtimes.
16
+ installConstructors: () => void;
13
17
  }
14
18
 
15
19
  interface BoxedWebGPUObject {
package/src/index.tsx CHANGED
@@ -159,9 +159,9 @@ declare global {
159
159
  // What is captured is what the platform renders for the view hierarchy
160
160
  // (iOS: UIView.drawViewHierarchyInRect; Android API 29+: HardwareRenderer
161
161
  // over the views' display lists, older: View.draw into a software canvas).
162
- // On Android, SurfaceView content (a WebGPU Canvas with the default
163
- // "SurfaceView" surfaceType, video players) is not part of the hierarchy and
164
- // comes out blank; use `android={{ surfaceType: "TextureView" }}` for a
162
+ // On Android, SurfaceView content (a WebGPU Canvas with
163
+ // `android={{ backingView: "SurfaceView" }}`, video players) is not part of
164
+ // the hierarchy and comes out blank; keep the default TextureView for a
165
165
  // canvas that must be captured.
166
166
  interface GPUQueue {
167
167
  drawElementImageToTexture(
package/src/install.ts CHANGED
@@ -29,14 +29,25 @@ const constants = {
29
29
  const gpu: GPU | undefined =
30
30
  typeof RNWebGPU === "undefined" ? undefined : RNWebGPU.gpu;
31
31
 
32
+ // The native half of the worklet serializer (see registerWebGPUForReanimated),
33
+ // read from the main runtime like `gpu` above and captured into the worklet
34
+ // closure: worklets hands a HostObject to every runtime by reference, so it is
35
+ // callable on the target runtime without installing anything there. Its
36
+ // installConstructors() installs the WebGPU class constructors on the runtime
37
+ // that calls it. Undefined on web and node, where the native module is not
38
+ // installed.
39
+ const helpers = globalThis.__webgpuWorkletHelpers;
40
+
32
41
  /**
33
42
  * Install WebGPU on the runtime that calls it.
34
43
  *
35
44
  * The native module sets up WebGPU on the main JS runtime, but worklet
36
45
  * runtimes (Reanimated UI, dedicated worklet runtimes, Vision Camera frame
37
- * processors) start without it: `navigator.gpu` and the flag constants
46
+ * processors) start without it: `navigator.gpu`, the flag constants
38
47
  * (`GPUBufferUsage`, `GPUTextureUsage`, `GPUShaderStage`, `GPUColorWrite`,
39
- * `GPUMapMode`) are all `undefined` there.
48
+ * `GPUMapMode`) and the class constructors (`GPUBuffer`, `GPUTexture`,
49
+ * `GPURenderBundleEncoder`, ...) are all `undefined` there. Without the
50
+ * constructors, `instanceof` against a WebGPU class throws a ReferenceError.
40
51
  *
41
52
  * Call `installWebGPU()` once at the top of a worklet to make them available:
42
53
  *
@@ -65,12 +76,13 @@ const gpu: GPU | undefined =
65
76
  * Observe those on a device created on the main JS thread.
66
77
  *
67
78
  * Everything is captured into the worklet by closure: the constants like a
68
- * shader string would be, and the GPU object through the Worklets custom
79
+ * shader string would be, the GPU object through the Worklets custom
69
80
  * serializer, which installs the native prototypes on the target runtime when
70
- * it crosses. Promises returned by `requestAdapter`/`requestDevice` settle on
71
- * the calling runtime (each runtime gets its own async pump). Calling it on a
72
- * runtime that already has the globals (e.g. the main JS runtime) is a safe
73
- * no-op.
81
+ * it crosses, and the native helper that installs the class constructors,
82
+ * which worklets hands to every runtime by reference. Promises returned by
83
+ * `requestAdapter`/`requestDevice` settle on the calling runtime (each
84
+ * runtime gets its own async pump). Calling it on a runtime that already has
85
+ * the globals (e.g. the main JS runtime) is a safe no-op.
74
86
  */
75
87
  export const installWebGPU = () => {
76
88
  "worklet";
@@ -88,4 +100,11 @@ export const installWebGPU = () => {
88
100
  nav.gpu = gpu;
89
101
  }
90
102
  }
103
+ // The class constructors, so `instanceof` works against any WebGPU class on
104
+ // this runtime (three.js checks `pass instanceof GPURenderBundleEncoder` on
105
+ // every render, for instance). Unboxing an object installs only its own
106
+ // class; this installs the rest and skips the ones already there.
107
+ if (helpers !== undefined) {
108
+ helpers.installConstructors();
109
+ }
91
110
  };
package/src/mock.ts CHANGED
@@ -82,8 +82,11 @@ const NOT_AVAILABLE_UNDER_JEST =
82
82
  "is not available under Jest - react-native-webgpu has no native implementation in tests (see react-native-webgpu/jestSetup.js)";
83
83
 
84
84
  export type {
85
+ AndroidBackingView,
85
86
  AndroidCanvasProps,
86
- AndroidSurfaceType,
87
+ AndroidHardwareBufferViewProps,
88
+ AndroidSurfaceViewProps,
89
+ AndroidTextureViewProps,
87
90
  CanvasProps,
88
91
  CanvasRef,
89
92
  NativeCanvas,
@@ -91,12 +94,7 @@ export type {
91
94
  } from "./Canvas";
92
95
 
93
96
  // Strip the same props the real Canvas keeps off its outer View.
94
- export const Canvas = ({
95
- opaque: _opaque,
96
- android: _android,
97
- ref,
98
- ...props
99
- }: CanvasProps) => {
97
+ export const Canvas = ({ android: _android, ref, ...props }: CanvasProps) => {
100
98
  React.useImperativeHandle(ref, () => ({
101
99
  getContextId: () => -1,
102
100
  getContext: (_contextName: "webgpu"): RNCanvasContext | null => null,
package/src/types.ts CHANGED
@@ -21,7 +21,7 @@ export type RNCanvasContext = GPUCanvasContext & {
21
21
  *
22
22
  * Call this after `queue.submit()` on every runtime: the main JS runtime, the
23
23
  * Reanimated UI runtime, and dedicated worklet runtimes (e.g.
24
- * `createWorkletRuntime` / `runOnRuntime`, or a Vision Camera frame
24
+ * `createWorkletRuntime` / `scheduleOnRuntime`, or a Vision Camera frame
25
25
  * processor). It runs synchronously on the calling thread, so the frame is
26
26
  * presented from whichever thread did the rendering.
27
27
  */