Giter Site home page Giter Site logo

Comments (15)

sunnylqm avatar sunnylqm commented on May 19, 2024 24

你创建一个js文件,可以,没问题,——然而它什么时候执行呢,以及甚至它到底执行过没??
你要在某个必定会执行的文件(比如index.ios.js)中import这个文件(因为这个文件只需执行不需引入任何模块,直接import '路径/文件名' 即可,不需要from)才能保证这个文件不是一个孤立的没运行的文件啊
而且还得保证import的顺序,即必须在其他使用storage的组件之前import

from react-native-storage.

sunnylqm avatar sunnylqm commented on May 19, 2024 7

@meijingkang
1、请另开issue
2、报错里说明了,文档里也注明了,sync文件是你自己写的!

from react-native-storage.

mxkedr avatar mxkedr commented on May 19, 2024 4

你好。请问下 有react-native-storage Demo吗?初学者 求一份 急 跟着git上介绍来 写下来是错误的 希望求一份demo 先谢谢了。

from react-native-storage.

sunnylqm avatar sunnylqm commented on May 19, 2024

没有版本要求。不需要import。
但注意语句有执行顺序,必须先声明,而后才能使用。
如果声明在使用之后,必然会报错找不到。

from react-native-storage.

phonebird avatar phonebird commented on May 19, 2024

我是直接创建一个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.

sunnylqm avatar sunnylqm commented on May 19, 2024

@mxkedr 文档里就是demo直接可运行啊,具体有什么错自己开个issue贴出来啊。

from react-native-storage.

Rcrosp avatar Rcrosp commented on May 19, 2024

怎么申明,import storage from './app/utils/RTStorage'; 在入口 报错

from react-native-storage.

sunnylqm avatar sunnylqm commented on May 19, 2024

@Rcrosp 具体有什么错自己开个issue贴出来

from react-native-storage.

XIAOYAYAYAYA avatar XIAOYAYAYAYA commented on May 19, 2024

你好,问下 如果使用key id 方式存储数据, id 可以实现自增长吗?还是每次增加一条都需要自己设定id的值呢?

from react-native-storage.

sunnylqm avatar sunnylqm commented on May 19, 2024

@XIAOYAYAYAYA 看不懂什么叫自己另外开个issue吗? 没有自增长,这不是数据库。

from react-native-storage.

meijingkang avatar meijingkang commented on May 19, 2024

@sunnylqm
qq 20170721180714
我按照你说的去做还是不行

from react-native-storage.

WhoJave avatar WhoJave commented on May 19, 2024

@meijingkang 你的问题解决了么

from react-native-storage.

caozhepeng avatar caozhepeng commented on May 19, 2024

@phonebird 你这样创建一个js文件声明的这个storage,在其他文件中怎么拿到这个storage

from react-native-storage.

lizhuoyuan avatar lizhuoyuan commented on May 19, 2024

就是说 在index.js里
import './xx/Storage.js'

在使用的地方
storage.setItem()...

from react-native-storage.

291410392 avatar 291410392 commented on May 19, 2024

@sunnylqm 在class中使用有效,外部会报错,请问大佬啥情况

from react-native-storage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.