Skip to content

Commit

Permalink
[native-component-list][android] Fix saving videos to gallery in Came…
Browse files Browse the repository at this point in the history
…raScreen (expo#25800)

# Why

It wasn't possible to save videos to gallery when using `expo-camera`
example in `ncl`

# How

The file was saved with incorrect extension. Updated the code to use
correct file type.

# Test Plan

- ✅ native-component-list in unversioned expo-go, android 13
- ✅ native-component-list in unversioned expo-go, iOS 17
  • Loading branch information
behenate authored Dec 12, 2023
1 parent c11e6b4 commit a50d46f
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,11 @@ export default class CameraScreen extends React.Component<object, State> {
takeVideo = async () => {
const result = await this.recordVideo();
if (result?.uri) {
const splitUri = result.uri.split('.');
const extension = splitUri[splitUri.length - 1];
await FileSystem.moveAsync({
from: result.uri,
to: `${FileSystem.documentDirectory}photos/${Date.now()}.${result.uri.split('.')[1]}`,
to: `${FileSystem.documentDirectory}photos/${Date.now()}.${extension}`,
});
}
};
Expand Down

0 comments on commit a50d46f

Please sign in to comment.