@react-three/fiber 8.14.5 → 8.14.7
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 +829 -817
- package/dist/{index-563322db.esm.js → index-c4d1c86e.esm.js} +73 -73
- package/dist/{index-0ed4bbca.cjs.prod.js → index-ce1a9f04.cjs.prod.js} +73 -73
- package/dist/{index-886811f8.cjs.dev.js → index-d1f17345.cjs.dev.js} +73 -73
- package/dist/react-three-fiber.cjs.dev.js +4 -4
- package/dist/react-three-fiber.cjs.prod.js +4 -4
- package/dist/react-three-fiber.esm.js +5 -5
- package/native/dist/react-three-fiber-native.cjs.dev.js +85 -107
- package/native/dist/react-three-fiber-native.cjs.prod.js +85 -107
- package/native/dist/react-three-fiber-native.esm.js +87 -109
- package/native/package.json +5 -5
- package/package.json +2 -1
- package/readme.md +253 -253
- package/yarn-error.log +10628 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('../../dist/index-
|
|
5
|
+
var index = require('../../dist/index-ce1a9f04.cjs.prod.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -12,6 +12,7 @@ var itsFine = require('its-fine');
|
|
|
12
12
|
var expoAsset = require('expo-asset');
|
|
13
13
|
var fs = require('expo-file-system');
|
|
14
14
|
var base64Js = require('base64-js');
|
|
15
|
+
var buffer = require('buffer');
|
|
15
16
|
require('react-reconciler/constants');
|
|
16
17
|
require('zustand');
|
|
17
18
|
require('react-reconciler');
|
|
@@ -122,9 +123,9 @@ function createTouchEvents(store) {
|
|
|
122
123
|
};
|
|
123
124
|
}
|
|
124
125
|
|
|
125
|
-
/**
|
|
126
|
-
* A native canvas which accepts threejs elements as children.
|
|
127
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
126
|
+
/**
|
|
127
|
+
* A native canvas which accepts threejs elements as children.
|
|
128
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
128
129
|
*/
|
|
129
130
|
const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(({
|
|
130
131
|
children,
|
|
@@ -271,9 +272,9 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
271
272
|
}));
|
|
272
273
|
});
|
|
273
274
|
|
|
274
|
-
/**
|
|
275
|
-
* A native canvas which accepts threejs elements as children.
|
|
276
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
275
|
+
/**
|
|
276
|
+
* A native canvas which accepts threejs elements as children.
|
|
277
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
277
278
|
*/
|
|
278
279
|
const Canvas = /*#__PURE__*/React__namespace.forwardRef(function CanvasWrapper(props, ref) {
|
|
279
280
|
return /*#__PURE__*/React__namespace.createElement(itsFine.FiberProvider, null, /*#__PURE__*/React__namespace.createElement(CanvasImpl, _extends({}, props, {
|
|
@@ -291,54 +292,52 @@ function polyfills() {
|
|
|
291
292
|
}
|
|
292
293
|
|
|
293
294
|
// Patch Blob for ArrayBuffer if unsupported
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
};
|
|
336
|
-
}
|
|
295
|
+
try {
|
|
296
|
+
new Blob([new ArrayBuffer(4)]);
|
|
297
|
+
} catch (_) {
|
|
298
|
+
const BlobManager = require('react-native/Libraries/Blob/BlobManager.js');
|
|
299
|
+
BlobManager.createFromParts = function createFromParts(parts, options) {
|
|
300
|
+
const blobId = uuidv4();
|
|
301
|
+
const items = parts.map(part => {
|
|
302
|
+
if (part instanceof ArrayBuffer || ArrayBuffer.isView(part)) {
|
|
303
|
+
const data = base64Js.fromByteArray(new Uint8Array(part));
|
|
304
|
+
return {
|
|
305
|
+
data,
|
|
306
|
+
type: 'string'
|
|
307
|
+
};
|
|
308
|
+
} else if (part instanceof Blob) {
|
|
309
|
+
return {
|
|
310
|
+
data: part.data,
|
|
311
|
+
type: 'blob'
|
|
312
|
+
};
|
|
313
|
+
} else {
|
|
314
|
+
return {
|
|
315
|
+
data: String(part),
|
|
316
|
+
type: 'string'
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
const size = items.reduce((acc, curr) => {
|
|
321
|
+
if (curr.type === 'string') {
|
|
322
|
+
return acc + global.unescape(encodeURI(curr.data)).length;
|
|
323
|
+
} else {
|
|
324
|
+
return acc + curr.data.size;
|
|
325
|
+
}
|
|
326
|
+
}, 0);
|
|
327
|
+
reactNative.NativeModules.BlobModule.createFromParts(items, blobId);
|
|
328
|
+
return BlobManager.createFromOptions({
|
|
329
|
+
blobId,
|
|
330
|
+
offset: 0,
|
|
331
|
+
size,
|
|
332
|
+
type: options ? options.type : '',
|
|
333
|
+
lastModified: options ? options.lastModified : Date.now()
|
|
334
|
+
});
|
|
335
|
+
};
|
|
337
336
|
}
|
|
338
337
|
async function getAsset(input) {
|
|
339
338
|
if (typeof input === 'string') {
|
|
340
|
-
// Don't process storage
|
|
341
|
-
if (input.startsWith('file:')
|
|
339
|
+
// Don't process storage
|
|
340
|
+
if (input.startsWith('file:')) return input;
|
|
342
341
|
|
|
343
342
|
// Unpack Blobs from react-native BlobManager
|
|
344
343
|
if (input.startsWith('blob:')) {
|
|
@@ -356,7 +355,18 @@ function polyfills() {
|
|
|
356
355
|
reader.onerror = rej;
|
|
357
356
|
reader.readAsText(blob);
|
|
358
357
|
});
|
|
359
|
-
|
|
358
|
+
input = `data:${blob.type};base64,${data}`;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// Create safe URI for JSI
|
|
362
|
+
if (input.startsWith('data:')) {
|
|
363
|
+
const [header, data] = input.split(',');
|
|
364
|
+
const [, type] = header.split('/');
|
|
365
|
+
const uri = fs__namespace.cacheDirectory + uuidv4() + `.${type}`;
|
|
366
|
+
await fs__namespace.writeAsStringAsync(uri, data, {
|
|
367
|
+
encoding: fs__namespace.EncodingType.Base64
|
|
368
|
+
});
|
|
369
|
+
return uri;
|
|
360
370
|
}
|
|
361
371
|
}
|
|
362
372
|
|
|
@@ -382,18 +392,10 @@ function polyfills() {
|
|
|
382
392
|
|
|
383
393
|
// There's no Image in native, so create a data texture instead
|
|
384
394
|
THREE__namespace.TextureLoader.prototype.load = function load(url, onLoad, onProgress, onError) {
|
|
385
|
-
if (this.path) url = this.path + url;
|
|
395
|
+
if (this.path && typeof url === 'string') url = this.path + url;
|
|
396
|
+
this.manager.itemStart(url);
|
|
386
397
|
const texture = new THREE__namespace.Texture();
|
|
387
398
|
getAsset(url).then(async uri => {
|
|
388
|
-
// Create safe URI for JSI
|
|
389
|
-
if (uri.startsWith('data:')) {
|
|
390
|
-
const [header, data] = uri.split(',');
|
|
391
|
-
const [, type] = header.split('/');
|
|
392
|
-
uri = fs__namespace.cacheDirectory + uuidv4() + `.${type}`;
|
|
393
|
-
await fs__namespace.writeAsStringAsync(uri, data, {
|
|
394
|
-
encoding: fs__namespace.EncodingType.Base64
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
399
|
const {
|
|
398
400
|
width,
|
|
399
401
|
height
|
|
@@ -416,59 +418,35 @@ function polyfills() {
|
|
|
416
418
|
// @ts-ignore
|
|
417
419
|
texture.isDataTexture = true;
|
|
418
420
|
onLoad == null ? void 0 : onLoad(texture);
|
|
419
|
-
}).catch(
|
|
421
|
+
}).catch(error => {
|
|
422
|
+
onError == null ? void 0 : onError(error);
|
|
423
|
+
this.manager.itemError(url);
|
|
424
|
+
}).finally(() => {
|
|
425
|
+
this.manager.itemEnd(url);
|
|
426
|
+
});
|
|
420
427
|
return texture;
|
|
421
428
|
};
|
|
422
429
|
|
|
423
430
|
// Fetches assets via XMLHttpRequest
|
|
424
431
|
THREE__namespace.FileLoader.prototype.load = function load(url, onLoad, onProgress, onError) {
|
|
425
|
-
if (this.path) url = this.path + url;
|
|
426
|
-
|
|
432
|
+
if (this.path && typeof url === 'string') url = this.path + url;
|
|
433
|
+
this.manager.itemStart(url);
|
|
427
434
|
getAsset(url).then(async uri => {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
this.manager.itemEnd(url);
|
|
440
|
-
} else {
|
|
441
|
-
onError == null ? void 0 : onError(event);
|
|
442
|
-
this.manager.itemError(url);
|
|
443
|
-
this.manager.itemEnd(url);
|
|
444
|
-
}
|
|
445
|
-
}, false);
|
|
446
|
-
request.addEventListener('progress', event => {
|
|
447
|
-
onProgress == null ? void 0 : onProgress(event);
|
|
448
|
-
}, false);
|
|
449
|
-
request.addEventListener('error', event => {
|
|
450
|
-
onError == null ? void 0 : onError(event);
|
|
451
|
-
this.manager.itemError(url);
|
|
452
|
-
this.manager.itemEnd(url);
|
|
453
|
-
}, false);
|
|
454
|
-
request.addEventListener('abort', event => {
|
|
455
|
-
onError == null ? void 0 : onError(event);
|
|
456
|
-
this.manager.itemError(url);
|
|
457
|
-
this.manager.itemEnd(url);
|
|
458
|
-
}, false);
|
|
459
|
-
if (this.responseType) request.responseType = this.responseType;
|
|
460
|
-
if (this.withCredentials) request.withCredentials = this.withCredentials;
|
|
461
|
-
for (const header in this.requestHeader) {
|
|
462
|
-
request.setRequestHeader(header, this.requestHeader[header]);
|
|
463
|
-
}
|
|
464
|
-
request.send(null);
|
|
465
|
-
this.manager.itemStart(url);
|
|
466
|
-
}).catch(onError);
|
|
467
|
-
return request;
|
|
435
|
+
const base64 = await fs__namespace.readAsStringAsync(uri, {
|
|
436
|
+
encoding: fs__namespace.EncodingType.Base64
|
|
437
|
+
});
|
|
438
|
+
const data = buffer.Buffer.from(base64, 'base64');
|
|
439
|
+
onLoad == null ? void 0 : onLoad(data.buffer);
|
|
440
|
+
}).catch(error => {
|
|
441
|
+
onError == null ? void 0 : onError(error);
|
|
442
|
+
this.manager.itemError(url);
|
|
443
|
+
}).finally(() => {
|
|
444
|
+
this.manager.itemEnd(url);
|
|
445
|
+
});
|
|
468
446
|
};
|
|
469
447
|
}
|
|
470
448
|
|
|
471
|
-
polyfills();
|
|
449
|
+
if (reactNative.Platform.OS !== 'web') polyfills();
|
|
472
450
|
|
|
473
451
|
exports.ReactThreeFiber = index.threeTypes;
|
|
474
452
|
exports._roots = index.roots;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { c as createEvents, e as extend, u as useMutableCallback, b as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-
|
|
2
|
-
export { t as ReactThreeFiber, w as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, f as context, c as createEvents, g as createPortal, b as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, A as useFrame, C as useGraph, x as useInstanceHandle, D as useLoader, y as useStore, z as useThree } from '../../dist/index-
|
|
1
|
+
import { c as createEvents, e as extend, u as useMutableCallback, b as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-c4d1c86e.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, w as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, f as context, c as createEvents, g as createPortal, b as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, A as useFrame, C as useGraph, x as useInstanceHandle, D as useLoader, y as useStore, z as useThree } from '../../dist/index-c4d1c86e.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';
|
|
6
|
-
import { PanResponder, PixelRatio, View, StyleSheet,
|
|
6
|
+
import { PanResponder, PixelRatio, View, StyleSheet, NativeModules, Image, Platform } from 'react-native';
|
|
7
7
|
import { GLView } from 'expo-gl';
|
|
8
8
|
import { FiberProvider, useContextBridge } from 'its-fine';
|
|
9
9
|
import { Asset } from 'expo-asset';
|
|
10
10
|
import * as fs from 'expo-file-system';
|
|
11
11
|
import { fromByteArray } from 'base64-js';
|
|
12
|
+
import { Buffer } from 'buffer';
|
|
12
13
|
import 'react-reconciler/constants';
|
|
13
14
|
import 'zustand';
|
|
14
15
|
import 'react-reconciler';
|
|
@@ -97,9 +98,9 @@ function createTouchEvents(store) {
|
|
|
97
98
|
};
|
|
98
99
|
}
|
|
99
100
|
|
|
100
|
-
/**
|
|
101
|
-
* A native canvas which accepts threejs elements as children.
|
|
102
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
101
|
+
/**
|
|
102
|
+
* A native canvas which accepts threejs elements as children.
|
|
103
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
103
104
|
*/
|
|
104
105
|
const CanvasImpl = /*#__PURE__*/React.forwardRef(({
|
|
105
106
|
children,
|
|
@@ -246,9 +247,9 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(({
|
|
|
246
247
|
}));
|
|
247
248
|
});
|
|
248
249
|
|
|
249
|
-
/**
|
|
250
|
-
* A native canvas which accepts threejs elements as children.
|
|
251
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
250
|
+
/**
|
|
251
|
+
* A native canvas which accepts threejs elements as children.
|
|
252
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
252
253
|
*/
|
|
253
254
|
const Canvas = /*#__PURE__*/React.forwardRef(function CanvasWrapper(props, ref) {
|
|
254
255
|
return /*#__PURE__*/React.createElement(FiberProvider, null, /*#__PURE__*/React.createElement(CanvasImpl, _extends({}, props, {
|
|
@@ -266,54 +267,52 @@ function polyfills() {
|
|
|
266
267
|
}
|
|
267
268
|
|
|
268
269
|
// Patch Blob for ArrayBuffer if unsupported
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
};
|
|
311
|
-
}
|
|
270
|
+
try {
|
|
271
|
+
new Blob([new ArrayBuffer(4)]);
|
|
272
|
+
} catch (_) {
|
|
273
|
+
const BlobManager = require('react-native/Libraries/Blob/BlobManager.js');
|
|
274
|
+
BlobManager.createFromParts = function createFromParts(parts, options) {
|
|
275
|
+
const blobId = uuidv4();
|
|
276
|
+
const items = parts.map(part => {
|
|
277
|
+
if (part instanceof ArrayBuffer || ArrayBuffer.isView(part)) {
|
|
278
|
+
const data = fromByteArray(new Uint8Array(part));
|
|
279
|
+
return {
|
|
280
|
+
data,
|
|
281
|
+
type: 'string'
|
|
282
|
+
};
|
|
283
|
+
} else if (part instanceof Blob) {
|
|
284
|
+
return {
|
|
285
|
+
data: part.data,
|
|
286
|
+
type: 'blob'
|
|
287
|
+
};
|
|
288
|
+
} else {
|
|
289
|
+
return {
|
|
290
|
+
data: String(part),
|
|
291
|
+
type: 'string'
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
const size = items.reduce((acc, curr) => {
|
|
296
|
+
if (curr.type === 'string') {
|
|
297
|
+
return acc + global.unescape(encodeURI(curr.data)).length;
|
|
298
|
+
} else {
|
|
299
|
+
return acc + curr.data.size;
|
|
300
|
+
}
|
|
301
|
+
}, 0);
|
|
302
|
+
NativeModules.BlobModule.createFromParts(items, blobId);
|
|
303
|
+
return BlobManager.createFromOptions({
|
|
304
|
+
blobId,
|
|
305
|
+
offset: 0,
|
|
306
|
+
size,
|
|
307
|
+
type: options ? options.type : '',
|
|
308
|
+
lastModified: options ? options.lastModified : Date.now()
|
|
309
|
+
});
|
|
310
|
+
};
|
|
312
311
|
}
|
|
313
312
|
async function getAsset(input) {
|
|
314
313
|
if (typeof input === 'string') {
|
|
315
|
-
// Don't process storage
|
|
316
|
-
if (input.startsWith('file:')
|
|
314
|
+
// Don't process storage
|
|
315
|
+
if (input.startsWith('file:')) return input;
|
|
317
316
|
|
|
318
317
|
// Unpack Blobs from react-native BlobManager
|
|
319
318
|
if (input.startsWith('blob:')) {
|
|
@@ -331,7 +330,18 @@ function polyfills() {
|
|
|
331
330
|
reader.onerror = rej;
|
|
332
331
|
reader.readAsText(blob);
|
|
333
332
|
});
|
|
334
|
-
|
|
333
|
+
input = `data:${blob.type};base64,${data}`;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// Create safe URI for JSI
|
|
337
|
+
if (input.startsWith('data:')) {
|
|
338
|
+
const [header, data] = input.split(',');
|
|
339
|
+
const [, type] = header.split('/');
|
|
340
|
+
const uri = fs.cacheDirectory + uuidv4() + `.${type}`;
|
|
341
|
+
await fs.writeAsStringAsync(uri, data, {
|
|
342
|
+
encoding: fs.EncodingType.Base64
|
|
343
|
+
});
|
|
344
|
+
return uri;
|
|
335
345
|
}
|
|
336
346
|
}
|
|
337
347
|
|
|
@@ -357,18 +367,10 @@ function polyfills() {
|
|
|
357
367
|
|
|
358
368
|
// There's no Image in native, so create a data texture instead
|
|
359
369
|
THREE.TextureLoader.prototype.load = function load(url, onLoad, onProgress, onError) {
|
|
360
|
-
if (this.path) url = this.path + url;
|
|
370
|
+
if (this.path && typeof url === 'string') url = this.path + url;
|
|
371
|
+
this.manager.itemStart(url);
|
|
361
372
|
const texture = new THREE.Texture();
|
|
362
373
|
getAsset(url).then(async uri => {
|
|
363
|
-
// Create safe URI for JSI
|
|
364
|
-
if (uri.startsWith('data:')) {
|
|
365
|
-
const [header, data] = uri.split(',');
|
|
366
|
-
const [, type] = header.split('/');
|
|
367
|
-
uri = fs.cacheDirectory + uuidv4() + `.${type}`;
|
|
368
|
-
await fs.writeAsStringAsync(uri, data, {
|
|
369
|
-
encoding: fs.EncodingType.Base64
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
374
|
const {
|
|
373
375
|
width,
|
|
374
376
|
height
|
|
@@ -391,58 +393,34 @@ function polyfills() {
|
|
|
391
393
|
// @ts-ignore
|
|
392
394
|
texture.isDataTexture = true;
|
|
393
395
|
onLoad == null ? void 0 : onLoad(texture);
|
|
394
|
-
}).catch(
|
|
396
|
+
}).catch(error => {
|
|
397
|
+
onError == null ? void 0 : onError(error);
|
|
398
|
+
this.manager.itemError(url);
|
|
399
|
+
}).finally(() => {
|
|
400
|
+
this.manager.itemEnd(url);
|
|
401
|
+
});
|
|
395
402
|
return texture;
|
|
396
403
|
};
|
|
397
404
|
|
|
398
405
|
// Fetches assets via XMLHttpRequest
|
|
399
406
|
THREE.FileLoader.prototype.load = function load(url, onLoad, onProgress, onError) {
|
|
400
|
-
if (this.path) url = this.path + url;
|
|
401
|
-
|
|
407
|
+
if (this.path && typeof url === 'string') url = this.path + url;
|
|
408
|
+
this.manager.itemStart(url);
|
|
402
409
|
getAsset(url).then(async uri => {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
this.manager.itemEnd(url);
|
|
415
|
-
} else {
|
|
416
|
-
onError == null ? void 0 : onError(event);
|
|
417
|
-
this.manager.itemError(url);
|
|
418
|
-
this.manager.itemEnd(url);
|
|
419
|
-
}
|
|
420
|
-
}, false);
|
|
421
|
-
request.addEventListener('progress', event => {
|
|
422
|
-
onProgress == null ? void 0 : onProgress(event);
|
|
423
|
-
}, false);
|
|
424
|
-
request.addEventListener('error', event => {
|
|
425
|
-
onError == null ? void 0 : onError(event);
|
|
426
|
-
this.manager.itemError(url);
|
|
427
|
-
this.manager.itemEnd(url);
|
|
428
|
-
}, false);
|
|
429
|
-
request.addEventListener('abort', event => {
|
|
430
|
-
onError == null ? void 0 : onError(event);
|
|
431
|
-
this.manager.itemError(url);
|
|
432
|
-
this.manager.itemEnd(url);
|
|
433
|
-
}, false);
|
|
434
|
-
if (this.responseType) request.responseType = this.responseType;
|
|
435
|
-
if (this.withCredentials) request.withCredentials = this.withCredentials;
|
|
436
|
-
for (const header in this.requestHeader) {
|
|
437
|
-
request.setRequestHeader(header, this.requestHeader[header]);
|
|
438
|
-
}
|
|
439
|
-
request.send(null);
|
|
440
|
-
this.manager.itemStart(url);
|
|
441
|
-
}).catch(onError);
|
|
442
|
-
return request;
|
|
410
|
+
const base64 = await fs.readAsStringAsync(uri, {
|
|
411
|
+
encoding: fs.EncodingType.Base64
|
|
412
|
+
});
|
|
413
|
+
const data = Buffer.from(base64, 'base64');
|
|
414
|
+
onLoad == null ? void 0 : onLoad(data.buffer);
|
|
415
|
+
}).catch(error => {
|
|
416
|
+
onError == null ? void 0 : onError(error);
|
|
417
|
+
this.manager.itemError(url);
|
|
418
|
+
}).finally(() => {
|
|
419
|
+
this.manager.itemEnd(url);
|
|
420
|
+
});
|
|
443
421
|
};
|
|
444
422
|
}
|
|
445
423
|
|
|
446
|
-
polyfills();
|
|
424
|
+
if (Platform.OS !== 'web') polyfills();
|
|
447
425
|
|
|
448
426
|
export { Canvas, createTouchEvents as events };
|
package/native/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
{
|
|
2
|
-
"main": "dist/react-three-fiber-native.cjs.js",
|
|
3
|
-
"module": "dist/react-three-fiber-native.esm.js",
|
|
4
|
-
"types": "dist/react-three-fiber-native.cjs.d.ts"
|
|
5
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"main": "dist/react-three-fiber-native.cjs.js",
|
|
3
|
+
"module": "dist/react-three-fiber-native.esm.js",
|
|
4
|
+
"types": "dist/react-three-fiber-native.cjs.d.ts"
|
|
5
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-three/fiber",
|
|
3
|
-
"version": "8.14.
|
|
3
|
+
"version": "8.14.7",
|
|
4
4
|
"description": "A React renderer for Threejs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"@babel/runtime": "^7.17.8",
|
|
46
46
|
"@types/react-reconciler": "^0.26.7",
|
|
47
47
|
"base64-js": "^1.5.1",
|
|
48
|
+
"buffer": "^6.0.3",
|
|
48
49
|
"its-fine": "^1.0.6",
|
|
49
50
|
"react-reconciler": "^0.27.0",
|
|
50
51
|
"react-use-measure": "^2.1.1",
|