@react-three/fiber 8.0.10 → 8.0.13

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-c8c0474b.cjs.prod.js');
5
+ var index = require('./index-46325a70.cjs.prod.js');
6
6
  var _extends = require('@babel/runtime/helpers/extends');
7
7
  var React = require('react');
8
8
  var THREE = require('three');
@@ -25,14 +25,12 @@ function _interopNamespace(e) {
25
25
  var d = Object.getOwnPropertyDescriptor(e, k);
26
26
  Object.defineProperty(n, k, d.get ? d : {
27
27
  enumerable: true,
28
- get: function () {
29
- return e[k];
30
- }
28
+ get: function () { return e[k]; }
31
29
  });
32
30
  }
33
31
  });
34
32
  }
35
- n['default'] = e;
33
+ n["default"] = e;
36
34
  return Object.freeze(n);
37
35
  }
38
36
 
@@ -119,19 +117,29 @@ function createPointerEvents(store) {
119
117
  };
120
118
  }
121
119
 
122
- const CANVAS_PROPS = ['gl', 'events', 'shadows', 'linear', 'flat', 'legacy', 'orthographic', 'frameloop', 'dpr', 'performance', 'raycaster', 'camera', 'onPointerMissed', 'onCreated'];
123
120
  /**
124
121
  * A DOM canvas which accepts threejs elements as children.
125
122
  * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
126
123
  */
127
-
128
124
  const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
129
125
  children,
130
126
  fallback,
131
127
  resize,
132
128
  style,
133
- onPointerMissed,
129
+ gl,
134
130
  events = createPointerEvents,
131
+ shadows,
132
+ linear,
133
+ flat,
134
+ legacy,
135
+ orthographic,
136
+ frameloop,
137
+ dpr,
138
+ performance,
139
+ raycaster,
140
+ camera,
141
+ onPointerMissed,
142
+ onCreated,
135
143
  ...props
136
144
  }, forwardedRef) {
137
145
  // Create a known catalogue of Threejs-native elements
@@ -141,7 +149,7 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
141
149
  const [containerRef, {
142
150
  width,
143
151
  height
144
- }] = useMeasure__default['default']({
152
+ }] = useMeasure__default["default"]({
145
153
  scroll: true,
146
154
  debounce: {
147
155
  scroll: 50,
@@ -153,8 +161,6 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
153
161
  const meshRef = React__namespace.useRef(null);
154
162
  const [canvas, setCanvas] = React__namespace.useState(null);
155
163
  const handlePointerMissed = index.useMutableCallback(onPointerMissed);
156
- const canvasProps = index.pick(props, CANVAS_PROPS);
157
- const divProps = index.omit(props, CANVAS_PROPS);
158
164
  const [block, setBlock] = React__namespace.useState(false);
159
165
  const [error, setError] = React__namespace.useState(false); // Suspend this component if block is a promise (2nd run)
160
166
 
@@ -165,18 +171,29 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
165
171
 
166
172
  if (width > 0 && height > 0 && canvas) {
167
173
  if (!root.current) root.current = index.createRoot(canvas);
168
- root.current.configure({ ...canvasProps,
169
- // Pass mutable reference to onPointerMissed so it's free to update
170
- onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
171
- onCreated: state => {
172
- state.events.connect == null ? void 0 : state.events.connect(meshRef.current);
173
- canvasProps.onCreated == null ? void 0 : canvasProps.onCreated(state);
174
- },
174
+ root.current.configure({
175
+ gl,
176
+ events,
177
+ shadows,
178
+ linear,
179
+ flat,
180
+ legacy,
181
+ orthographic,
182
+ frameloop,
183
+ dpr,
184
+ performance,
185
+ raycaster,
186
+ camera,
175
187
  size: {
176
188
  width,
177
189
  height
178
190
  },
179
- events
191
+ // Pass mutable reference to onPointerMissed so it's free to update
192
+ onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
193
+ onCreated: state => {
194
+ state.events.connect == null ? void 0 : state.events.connect(meshRef.current);
195
+ onCreated == null ? void 0 : onCreated(state);
196
+ }
180
197
  });
181
198
  root.current.render( /*#__PURE__*/React__namespace.createElement(index.ErrorBoundary, {
182
199
  set: setError
@@ -194,7 +211,7 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
194
211
  if (canvas) return () => index.unmountComponentAtNode(canvas);
195
212
  }, [canvas]);
196
213
  return /*#__PURE__*/React__namespace.createElement("div", _extends({
197
- ref: mergeRefs__default['default']([meshRef, containerRef]),
214
+ ref: mergeRefs__default["default"]([meshRef, containerRef]),
198
215
  style: {
199
216
  position: 'relative',
200
217
  width: '100%',
@@ -202,8 +219,8 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
202
219
  overflow: 'hidden',
203
220
  ...style
204
221
  }
205
- }, divProps), /*#__PURE__*/React__namespace.createElement("canvas", {
206
- ref: mergeRefs__default['default']([canvasRef, forwardedRef]),
222
+ }, props), /*#__PURE__*/React__namespace.createElement("canvas", {
223
+ ref: mergeRefs__default["default"]([canvasRef, forwardedRef]),
207
224
  style: {
208
225
  display: 'block'
209
226
  }
@@ -1,5 +1,5 @@
1
- import { c as createEvents, e as extend, u as useMutableCallback, p as pick, o as omit, a as createRoot, E as ErrorBoundary, B as Block, b as useIsomorphicLayoutEffect, d as unmountComponentAtNode } from './index-91152509.esm.js';
2
- export { t as ReactThreeFiber, w as _roots, v as act, n as addAfterEffect, m as addEffect, q as addTail, l as advance, i as applyProps, f as context, g as createPortal, a as createRoot, j as dispose, e as extend, s as getRootState, k as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, z as useFrame, A as useGraph, C as useLoader, x as useStore, y as useThree } from './index-91152509.esm.js';
1
+ import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, E as ErrorBoundary, B as Block, b as useIsomorphicLayoutEffect, d as unmountComponentAtNode } from './index-ec95272c.esm.js';
2
+ export { t as ReactThreeFiber, s as _roots, q as act, n as addAfterEffect, m as addEffect, o as addTail, l as advance, i as applyProps, f as context, g as createPortal, a as createRoot, j as dispose, e as extend, p as getRootState, k as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, x as useFrame, y as useGraph, z as useLoader, v as useStore, w as useThree } from './index-ec95272c.esm.js';
3
3
  import _extends from '@babel/runtime/helpers/esm/extends';
4
4
  import * as React from 'react';
5
5
  import * as THREE from 'three';
@@ -89,19 +89,29 @@ function createPointerEvents(store) {
89
89
  };
90
90
  }
91
91
 
92
- const CANVAS_PROPS = ['gl', 'events', 'shadows', 'linear', 'flat', 'legacy', 'orthographic', 'frameloop', 'dpr', 'performance', 'raycaster', 'camera', 'onPointerMissed', 'onCreated'];
93
92
  /**
94
93
  * A DOM canvas which accepts threejs elements as children.
95
94
  * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
96
95
  */
97
-
98
96
  const Canvas = /*#__PURE__*/React.forwardRef(function Canvas({
99
97
  children,
100
98
  fallback,
101
99
  resize,
102
100
  style,
103
- onPointerMissed,
101
+ gl,
104
102
  events = createPointerEvents,
103
+ shadows,
104
+ linear,
105
+ flat,
106
+ legacy,
107
+ orthographic,
108
+ frameloop,
109
+ dpr,
110
+ performance,
111
+ raycaster,
112
+ camera,
113
+ onPointerMissed,
114
+ onCreated,
105
115
  ...props
106
116
  }, forwardedRef) {
107
117
  // Create a known catalogue of Threejs-native elements
@@ -123,8 +133,6 @@ const Canvas = /*#__PURE__*/React.forwardRef(function Canvas({
123
133
  const meshRef = React.useRef(null);
124
134
  const [canvas, setCanvas] = React.useState(null);
125
135
  const handlePointerMissed = useMutableCallback(onPointerMissed);
126
- const canvasProps = pick(props, CANVAS_PROPS);
127
- const divProps = omit(props, CANVAS_PROPS);
128
136
  const [block, setBlock] = React.useState(false);
129
137
  const [error, setError] = React.useState(false); // Suspend this component if block is a promise (2nd run)
130
138
 
@@ -135,18 +143,29 @@ const Canvas = /*#__PURE__*/React.forwardRef(function Canvas({
135
143
 
136
144
  if (width > 0 && height > 0 && canvas) {
137
145
  if (!root.current) root.current = createRoot(canvas);
138
- root.current.configure({ ...canvasProps,
139
- // Pass mutable reference to onPointerMissed so it's free to update
140
- onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
141
- onCreated: state => {
142
- state.events.connect == null ? void 0 : state.events.connect(meshRef.current);
143
- canvasProps.onCreated == null ? void 0 : canvasProps.onCreated(state);
144
- },
146
+ root.current.configure({
147
+ gl,
148
+ events,
149
+ shadows,
150
+ linear,
151
+ flat,
152
+ legacy,
153
+ orthographic,
154
+ frameloop,
155
+ dpr,
156
+ performance,
157
+ raycaster,
158
+ camera,
145
159
  size: {
146
160
  width,
147
161
  height
148
162
  },
149
- events
163
+ // Pass mutable reference to onPointerMissed so it's free to update
164
+ onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
165
+ onCreated: state => {
166
+ state.events.connect == null ? void 0 : state.events.connect(meshRef.current);
167
+ onCreated == null ? void 0 : onCreated(state);
168
+ }
150
169
  });
151
170
  root.current.render( /*#__PURE__*/React.createElement(ErrorBoundary, {
152
171
  set: setError
@@ -172,7 +191,7 @@ const Canvas = /*#__PURE__*/React.forwardRef(function Canvas({
172
191
  overflow: 'hidden',
173
192
  ...style
174
193
  }
175
- }, divProps), /*#__PURE__*/React.createElement("canvas", {
194
+ }, props), /*#__PURE__*/React.createElement("canvas", {
176
195
  ref: mergeRefs([canvasRef, forwardedRef]),
177
196
  style: {
178
197
  display: 'block'
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var THREE = require('three');
6
6
  var expoAsset = require('expo-asset');
7
- var index = require('../../dist/index-018d2d45.cjs.dev.js');
7
+ var index = require('../../dist/index-9ced08b3.cjs.dev.js');
8
8
  var _extends = require('@babel/runtime/helpers/extends');
9
9
  var React = require('react');
10
10
  var mergeRefs = require('react-merge-refs');
@@ -28,14 +28,12 @@ function _interopNamespace(e) {
28
28
  var d = Object.getOwnPropertyDescriptor(e, k);
29
29
  Object.defineProperty(n, k, d.get ? d : {
30
30
  enumerable: true,
31
- get: function () {
32
- return e[k];
33
- }
31
+ get: function () { return e[k]; }
34
32
  });
35
33
  }
36
34
  });
37
35
  }
38
- n['default'] = e;
36
+ n["default"] = e;
39
37
  return Object.freeze(n);
40
38
  }
41
39
 
@@ -100,7 +98,7 @@ function createTouchEvents(store) {
100
98
  events
101
99
  } = store.getState();
102
100
  events.disconnect == null ? void 0 : events.disconnect();
103
- const connected = new Pressability__default['default'](events == null ? void 0 : events.handlers);
101
+ const connected = new Pressability__default["default"](events == null ? void 0 : events.handlers);
104
102
  set(state => ({
105
103
  events: { ...state.events,
106
104
  connected
@@ -127,17 +125,26 @@ function createTouchEvents(store) {
127
125
  };
128
126
  }
129
127
 
130
- const CANVAS_PROPS = ['gl', 'events', 'shadows', 'linear', 'flat', 'legacy', 'orthographic', 'frameloop', 'performance', 'raycaster', 'camera', 'onPointerMissed', 'onCreated'];
131
128
  /**
132
129
  * A native canvas which accepts threejs elements as children.
133
130
  * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
134
131
  */
135
-
136
132
  const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
137
133
  children,
138
134
  style,
139
- events,
135
+ gl,
136
+ events = createTouchEvents,
137
+ shadows,
138
+ linear,
139
+ flat,
140
+ legacy,
141
+ orthographic,
142
+ frameloop,
143
+ performance,
144
+ raycaster,
145
+ camera,
140
146
  onPointerMissed,
147
+ onCreated,
141
148
  ...props
142
149
  }, forwardedRef) => {
143
150
  // Create a known catalogue of Threejs-native elements
@@ -154,8 +161,6 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
154
161
  const [canvas, setCanvas] = React__namespace.useState(null);
155
162
  const [bind, setBind] = React__namespace.useState();
156
163
  const handlePointerMissed = index.useMutableCallback(onPointerMissed);
157
- const canvasProps = index.pick(props, CANVAS_PROPS);
158
- const viewProps = index.omit(props, CANVAS_PROPS);
159
164
  const [block, setBlock] = React__namespace.useState(false);
160
165
  const [error, setError] = React__namespace.useState(false); // Suspend this component if block is a promise (2nd run)
161
166
 
@@ -188,27 +193,19 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
188
193
  }, []);
189
194
 
190
195
  if (width > 0 && height > 0 && canvas) {
191
- if (!root.current) root.current = index.createRoot(canvas); // Overwrite onCreated to apply RN bindings
192
-
193
- const onCreated = state => {
194
- // Bind events after creation
195
- const handlers = state.events.connect == null ? void 0 : state.events.connect(viewRef.current);
196
- setBind(handlers); // Bind render to RN bridge
197
-
198
- const context = state.gl.getContext();
199
- const renderFrame = state.gl.render.bind(state.gl);
200
-
201
- state.gl.render = (scene, camera) => {
202
- renderFrame(scene, camera);
203
- context.endFrameEXP();
204
- };
205
-
206
- return canvasProps == null ? void 0 : canvasProps.onCreated == null ? void 0 : canvasProps.onCreated(state);
207
- };
208
-
209
- root.current.configure({ ...canvasProps,
210
- // Pass mutable reference to onPointerMissed so it's free to update
211
- onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
196
+ if (!root.current) root.current = index.createRoot(canvas);
197
+ root.current.configure({
198
+ gl,
199
+ events,
200
+ shadows,
201
+ linear,
202
+ flat,
203
+ legacy,
204
+ orthographic,
205
+ frameloop,
206
+ performance,
207
+ raycaster,
208
+ camera,
212
209
  // expo-gl can only render at native dpr/resolution
213
210
  // https://github.com/expo/expo-three/issues/39
214
211
  dpr: reactNative.PixelRatio.get(),
@@ -216,8 +213,24 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
216
213
  width,
217
214
  height
218
215
  },
219
- events: events || createTouchEvents,
220
- onCreated
216
+ // Pass mutable reference to onPointerMissed so it's free to update
217
+ onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
218
+ // Overwrite onCreated to apply RN bindings
219
+ onCreated: state => {
220
+ // Bind events after creation
221
+ const handlers = state.events.connect == null ? void 0 : state.events.connect(viewRef.current);
222
+ setBind(handlers); // Bind render to RN bridge
223
+
224
+ const context = state.gl.getContext();
225
+ const renderFrame = state.gl.render.bind(state.gl);
226
+
227
+ state.gl.render = (scene, camera) => {
228
+ renderFrame(scene, camera);
229
+ context.endFrameEXP();
230
+ };
231
+
232
+ return onCreated == null ? void 0 : onCreated(state);
233
+ }
221
234
  });
222
235
  root.current.render( /*#__PURE__*/React__namespace.createElement(index.ErrorBoundary, {
223
236
  set: setError
@@ -233,8 +246,8 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
233
246
  return () => index.unmountComponentAtNode(canvas);
234
247
  }
235
248
  }, [canvas]);
236
- return /*#__PURE__*/React__namespace.createElement(reactNative.View, _extends({}, viewProps, {
237
- ref: mergeRefs__default['default']([viewRef, forwardedRef]),
249
+ return /*#__PURE__*/React__namespace.createElement(reactNative.View, _extends({}, props, {
250
+ ref: mergeRefs__default["default"]([viewRef, forwardedRef]),
238
251
  onLayout: onLayout,
239
252
  style: {
240
253
  flex: 1,
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var THREE = require('three');
6
6
  var expoAsset = require('expo-asset');
7
- var index = require('../../dist/index-c8c0474b.cjs.prod.js');
7
+ var index = require('../../dist/index-46325a70.cjs.prod.js');
8
8
  var _extends = require('@babel/runtime/helpers/extends');
9
9
  var React = require('react');
10
10
  var mergeRefs = require('react-merge-refs');
@@ -28,14 +28,12 @@ function _interopNamespace(e) {
28
28
  var d = Object.getOwnPropertyDescriptor(e, k);
29
29
  Object.defineProperty(n, k, d.get ? d : {
30
30
  enumerable: true,
31
- get: function () {
32
- return e[k];
33
- }
31
+ get: function () { return e[k]; }
34
32
  });
35
33
  }
36
34
  });
37
35
  }
38
- n['default'] = e;
36
+ n["default"] = e;
39
37
  return Object.freeze(n);
40
38
  }
41
39
 
@@ -100,7 +98,7 @@ function createTouchEvents(store) {
100
98
  events
101
99
  } = store.getState();
102
100
  events.disconnect == null ? void 0 : events.disconnect();
103
- const connected = new Pressability__default['default'](events == null ? void 0 : events.handlers);
101
+ const connected = new Pressability__default["default"](events == null ? void 0 : events.handlers);
104
102
  set(state => ({
105
103
  events: { ...state.events,
106
104
  connected
@@ -127,17 +125,26 @@ function createTouchEvents(store) {
127
125
  };
128
126
  }
129
127
 
130
- const CANVAS_PROPS = ['gl', 'events', 'shadows', 'linear', 'flat', 'legacy', 'orthographic', 'frameloop', 'performance', 'raycaster', 'camera', 'onPointerMissed', 'onCreated'];
131
128
  /**
132
129
  * A native canvas which accepts threejs elements as children.
133
130
  * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
134
131
  */
135
-
136
132
  const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
137
133
  children,
138
134
  style,
139
- events,
135
+ gl,
136
+ events = createTouchEvents,
137
+ shadows,
138
+ linear,
139
+ flat,
140
+ legacy,
141
+ orthographic,
142
+ frameloop,
143
+ performance,
144
+ raycaster,
145
+ camera,
140
146
  onPointerMissed,
147
+ onCreated,
141
148
  ...props
142
149
  }, forwardedRef) => {
143
150
  // Create a known catalogue of Threejs-native elements
@@ -154,8 +161,6 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
154
161
  const [canvas, setCanvas] = React__namespace.useState(null);
155
162
  const [bind, setBind] = React__namespace.useState();
156
163
  const handlePointerMissed = index.useMutableCallback(onPointerMissed);
157
- const canvasProps = index.pick(props, CANVAS_PROPS);
158
- const viewProps = index.omit(props, CANVAS_PROPS);
159
164
  const [block, setBlock] = React__namespace.useState(false);
160
165
  const [error, setError] = React__namespace.useState(false); // Suspend this component if block is a promise (2nd run)
161
166
 
@@ -188,27 +193,19 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
188
193
  }, []);
189
194
 
190
195
  if (width > 0 && height > 0 && canvas) {
191
- if (!root.current) root.current = index.createRoot(canvas); // Overwrite onCreated to apply RN bindings
192
-
193
- const onCreated = state => {
194
- // Bind events after creation
195
- const handlers = state.events.connect == null ? void 0 : state.events.connect(viewRef.current);
196
- setBind(handlers); // Bind render to RN bridge
197
-
198
- const context = state.gl.getContext();
199
- const renderFrame = state.gl.render.bind(state.gl);
200
-
201
- state.gl.render = (scene, camera) => {
202
- renderFrame(scene, camera);
203
- context.endFrameEXP();
204
- };
205
-
206
- return canvasProps == null ? void 0 : canvasProps.onCreated == null ? void 0 : canvasProps.onCreated(state);
207
- };
208
-
209
- root.current.configure({ ...canvasProps,
210
- // Pass mutable reference to onPointerMissed so it's free to update
211
- onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
196
+ if (!root.current) root.current = index.createRoot(canvas);
197
+ root.current.configure({
198
+ gl,
199
+ events,
200
+ shadows,
201
+ linear,
202
+ flat,
203
+ legacy,
204
+ orthographic,
205
+ frameloop,
206
+ performance,
207
+ raycaster,
208
+ camera,
212
209
  // expo-gl can only render at native dpr/resolution
213
210
  // https://github.com/expo/expo-three/issues/39
214
211
  dpr: reactNative.PixelRatio.get(),
@@ -216,8 +213,24 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
216
213
  width,
217
214
  height
218
215
  },
219
- events: events || createTouchEvents,
220
- onCreated
216
+ // Pass mutable reference to onPointerMissed so it's free to update
217
+ onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
218
+ // Overwrite onCreated to apply RN bindings
219
+ onCreated: state => {
220
+ // Bind events after creation
221
+ const handlers = state.events.connect == null ? void 0 : state.events.connect(viewRef.current);
222
+ setBind(handlers); // Bind render to RN bridge
223
+
224
+ const context = state.gl.getContext();
225
+ const renderFrame = state.gl.render.bind(state.gl);
226
+
227
+ state.gl.render = (scene, camera) => {
228
+ renderFrame(scene, camera);
229
+ context.endFrameEXP();
230
+ };
231
+
232
+ return onCreated == null ? void 0 : onCreated(state);
233
+ }
221
234
  });
222
235
  root.current.render( /*#__PURE__*/React__namespace.createElement(index.ErrorBoundary, {
223
236
  set: setError
@@ -233,8 +246,8 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
233
246
  return () => index.unmountComponentAtNode(canvas);
234
247
  }
235
248
  }, [canvas]);
236
- return /*#__PURE__*/React__namespace.createElement(reactNative.View, _extends({}, viewProps, {
237
- ref: mergeRefs__default['default']([viewRef, forwardedRef]),
249
+ return /*#__PURE__*/React__namespace.createElement(reactNative.View, _extends({}, props, {
250
+ ref: mergeRefs__default["default"]([viewRef, forwardedRef]),
238
251
  onLayout: onLayout,
239
252
  style: {
240
253
  flex: 1,
@@ -1,7 +1,7 @@
1
1
  import * as THREE from 'three';
2
2
  import { Asset } from 'expo-asset';
3
- import { c as createEvents, e as extend, u as useMutableCallback, p as pick, o as omit, a as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-91152509.esm.js';
4
- export { t as ReactThreeFiber, w as _roots, v as act, n as addAfterEffect, m as addEffect, q as addTail, l as advance, i as applyProps, f as context, g as createPortal, a as createRoot, j as dispose, e as extend, s as getRootState, k as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, z as useFrame, A as useGraph, C as useLoader, x as useStore, y as useThree } from '../../dist/index-91152509.esm.js';
3
+ import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-ec95272c.esm.js';
4
+ export { t as ReactThreeFiber, s as _roots, q as act, n as addAfterEffect, m as addEffect, o as addTail, l as advance, i as applyProps, f as context, g as createPortal, a as createRoot, j as dispose, e as extend, p as getRootState, k as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, x as useFrame, y as useGraph, z as useLoader, v as useStore, w as useThree } from '../../dist/index-ec95272c.esm.js';
5
5
  import _extends from '@babel/runtime/helpers/esm/extends';
6
6
  import * as React from 'react';
7
7
  import mergeRefs from 'react-merge-refs';
@@ -97,17 +97,26 @@ function createTouchEvents(store) {
97
97
  };
98
98
  }
99
99
 
100
- const CANVAS_PROPS = ['gl', 'events', 'shadows', 'linear', 'flat', 'legacy', 'orthographic', 'frameloop', 'performance', 'raycaster', 'camera', 'onPointerMissed', 'onCreated'];
101
100
  /**
102
101
  * A native canvas which accepts threejs elements as children.
103
102
  * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
104
103
  */
105
-
106
104
  const Canvas = /*#__PURE__*/React.forwardRef(({
107
105
  children,
108
106
  style,
109
- events,
107
+ gl,
108
+ events = createTouchEvents,
109
+ shadows,
110
+ linear,
111
+ flat,
112
+ legacy,
113
+ orthographic,
114
+ frameloop,
115
+ performance,
116
+ raycaster,
117
+ camera,
110
118
  onPointerMissed,
119
+ onCreated,
111
120
  ...props
112
121
  }, forwardedRef) => {
113
122
  // Create a known catalogue of Threejs-native elements
@@ -124,8 +133,6 @@ const Canvas = /*#__PURE__*/React.forwardRef(({
124
133
  const [canvas, setCanvas] = React.useState(null);
125
134
  const [bind, setBind] = React.useState();
126
135
  const handlePointerMissed = useMutableCallback(onPointerMissed);
127
- const canvasProps = pick(props, CANVAS_PROPS);
128
- const viewProps = omit(props, CANVAS_PROPS);
129
136
  const [block, setBlock] = React.useState(false);
130
137
  const [error, setError] = React.useState(false); // Suspend this component if block is a promise (2nd run)
131
138
 
@@ -158,27 +165,19 @@ const Canvas = /*#__PURE__*/React.forwardRef(({
158
165
  }, []);
159
166
 
160
167
  if (width > 0 && height > 0 && canvas) {
161
- if (!root.current) root.current = createRoot(canvas); // Overwrite onCreated to apply RN bindings
162
-
163
- const onCreated = state => {
164
- // Bind events after creation
165
- const handlers = state.events.connect == null ? void 0 : state.events.connect(viewRef.current);
166
- setBind(handlers); // Bind render to RN bridge
167
-
168
- const context = state.gl.getContext();
169
- const renderFrame = state.gl.render.bind(state.gl);
170
-
171
- state.gl.render = (scene, camera) => {
172
- renderFrame(scene, camera);
173
- context.endFrameEXP();
174
- };
175
-
176
- return canvasProps == null ? void 0 : canvasProps.onCreated == null ? void 0 : canvasProps.onCreated(state);
177
- };
178
-
179
- root.current.configure({ ...canvasProps,
180
- // Pass mutable reference to onPointerMissed so it's free to update
181
- onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
168
+ if (!root.current) root.current = createRoot(canvas);
169
+ root.current.configure({
170
+ gl,
171
+ events,
172
+ shadows,
173
+ linear,
174
+ flat,
175
+ legacy,
176
+ orthographic,
177
+ frameloop,
178
+ performance,
179
+ raycaster,
180
+ camera,
182
181
  // expo-gl can only render at native dpr/resolution
183
182
  // https://github.com/expo/expo-three/issues/39
184
183
  dpr: PixelRatio.get(),
@@ -186,8 +185,24 @@ const Canvas = /*#__PURE__*/React.forwardRef(({
186
185
  width,
187
186
  height
188
187
  },
189
- events: events || createTouchEvents,
190
- onCreated
188
+ // Pass mutable reference to onPointerMissed so it's free to update
189
+ onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
190
+ // Overwrite onCreated to apply RN bindings
191
+ onCreated: state => {
192
+ // Bind events after creation
193
+ const handlers = state.events.connect == null ? void 0 : state.events.connect(viewRef.current);
194
+ setBind(handlers); // Bind render to RN bridge
195
+
196
+ const context = state.gl.getContext();
197
+ const renderFrame = state.gl.render.bind(state.gl);
198
+
199
+ state.gl.render = (scene, camera) => {
200
+ renderFrame(scene, camera);
201
+ context.endFrameEXP();
202
+ };
203
+
204
+ return onCreated == null ? void 0 : onCreated(state);
205
+ }
191
206
  });
192
207
  root.current.render( /*#__PURE__*/React.createElement(ErrorBoundary, {
193
208
  set: setError
@@ -203,7 +218,7 @@ const Canvas = /*#__PURE__*/React.forwardRef(({
203
218
  return () => unmountComponentAtNode(canvas);
204
219
  }
205
220
  }, [canvas]);
206
- return /*#__PURE__*/React.createElement(View, _extends({}, viewProps, {
221
+ return /*#__PURE__*/React.createElement(View, _extends({}, props, {
207
222
  ref: mergeRefs([viewRef, forwardedRef]),
208
223
  onLayout: onLayout,
209
224
  style: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-three/fiber",
3
- "version": "8.0.10",
3
+ "version": "8.0.13",
4
4
  "description": "A React renderer for Threejs",
5
5
  "keywords": [
6
6
  "react",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@babel/runtime": "^7.17.8",
46
- "@types/react-reconciler": "^0.26.4",
46
+ "@types/react-reconciler": "^0.26.6",
47
47
  "react-merge-refs": "^1.1.0",
48
48
  "react-reconciler": "^0.27.0",
49
49
  "react-use-measure": "^2.1.1",