Skip to content

Commit

Permalink
[#15] v2.21.0-alpha.8: Android: Patches pickFile() for cancelled sele…
Browse files Browse the repository at this point in the history
…ction
  • Loading branch information
birdofpreyru committed Oct 13, 2023
1 parent 9d5f81f commit a55ad0e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private ActivityResultLauncher<String[]> getPickFileLauncher() {
@Override
public void onActivityResult(Uri uri) {
WritableArray res = Arguments.createArray();
res.pushString(uri.toString());
if (uri != null) res.pushString(uri.toString());
pendingPickFilePromises.pop().resolve(res);
}
}
Expand Down
8 changes: 5 additions & 3 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ export default function App() {
<Button
onPress={async () => {
const res = await pickFile();
Alert.alert('Picked files', res.join('; '));
Alert.alert(`Picked ${res.length} file(s)`, res.join('; '));

const begin = await read(res[0]!, 10);
Alert.alert('First file starts with', begin);
for (let i = 0; i < res.length; ++i) {
const begin = await read(res[0]!, 10);
Alert.alert(`File #{i + 1} starts with`, begin);
}
}}
title="pickFile()"
/>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dr.pogodin/react-native-fs",
"version": "2.21.0-alpha.7",
"version": "2.21.0-alpha.8",
"description": "Native filesystem access for react-native",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down

0 comments on commit a55ad0e

Please sign in to comment.