Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.4.0",
"expo-asset": "^8.6.0",
"expo-file-system": "^15.4.3",
"expo-asset": "^12.0.9",
"expo-file-system": "^19.0.17",
"expo-gl": "^11.4.0",
"husky": "^7.0.4",
"jest": "^29.7.0",
Expand Down
13 changes: 8 additions & 5 deletions packages/fiber/__mocks__/expo-file-system.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export const EncodingType = { UTF8: 'utf8', Base64: 'base64' }
export const cacheDirectory = 'file:///test/'
export const readAsStringAsync = async () => ''
export const writeAsStringAsync = async () => {}
export const copyAsync = async () => {}
export const Paths = { cache: { uri: 'file:///test/' } }
export class File {
async write(data: string) {}
async base64() {
return ''
}
async copy(to: File) {}
}
10 changes: 5 additions & 5 deletions packages/fiber/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@
"zustand": "^5.0.3"
},
"peerDependencies": {
"expo": ">=43.0",
"expo-asset": ">=8.4",
"expo-file-system": ">=11.0",
"expo-gl": ">=11.0",
"expo": ">=54.0",
"expo-asset": ">=12.0",
"expo-file-system": ">=19.0",
"expo-gl": ">=16.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-native": ">=0.78",
"react-native": ">=0.81",
"three": ">=0.156"
},
"peerDependenciesMeta": {
Expand Down
10 changes: 5 additions & 5 deletions packages/fiber/src/native/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ async function getAsset(input: string | number): Promise<string> {
const [header, data] = input.split(';base64,')
const [, type] = header.split('/')

const uri = fs.cacheDirectory + uuidv4() + `.${type}`
await fs.writeAsStringAsync(uri, data, { encoding: fs.EncodingType.Base64 })
const uri = fs.Paths.cache.uri + uuidv4() + `.${type}`
await new fs.File(uri).write(data, { encoding: 'base64' })

return uri
}
Expand All @@ -59,8 +59,8 @@ async function getAsset(input: string | number): Promise<string> {

// Unpack assets in Android Release Mode
if (!uri.includes(':')) {
const file = `${fs.cacheDirectory}ExponentAsset-${asset.hash}.${asset.type}`
await fs.copyAsync({ from: uri, to: file })
const file = `${fs.Paths.cache.uri}ExponentAsset-${asset.hash}.${asset.type}`
await new fs.File(uri).copy(new fs.File(file))
uri = file
}

Expand Down Expand Up @@ -160,7 +160,7 @@ export function polyfills() {

getAsset(url)
.then(async (uri) => {
const base64 = await fs.readAsStringAsync(uri, { encoding: fs.EncodingType.Base64 })
const base64 = await new fs.File(uri).base64()
const data = Buffer.from(base64, 'base64')
onLoad?.(data.buffer)
})
Expand Down
Loading