Menu

1 / 3

Photo uploads that survive airplane mode: offline uploads in React Native

DEV Community: reactnative·Praveen Singh·10 days ago
#FqsgTxUF
#devtoreactnative#devto#dev#upload#write
Long article (2435 words) — no AI summary yet.
Reading 0:00
15s threshold

Short answer: In Bareship 0.5, a photo upload is a queued write like a like is: it waits offline, survives the app being killed, waits again if the connection drops halfway, and retries with one idempotency key so the server stores the photo once. The photo comes from the system picker (no permission), is resized on the phone, and is kept in the app's documents folder under an id, not a path. pnpm gen upload writes all of it for a new screen. Testing it on a phone found a bug in the queue itself: writes saved offline could be dropped at the next launch.

This is Part 5 of Building Bareship. Part 2 built the offline write queue

with a like as the example. A like is a few bytes and an id. A photo is a file of several megabytes that has to

still exist when the app opens tomorrow. That's where offline support usually breaks in real apps, so it's what

0.5 is about.

What can go wrong with one photo

Someone on a train takes a photo for a post and taps Post.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.