Skip to content

Commit de1f7f1

Browse files
committed
fix(polyfills): conditionally import expo-file-system/legacy to support Expo 54
1 parent 9ca5264 commit de1f7f1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/fiber/src/native/polyfills.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
import * as THREE from 'three'
22
import { Image, NativeModules, Platform } from 'react-native'
33
import { Asset } from 'expo-asset'
4-
import * as fs from 'expo-file-system'
54
import { fromByteArray } from 'base64-js'
65
import { Buffer } from 'buffer'
76

7+
// Conditionally import expo-file-system/legacy to support Expo 54
8+
const getFileSystem = () => {
9+
try {
10+
return require('expo-file-system/legacy')
11+
} catch {
12+
return require('expo-file-system')
13+
}
14+
}
15+
const fs = getFileSystem()
16+
817
// http://stackoverflow.com/questions/105034
918
function uuidv4() {
1019
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {

0 commit comments

Comments
 (0)