Skip to content

Commit dc7d09c

Browse files
committed
fix: expo media library exceptions in new arch
1 parent 6201f33 commit dc7d09c

File tree

3 files changed

+34
-10
lines changed

3 files changed

+34
-10
lines changed

examples/ExpoMessaging/app.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@
4545
{
4646
"microphonePermission": "$(PRODUCT_NAME) would like to use your microphone for voice recording."
4747
}
48+
],
49+
[
50+
"expo-build-properties",
51+
{
52+
"android": {
53+
"newArchEnabled": true
54+
},
55+
"ios": {
56+
"newArchEnabled": true
57+
}
58+
}
4859
]
4960
]
5061
}

examples/ExpoMessaging/yarn.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,6 +1835,14 @@
18351835
"@gorhom/portal" "1.0.14"
18361836
invariant "^2.2.4"
18371837

1838+
"@gorhom/bottom-sheet@^5.0.6":
1839+
version "5.0.6"
1840+
resolved "https://registry.yarnpkg.com/@gorhom/bottom-sheet/-/bottom-sheet-5.0.6.tgz#f20736502399c7bcf8c73ea09e6b571dc07fe0eb"
1841+
integrity sha512-SI/AhPvgRfnCWN6/+wbE6TXwRE4X8F2fLyE4L/0bRwgE34Zenq585qLT139uEcfCIyovC2swC3ICqQpkmWEcFA==
1842+
dependencies:
1843+
"@gorhom/portal" "1.0.14"
1844+
invariant "^2.2.4"
1845+
18381846
18391847
version "1.0.14"
18401848
resolved "https://registry.yarnpkg.com/@gorhom/portal/-/portal-1.0.14.tgz#1953edb76aaba80fb24021dc774550194a18e111"

package/expo-package/src/optionalDependencies/getPhotos.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,21 @@ export const getPhotos = MediaLibrary
4040
mediaType: [MediaLibrary.MediaType.photo, MediaLibrary.MediaType.video],
4141
sortBy: [MediaLibrary.SortBy.modificationTime],
4242
});
43-
const assets = results.assets.map((asset) => ({
44-
duration: asset.duration * 1000,
45-
height: asset.height,
46-
id: asset.id,
47-
name: asset.filename,
48-
source: 'picker' as const,
49-
type: asset.mediaType,
50-
uri: asset.uri,
51-
width: asset.width,
52-
}));
43+
const assets = await Promise.all(
44+
results.assets.map(async (asset) => {
45+
const assetInfo = await MediaLibrary.getAssetInfoAsync(asset);
46+
return {
47+
duration: asset.duration * 1000,
48+
height: asset.height,
49+
id: asset.id,
50+
name: asset.filename,
51+
source: 'picker' as const,
52+
type: asset.mediaType,
53+
uri: assetInfo.localUri,
54+
width: asset.width,
55+
};
56+
}),
57+
);
5358

5459
const hasNextPage = results.hasNextPage;
5560
const endCursor = results.endCursor;

0 commit comments

Comments
 (0)