Skip to content

Instantly share code, notes, and snippets.

View jarredkenny's full-sized avatar
👋

Jarred Kenny jarredkenny

👋
View GitHub Profile
@bureyburey
bureyburey / split-async-storage
Last active May 9, 2024 15:24
SplitAsyncStorage
/**
* custom wrapper for AsyncStorage that splits the data of a given storageKey to smaller chunks
* a large object with multiple keys will be spreaded to all the keys in the first level of the main object
* { data: { key1: value1, key2: value2, ...} }
* will be saved as key1 => value1, key2 => value2, ...
* this approach is intended to prevent the limitation of 2MB per value of AsyncStorage by spreading the values across the storage
*
* basic usage:
*
* import AsyncStorage from '@react-native-community/async-storage';