How large is AsyncStorage in React Native?

前端 未结 4 1254
闹比i
闹比i 2020-12-29 05:04

The documentation says it should be used instead of LocalStorage, but it doesn\'t list anything regarding how large it is. If I recall, LocalStorage in web browsers is only

4条回答
  •  一个人的身影
    2020-12-29 05:39

    This is an old answer, the new method is mentioned in justin answer above..


    As mentioned here, to increase the 6mb limit on Android.. try this:

    in MainApplication.java add these lines in onCreate function

      public void onCreate() {
        // ...
        long size = 50L * 1024L * 1024L; // 50 MB
        com.facebook.react.modules.storage.ReactDatabaseSupplier.getInstance(getApplicationContext()).setMaximumSize(size);
      }
    

提交回复
热议问题