Comments (15)
你创建一个js文件,可以,没问题,——然而它什么时候执行呢,以及甚至它到底执行过没??
你要在某个必定会执行的文件(比如index.ios.js)中import这个文件(因为这个文件只需执行不需引入任何模块,直接import '路径/文件名' 即可,不需要from)才能保证这个文件不是一个孤立的没运行的文件啊
而且还得保证import的顺序,即必须在其他使用storage的组件之前import
from react-native-storage.
@meijingkang
1、请另开issue
2、报错里说明了,文档里也注明了,sync文件是你自己写的!
from react-native-storage.
你好。请问下 有react-native-storage Demo吗?初学者 求一份 急 跟着git上介绍来 写下来是错误的 希望求一份demo 先谢谢了。
from react-native-storage.
没有版本要求。不需要import。
但注意语句有执行顺序,必须先声明,而后才能使用。
如果声明在使用之后,必然会报错找不到。
from react-native-storage.
我是直接创建一个js文件,内容如下,然后在其它js文件中直接使用storage,这样有问题吗?该怎样使用?
@sunnylqm
import Storage from 'react-native-storage';
var storage = new Storage({
size: 1000,
defaultExpires: null,
enableCache: true,
})
global.storage = storage;
from react-native-storage.
@mxkedr 文档里就是demo直接可运行啊,具体有什么错自己开个issue贴出来啊。
from react-native-storage.
怎么申明,import storage from './app/utils/RTStorage'; 在入口 报错
from react-native-storage.
@Rcrosp 具体有什么错自己开个issue贴出来
from react-native-storage.
你好,问下 如果使用key id 方式存储数据, id 可以实现自增长吗?还是每次增加一条都需要自己设定id的值呢?
from react-native-storage.
@XIAOYAYAYAYA 看不懂什么叫自己另外开个issue吗? 没有自增长,这不是数据库。
from react-native-storage.
@sunnylqm
我按照你说的去做还是不行
from react-native-storage.
@meijingkang 你的问题解决了么
from react-native-storage.
@phonebird 你这样创建一个js文件声明的这个storage,在其他文件中怎么拿到这个storage
from react-native-storage.
就是说 在index.js里
import './xx/Storage.js'
在使用的地方
storage.setItem()...
from react-native-storage.
@sunnylqm 在class中使用有效,外部会报错,请问大佬啥情况
from react-native-storage.
Related Issues (20)
- 怎么获取到最新的值 HOT 10
- syncInBackground: false seems to not work and always leave data undefined HOT 4
- Request - Publish 1.0.1 HOT 2
- 如何同步获取数据? HOT 4
- RN warning when calling getAllDataForKey with many keys
- @react-native-community/async-storage could not be found within the project. HOT 3
- Will I lost data on expire time change? HOT 2
- Please do not use "_" in key!"data" is required in save()!
- "data" is required in save() HOT 3
- 怎么才能取出异步存的值,然后把它给header呢 HOT 18
- ERROR: The modules ['@react-native-community_async-storage', 'react-native-community_async-storage'] point to the same directory in the file system. Each module must have a unique path. HOT 2
- How can I get list of all keys?
- Bundle size doubled in 1.0.1? HOT 1
- database or disk is full HOT 1
- Vulnerabilities during npm install
- Update peer dependencies
- Unhandled JS Exception: [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null. HOT 1
- How to Ignore expiry HOT 6
- I have a issue when i run on iPhone HOT 2
- 有时获取不到刚存的数据 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-storage.