Repository navigation
[Android] keepLocalCopy hangs after app restart and never resolves #907
Copy link
Copy link
Closed
Description
I have searched open and closed issues for this issue.
- I have searched open and closed issues.
I have read and understood the license (link below).
- I have read and understood the license.
Minimal reproducible example
const [copyResult] = await DocumentPicker.keepLocalCopy({ files: [ { uri: img.uri, fileName: img.name ?? 'image', }, ], destination: 'documentDirectory', });
What platform(s) does this occur on?
Android
Did you reproduce on a real device or emulator / simulator?
real device
Steps to reproduce
When the app is initially installed or launched, the functionality works as expected, users can select images, and they are successfully copied locally. However, after the app is fully terminated (removed from memory) and then reopened, the keepLocalCopy function becomes unresponsive: it hangs indefinitely and neither resolves nor throws any error or exception.
const newImages = await DocumentPicker.pick({
type: [DocumentPicker.types.images],
allowMultiSelection: true,
mode: 'import',
allowVirtualFiles: true,
});
if (newImages && newImages.length > 0) {
let localURIs: string[] = [];
for (const img of newImages) {
// Hangs here forever after app is reopened
const [copyResult] = await DocumentPicker.keepLocalCopy({
files: [
{
uri: img.uri,
fileName: img.name ?? 'image',
},
],
destination: 'documentDirectory',
});
if (copyResult.status === 'success') {
localURIs.push(copyResult.localUri);
}
}
}If the issue is related to specific file(s), I have linked the files so that others can reproduce exactly what I see.
- I have attached files necessary to reproduce the problem (if applicable).
Stacktrace of the crash (if applicable)
NoneYour computer environment
System:
OS: Linux 6.12
CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz
Memory: 30.04 GB / 62.44 GB
Shell:
version: 5.2.37
path: xxx/bin/bash
Binaries:
Node:
version: 24.3.0
path: xxx/bin/node
Yarn:
version: 4.12.0
path: /usr/bin/yarn
npm:
version: 11.4.2
path: xxx/bin/npm
Watchman:
version: 2025.04.21.00
path: /usr/bin/watchman
SDKs:
Android SDK:
API Levels:
- "35"
- "36"
Build Tools:
- 35.0.0
- 36.0.0
Android NDK: 27.1.12297006
IDEs:
Android Studio: Not Found
Languages:
Java:
version: 17.0.15
path: /usr/bin/javac
Ruby: Not Found
npmPackages:
"@react-native-community/cli":
installed: 17.0.0
wanted: ^17.0.0
react:
installed: 19.1.0
wanted: 19.1.0
react-native:
installed: 0.81.5
wanted: 0.81.5
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
vonovak commentedon Jan 1, 2026
hello, what was the issue @CatLover01?
CatLover01 commentedon Jan 2, 2026
I’m still not 100% sure what the root cause is yet. I made a minimal reproducible repo, and from what I can tell this doesn’t look like a bug in the picker itself, but something specific to my setup.
What I’m observing is that for one particular tab, the component renders twice for some reason. That double render could explain why it appears to hang in my case.
The issue started when I switched from
mode: 'open'with long-term access to this:So now the files are copied instead of using long-term access. Internally this behaves quite differently, which might also be contributing to the issue.
At this point it looks like an interaction between my component lifecycle and the picker configuration rather than a picker bug, but I’m still investigating.
Edit: This hangs is also present for the pick, keepLocalCopy and pickDirectory(sometimes)... sounds like some multi-threading bug..
The
chore/android-updatesbranch also has that bug