Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document AsyncStorage size on iOS and Android #11656

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Libraries/Storage/AsyncStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@ var RCTAsyncStorage = RCTAsyncRocksDBStorage || RCTAsyncSQLiteStorage || RCTAsyn
* `AsyncStorage` will use either [RocksDB](http://rocksdb.org/) or SQLite
* based on what is available.
*
* iOS doesn't have any storage limits, but on Android the database is limited to
* 6 MB by default. To change the limit, you can modify the `getPackages()` method
* in your your project's `MainApplication.java`:
* ```
* // add the following import
* import com.facebook.react.modules.storage.ReactDatabaseSupplier;
*
* // modify `getPackages()` method
* @Override
* protected List<ReactPackage> getPackages() {
* // Increase the maximum size of AsyncStorage
* long size = 100 * 1024L * 1024L; // 100 MB
* ReactDatabaseSupplier.getInstance(getApplicationContext()).setMaximumSize(size);
*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no-trailing-spaces: Trailing spaces not allowed.

* // ...rest of code in `getPackages()`
* }
* ```
*
* The `AsyncStorage` JavaScript code is a simple facade that provides a clear
* JavaScript API, real `Error` objects, and simple non-multi functions. Each
* method in the API returns a `Promise` object.
Expand Down