@react-three/fiber 9.0.0-rc.2 → 9.0.0-rc.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/dist/declarations/src/native/Canvas.d.ts +2 -3
- package/dist/declarations/src/web/Canvas.d.ts +2 -3
- package/dist/{events-bcbe26a9.cjs.prod.js → events-484fb9c5.cjs.prod.js} +1 -2
- package/dist/{events-89bb769e.esm.js → events-64d1e225.esm.js} +1 -2
- package/dist/{events-ec103e1e.cjs.dev.js → events-c2452172.cjs.dev.js} +1 -2
- package/dist/react-three-fiber.cjs.dev.js +9 -9
- package/dist/react-three-fiber.cjs.prod.js +9 -9
- package/dist/react-three-fiber.esm.js +10 -10
- package/native/dist/react-three-fiber-native.cjs.dev.js +9 -13
- package/native/dist/react-three-fiber-native.cjs.prod.js +9 -13
- package/native/dist/react-three-fiber-native.esm.js +10 -14
- package/package.json +1 -1
|
@@ -4,11 +4,10 @@ import { RenderProps } from "../core/index.js";
|
|
|
4
4
|
export interface CanvasProps extends Omit<RenderProps<HTMLCanvasElement>, 'size' | 'dpr'>, Omit<ViewProps, 'children'> {
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
style?: ViewStyle;
|
|
7
|
-
|
|
8
|
-
export interface Props extends CanvasProps {
|
|
7
|
+
ref?: React.Ref<View>;
|
|
9
8
|
}
|
|
10
9
|
/**
|
|
11
10
|
* A native canvas which accepts threejs elements as children.
|
|
12
11
|
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
13
12
|
*/
|
|
14
|
-
export declare
|
|
13
|
+
export declare function Canvas(props: CanvasProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,6 +3,7 @@ import { Options as ResizeOptions } from "./use-measure.js";
|
|
|
3
3
|
import { RenderProps } from "../core/index.js";
|
|
4
4
|
export interface CanvasProps extends Omit<RenderProps<HTMLCanvasElement>, 'size'>, React.HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
children: React.ReactNode;
|
|
6
|
+
ref?: React.Ref<HTMLCanvasElement>;
|
|
6
7
|
/** Canvas fallback content, similar to img's alt prop */
|
|
7
8
|
fallback?: React.ReactNode;
|
|
8
9
|
/**
|
|
@@ -15,10 +16,8 @@ export interface CanvasProps extends Omit<RenderProps<HTMLCanvasElement>, 'size'
|
|
|
15
16
|
/** The event prefix that is cast into canvas pointer x/y events, default: "offset" */
|
|
16
17
|
eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen';
|
|
17
18
|
}
|
|
18
|
-
export interface Props extends CanvasProps {
|
|
19
|
-
}
|
|
20
19
|
/**
|
|
21
20
|
* A DOM canvas which accepts threejs elements as children.
|
|
22
21
|
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
23
22
|
*/
|
|
24
|
-
export declare
|
|
23
|
+
export declare function Canvas(props: CanvasProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -358,7 +358,6 @@ function diffProps(instance, newProps) {
|
|
|
358
358
|
// https://github.com/mrdoob/three.js/pull/22748
|
|
359
359
|
const colorMaps = ['map', 'emissiveMap', 'sheenColorMap', 'specularColorMap', 'envMap'];
|
|
360
360
|
const EVENT_REGEX = /^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;
|
|
361
|
-
|
|
362
361
|
// This function applies a set of changes to the instance
|
|
363
362
|
function applyProps(object, props) {
|
|
364
363
|
var _instance$object;
|
|
@@ -387,7 +386,7 @@ function applyProps(object, props) {
|
|
|
387
386
|
} = resolve(object, prop);
|
|
388
387
|
|
|
389
388
|
// Copy if properties match signatures
|
|
390
|
-
if (
|
|
389
|
+
if (target != null && target.copy && value != null && value.constructor && target.constructor === value.constructor) {
|
|
391
390
|
target.copy(value);
|
|
392
391
|
}
|
|
393
392
|
// Layers have no copy function, we must therefore copy the mask property
|
|
@@ -332,7 +332,6 @@ function diffProps(instance, newProps) {
|
|
|
332
332
|
// https://github.com/mrdoob/three.js/pull/22748
|
|
333
333
|
const colorMaps = ['map', 'emissiveMap', 'sheenColorMap', 'specularColorMap', 'envMap'];
|
|
334
334
|
const EVENT_REGEX = /^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;
|
|
335
|
-
|
|
336
335
|
// This function applies a set of changes to the instance
|
|
337
336
|
function applyProps(object, props) {
|
|
338
337
|
var _instance$object;
|
|
@@ -361,7 +360,7 @@ function applyProps(object, props) {
|
|
|
361
360
|
} = resolve(object, prop);
|
|
362
361
|
|
|
363
362
|
// Copy if properties match signatures
|
|
364
|
-
if (
|
|
363
|
+
if (target != null && target.copy && value != null && value.constructor && target.constructor === value.constructor) {
|
|
365
364
|
target.copy(value);
|
|
366
365
|
}
|
|
367
366
|
// Layers have no copy function, we must therefore copy the mask property
|
|
@@ -358,7 +358,6 @@ function diffProps(instance, newProps) {
|
|
|
358
358
|
// https://github.com/mrdoob/three.js/pull/22748
|
|
359
359
|
const colorMaps = ['map', 'emissiveMap', 'sheenColorMap', 'specularColorMap', 'envMap'];
|
|
360
360
|
const EVENT_REGEX = /^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;
|
|
361
|
-
|
|
362
361
|
// This function applies a set of changes to the instance
|
|
363
362
|
function applyProps(object, props) {
|
|
364
363
|
var _instance$object;
|
|
@@ -387,7 +386,7 @@ function applyProps(object, props) {
|
|
|
387
386
|
} = resolve(object, prop);
|
|
388
387
|
|
|
389
388
|
// Copy if properties match signatures
|
|
390
|
-
if (
|
|
389
|
+
if (target != null && target.copy && value != null && value.constructor && target.constructor === value.constructor) {
|
|
391
390
|
target.copy(value);
|
|
392
391
|
}
|
|
393
392
|
// Layers have no copy function, we must therefore copy the mask property
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var events = require('./events-
|
|
5
|
+
var events = require('./events-c2452172.cjs.dev.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var THREE = require('three');
|
|
8
8
|
var createDebounce = require('debounce');
|
|
@@ -232,7 +232,8 @@ function findScrollContainers(element) {
|
|
|
232
232
|
const keys = ['x', 'y', 'top', 'bottom', 'left', 'right', 'width', 'height'];
|
|
233
233
|
const areBoundsEqual = (a, b) => keys.every(key => a[key] === b[key]);
|
|
234
234
|
|
|
235
|
-
|
|
235
|
+
function CanvasImpl({
|
|
236
|
+
ref,
|
|
236
237
|
children,
|
|
237
238
|
fallback,
|
|
238
239
|
resize,
|
|
@@ -255,7 +256,7 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
255
256
|
onPointerMissed,
|
|
256
257
|
onCreated,
|
|
257
258
|
...props
|
|
258
|
-
}
|
|
259
|
+
}) {
|
|
259
260
|
// Create a known catalogue of Threejs-native elements
|
|
260
261
|
// This will include the entire THREE namespace by default, users can extend
|
|
261
262
|
// their own elements by using the createRoot API instead
|
|
@@ -271,7 +272,7 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
271
272
|
});
|
|
272
273
|
const canvasRef = React__namespace.useRef(null);
|
|
273
274
|
const divRef = React__namespace.useRef(null);
|
|
274
|
-
React__namespace.useImperativeHandle(
|
|
275
|
+
React__namespace.useImperativeHandle(ref, () => canvasRef.current);
|
|
275
276
|
const handlePointerMissed = events.useMutableCallback(onPointerMissed);
|
|
276
277
|
const [block, setBlock] = React__namespace.useState(false);
|
|
277
278
|
const [error, setError] = React__namespace.useState(false);
|
|
@@ -367,20 +368,19 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
367
368
|
})
|
|
368
369
|
})
|
|
369
370
|
});
|
|
370
|
-
}
|
|
371
|
+
}
|
|
371
372
|
|
|
372
373
|
/**
|
|
373
374
|
* A DOM canvas which accepts threejs elements as children.
|
|
374
375
|
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
375
376
|
*/
|
|
376
|
-
|
|
377
|
+
function Canvas(props) {
|
|
377
378
|
return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {
|
|
378
379
|
children: /*#__PURE__*/jsxRuntime.jsx(CanvasImpl, {
|
|
379
|
-
...props
|
|
380
|
-
ref: ref
|
|
380
|
+
...props
|
|
381
381
|
})
|
|
382
382
|
});
|
|
383
|
-
}
|
|
383
|
+
}
|
|
384
384
|
|
|
385
385
|
exports.ReactThreeFiber = events.threeTypes;
|
|
386
386
|
exports._roots = events._roots;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var events = require('./events-
|
|
5
|
+
var events = require('./events-484fb9c5.cjs.prod.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var THREE = require('three');
|
|
8
8
|
var createDebounce = require('debounce');
|
|
@@ -232,7 +232,8 @@ function findScrollContainers(element) {
|
|
|
232
232
|
const keys = ['x', 'y', 'top', 'bottom', 'left', 'right', 'width', 'height'];
|
|
233
233
|
const areBoundsEqual = (a, b) => keys.every(key => a[key] === b[key]);
|
|
234
234
|
|
|
235
|
-
|
|
235
|
+
function CanvasImpl({
|
|
236
|
+
ref,
|
|
236
237
|
children,
|
|
237
238
|
fallback,
|
|
238
239
|
resize,
|
|
@@ -255,7 +256,7 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
255
256
|
onPointerMissed,
|
|
256
257
|
onCreated,
|
|
257
258
|
...props
|
|
258
|
-
}
|
|
259
|
+
}) {
|
|
259
260
|
// Create a known catalogue of Threejs-native elements
|
|
260
261
|
// This will include the entire THREE namespace by default, users can extend
|
|
261
262
|
// their own elements by using the createRoot API instead
|
|
@@ -271,7 +272,7 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
271
272
|
});
|
|
272
273
|
const canvasRef = React__namespace.useRef(null);
|
|
273
274
|
const divRef = React__namespace.useRef(null);
|
|
274
|
-
React__namespace.useImperativeHandle(
|
|
275
|
+
React__namespace.useImperativeHandle(ref, () => canvasRef.current);
|
|
275
276
|
const handlePointerMissed = events.useMutableCallback(onPointerMissed);
|
|
276
277
|
const [block, setBlock] = React__namespace.useState(false);
|
|
277
278
|
const [error, setError] = React__namespace.useState(false);
|
|
@@ -367,20 +368,19 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
367
368
|
})
|
|
368
369
|
})
|
|
369
370
|
});
|
|
370
|
-
}
|
|
371
|
+
}
|
|
371
372
|
|
|
372
373
|
/**
|
|
373
374
|
* A DOM canvas which accepts threejs elements as children.
|
|
374
375
|
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
375
376
|
*/
|
|
376
|
-
|
|
377
|
+
function Canvas(props) {
|
|
377
378
|
return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {
|
|
378
379
|
children: /*#__PURE__*/jsxRuntime.jsx(CanvasImpl, {
|
|
379
|
-
...props
|
|
380
|
-
ref: ref
|
|
380
|
+
...props
|
|
381
381
|
})
|
|
382
382
|
});
|
|
383
|
-
}
|
|
383
|
+
}
|
|
384
384
|
|
|
385
385
|
exports.ReactThreeFiber = events.threeTypes;
|
|
386
386
|
exports._roots = events._roots;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as extend, u as useBridge, a as useMutableCallback, b as useIsomorphicLayoutEffect, c as createRoot, i as isRef, E as ErrorBoundary, B as Block, d as unmountComponentAtNode, f as createPointerEvents } from './events-
|
|
2
|
-
export { t as ReactThreeFiber, _ as _roots, x as act, k as addAfterEffect, j as addEffect, l as addTail, n as advance, s as applyProps, y as buildGraph, q as context, g as createEvents, p as createPortal, c as createRoot, w as dispose, f as events, e as extend, h as flushGlobalEffects, v as getRootState, m as invalidate, r as reconciler, o as render, d as unmountComponentAtNode, D as useFrame, F as useGraph, z as useInstanceHandle, G as useLoader, A as useStore, C as useThree } from './events-
|
|
1
|
+
import { e as extend, u as useBridge, a as useMutableCallback, b as useIsomorphicLayoutEffect, c as createRoot, i as isRef, E as ErrorBoundary, B as Block, d as unmountComponentAtNode, f as createPointerEvents } from './events-64d1e225.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, _ as _roots, x as act, k as addAfterEffect, j as addEffect, l as addTail, n as advance, s as applyProps, y as buildGraph, q as context, g as createEvents, p as createPortal, c as createRoot, w as dispose, f as events, e as extend, h as flushGlobalEffects, v as getRootState, m as invalidate, r as reconciler, o as render, d as unmountComponentAtNode, D as useFrame, F as useGraph, z as useInstanceHandle, G as useLoader, A as useStore, C as useThree } from './events-64d1e225.esm.js';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useState, useRef, useEffect, useMemo } from 'react';
|
|
5
5
|
import * as THREE from 'three';
|
|
@@ -206,7 +206,8 @@ function findScrollContainers(element) {
|
|
|
206
206
|
const keys = ['x', 'y', 'top', 'bottom', 'left', 'right', 'width', 'height'];
|
|
207
207
|
const areBoundsEqual = (a, b) => keys.every(key => a[key] === b[key]);
|
|
208
208
|
|
|
209
|
-
|
|
209
|
+
function CanvasImpl({
|
|
210
|
+
ref,
|
|
210
211
|
children,
|
|
211
212
|
fallback,
|
|
212
213
|
resize,
|
|
@@ -229,7 +230,7 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
229
230
|
onPointerMissed,
|
|
230
231
|
onCreated,
|
|
231
232
|
...props
|
|
232
|
-
}
|
|
233
|
+
}) {
|
|
233
234
|
// Create a known catalogue of Threejs-native elements
|
|
234
235
|
// This will include the entire THREE namespace by default, users can extend
|
|
235
236
|
// their own elements by using the createRoot API instead
|
|
@@ -245,7 +246,7 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
245
246
|
});
|
|
246
247
|
const canvasRef = React.useRef(null);
|
|
247
248
|
const divRef = React.useRef(null);
|
|
248
|
-
React.useImperativeHandle(
|
|
249
|
+
React.useImperativeHandle(ref, () => canvasRef.current);
|
|
249
250
|
const handlePointerMissed = useMutableCallback(onPointerMissed);
|
|
250
251
|
const [block, setBlock] = React.useState(false);
|
|
251
252
|
const [error, setError] = React.useState(false);
|
|
@@ -341,19 +342,18 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
341
342
|
})
|
|
342
343
|
})
|
|
343
344
|
});
|
|
344
|
-
}
|
|
345
|
+
}
|
|
345
346
|
|
|
346
347
|
/**
|
|
347
348
|
* A DOM canvas which accepts threejs elements as children.
|
|
348
349
|
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
349
350
|
*/
|
|
350
|
-
|
|
351
|
+
function Canvas(props) {
|
|
351
352
|
return /*#__PURE__*/jsx(FiberProvider, {
|
|
352
353
|
children: /*#__PURE__*/jsx(CanvasImpl, {
|
|
353
|
-
...props
|
|
354
|
-
ref: ref
|
|
354
|
+
...props
|
|
355
355
|
})
|
|
356
356
|
});
|
|
357
|
-
}
|
|
357
|
+
}
|
|
358
358
|
|
|
359
359
|
export { Canvas };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var events = require('../../dist/events-
|
|
5
|
+
var events = require('../../dist/events-c2452172.cjs.dev.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var THREE = require('three');
|
|
8
8
|
var reactNative = require('react-native');
|
|
@@ -43,11 +43,7 @@ var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
|
43
43
|
|
|
44
44
|
// TODO: React 19 needs support from react-native
|
|
45
45
|
const _View = reactNative.View;
|
|
46
|
-
|
|
47
|
-
* A native canvas which accepts threejs elements as children.
|
|
48
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
49
|
-
*/
|
|
50
|
-
const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(({
|
|
46
|
+
function CanvasImpl({
|
|
51
47
|
children,
|
|
52
48
|
style,
|
|
53
49
|
gl,
|
|
@@ -64,8 +60,9 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
64
60
|
scene,
|
|
65
61
|
onPointerMissed,
|
|
66
62
|
onCreated,
|
|
63
|
+
ref,
|
|
67
64
|
...props
|
|
68
|
-
}
|
|
65
|
+
}) {
|
|
69
66
|
// Create a known catalogue of Threejs-native elements
|
|
70
67
|
// This will include the entire THREE namespace by default, users can extend
|
|
71
68
|
// their own elements by using the createRoot API instead
|
|
@@ -84,7 +81,7 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
84
81
|
});
|
|
85
82
|
const [canvas, setCanvas] = React__namespace.useState(null);
|
|
86
83
|
const [bind, setBind] = React__namespace.useState();
|
|
87
|
-
React__namespace.useImperativeHandle(
|
|
84
|
+
React__namespace.useImperativeHandle(ref, () => viewRef.current);
|
|
88
85
|
const handlePointerMissed = events.useMutableCallback(onPointerMissed);
|
|
89
86
|
const [block, setBlock] = React__namespace.useState(false);
|
|
90
87
|
const [error, setError] = React__namespace.useState(undefined);
|
|
@@ -265,20 +262,19 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
265
262
|
style: reactNative.StyleSheet.absoluteFill
|
|
266
263
|
})
|
|
267
264
|
});
|
|
268
|
-
}
|
|
265
|
+
}
|
|
269
266
|
|
|
270
267
|
/**
|
|
271
268
|
* A native canvas which accepts threejs elements as children.
|
|
272
269
|
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
273
270
|
*/
|
|
274
|
-
|
|
271
|
+
function Canvas(props) {
|
|
275
272
|
return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {
|
|
276
273
|
children: /*#__PURE__*/jsxRuntime.jsx(CanvasImpl, {
|
|
277
|
-
...props
|
|
278
|
-
ref: ref
|
|
274
|
+
...props
|
|
279
275
|
})
|
|
280
276
|
});
|
|
281
|
-
}
|
|
277
|
+
}
|
|
282
278
|
|
|
283
279
|
/** Default R3F event manager for react-native */
|
|
284
280
|
function createTouchEvents(store) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var events = require('../../dist/events-
|
|
5
|
+
var events = require('../../dist/events-484fb9c5.cjs.prod.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var THREE = require('three');
|
|
8
8
|
var reactNative = require('react-native');
|
|
@@ -43,11 +43,7 @@ var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
|
43
43
|
|
|
44
44
|
// TODO: React 19 needs support from react-native
|
|
45
45
|
const _View = reactNative.View;
|
|
46
|
-
|
|
47
|
-
* A native canvas which accepts threejs elements as children.
|
|
48
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
49
|
-
*/
|
|
50
|
-
const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(({
|
|
46
|
+
function CanvasImpl({
|
|
51
47
|
children,
|
|
52
48
|
style,
|
|
53
49
|
gl,
|
|
@@ -64,8 +60,9 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
64
60
|
scene,
|
|
65
61
|
onPointerMissed,
|
|
66
62
|
onCreated,
|
|
63
|
+
ref,
|
|
67
64
|
...props
|
|
68
|
-
}
|
|
65
|
+
}) {
|
|
69
66
|
// Create a known catalogue of Threejs-native elements
|
|
70
67
|
// This will include the entire THREE namespace by default, users can extend
|
|
71
68
|
// their own elements by using the createRoot API instead
|
|
@@ -84,7 +81,7 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
84
81
|
});
|
|
85
82
|
const [canvas, setCanvas] = React__namespace.useState(null);
|
|
86
83
|
const [bind, setBind] = React__namespace.useState();
|
|
87
|
-
React__namespace.useImperativeHandle(
|
|
84
|
+
React__namespace.useImperativeHandle(ref, () => viewRef.current);
|
|
88
85
|
const handlePointerMissed = events.useMutableCallback(onPointerMissed);
|
|
89
86
|
const [block, setBlock] = React__namespace.useState(false);
|
|
90
87
|
const [error, setError] = React__namespace.useState(undefined);
|
|
@@ -265,20 +262,19 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
265
262
|
style: reactNative.StyleSheet.absoluteFill
|
|
266
263
|
})
|
|
267
264
|
});
|
|
268
|
-
}
|
|
265
|
+
}
|
|
269
266
|
|
|
270
267
|
/**
|
|
271
268
|
* A native canvas which accepts threejs elements as children.
|
|
272
269
|
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
273
270
|
*/
|
|
274
|
-
|
|
271
|
+
function Canvas(props) {
|
|
275
272
|
return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {
|
|
276
273
|
children: /*#__PURE__*/jsxRuntime.jsx(CanvasImpl, {
|
|
277
|
-
...props
|
|
278
|
-
ref: ref
|
|
274
|
+
...props
|
|
279
275
|
})
|
|
280
276
|
});
|
|
281
|
-
}
|
|
277
|
+
}
|
|
282
278
|
|
|
283
279
|
/** Default R3F event manager for react-native */
|
|
284
280
|
function createTouchEvents(store) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as extend, u as useBridge, a as useMutableCallback, c as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode, f as createPointerEvents, g as createEvents } from '../../dist/events-
|
|
2
|
-
export { t as ReactThreeFiber, _ as _roots, x as act, k as addAfterEffect, j as addEffect, l as addTail, n as advance, s as applyProps, y as buildGraph, q as context, g as createEvents, p as createPortal, c as createRoot, w as dispose, e as extend, h as flushGlobalEffects, v as getRootState, m as invalidate, r as reconciler, o as render, d as unmountComponentAtNode, D as useFrame, F as useGraph, z as useInstanceHandle, G as useLoader, A as useStore, C as useThree } from '../../dist/events-
|
|
1
|
+
import { e as extend, u as useBridge, a as useMutableCallback, c as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode, f as createPointerEvents, g as createEvents } from '../../dist/events-64d1e225.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, _ as _roots, x as act, k as addAfterEffect, j as addEffect, l as addTail, n as advance, s as applyProps, y as buildGraph, q as context, g as createEvents, p as createPortal, c as createRoot, w as dispose, e as extend, h as flushGlobalEffects, v as getRootState, m as invalidate, r as reconciler, o as render, d as unmountComponentAtNode, D as useFrame, F as useGraph, z as useInstanceHandle, G as useLoader, A as useStore, C as useThree } from '../../dist/events-64d1e225.esm.js';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { PanResponder, PixelRatio, StyleSheet, View, Platform, Image, NativeModules } from 'react-native';
|
|
@@ -18,11 +18,7 @@ import 'suspend-react';
|
|
|
18
18
|
|
|
19
19
|
// TODO: React 19 needs support from react-native
|
|
20
20
|
const _View = View;
|
|
21
|
-
|
|
22
|
-
* A native canvas which accepts threejs elements as children.
|
|
23
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
24
|
-
*/
|
|
25
|
-
const CanvasImpl = /*#__PURE__*/React.forwardRef(({
|
|
21
|
+
function CanvasImpl({
|
|
26
22
|
children,
|
|
27
23
|
style,
|
|
28
24
|
gl,
|
|
@@ -39,8 +35,9 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(({
|
|
|
39
35
|
scene,
|
|
40
36
|
onPointerMissed,
|
|
41
37
|
onCreated,
|
|
38
|
+
ref,
|
|
42
39
|
...props
|
|
43
|
-
}
|
|
40
|
+
}) {
|
|
44
41
|
// Create a known catalogue of Threejs-native elements
|
|
45
42
|
// This will include the entire THREE namespace by default, users can extend
|
|
46
43
|
// their own elements by using the createRoot API instead
|
|
@@ -59,7 +56,7 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(({
|
|
|
59
56
|
});
|
|
60
57
|
const [canvas, setCanvas] = React.useState(null);
|
|
61
58
|
const [bind, setBind] = React.useState();
|
|
62
|
-
React.useImperativeHandle(
|
|
59
|
+
React.useImperativeHandle(ref, () => viewRef.current);
|
|
63
60
|
const handlePointerMissed = useMutableCallback(onPointerMissed);
|
|
64
61
|
const [block, setBlock] = React.useState(false);
|
|
65
62
|
const [error, setError] = React.useState(undefined);
|
|
@@ -240,20 +237,19 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(({
|
|
|
240
237
|
style: StyleSheet.absoluteFill
|
|
241
238
|
})
|
|
242
239
|
});
|
|
243
|
-
}
|
|
240
|
+
}
|
|
244
241
|
|
|
245
242
|
/**
|
|
246
243
|
* A native canvas which accepts threejs elements as children.
|
|
247
244
|
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
248
245
|
*/
|
|
249
|
-
|
|
246
|
+
function Canvas(props) {
|
|
250
247
|
return /*#__PURE__*/jsx(FiberProvider, {
|
|
251
248
|
children: /*#__PURE__*/jsx(CanvasImpl, {
|
|
252
|
-
...props
|
|
253
|
-
ref: ref
|
|
249
|
+
...props
|
|
254
250
|
})
|
|
255
251
|
});
|
|
256
|
-
}
|
|
252
|
+
}
|
|
257
253
|
|
|
258
254
|
/** Default R3F event manager for react-native */
|
|
259
255
|
function createTouchEvents(store) {
|