小编DAS*_*ASH的帖子

React Native Async Await in react-native-sqlite-storage

我对React本地人不熟悉.在启动之前我已经完成了很多教程.我正在尝试在我的应用程序中创建商店,可以在需要时通过应用程序的屏幕访问.

这是我的文件结构.

  1. index.ios.js
  2. /app/index.js
  3. /app/store/database.js
  4. /app/store/userStore.js

index.ios.js

import { AppRegistry } from 'react-native';
import App from './app/index';
AppRegistry.registerComponent('AwesomeProject', () => App);
Run Code Online (Sandbox Code Playgroud)

/app/index.js

import React, { Component} from 'react';
import {
  Text,
  View,
} from 'react-native';
import userStore from './store/userStore';
import ViewBackground from './components/ViewBackground';


class App extends Component {
        constructor(props){
            super(props);
            this.isLoggedIn = true;     
        }

        componentDidMount() {       
            this.fetchUsers().done();
        }

        async fetchUsers(){
            console.log('Before User Fetch');
            var result = await userStore.getAllUsers();
            console.log('After User Fetch');
        }

        render() {
            if(this.isLoggedIn){
                return this.loggedInView();
            }else{
                return this.loggedOutView(); …
Run Code Online (Sandbox Code Playgroud)

javascript sqlite ecmascript-6 reactjs react-native

5
推荐指数
1
解决办法
1945
查看次数

标签 统计

ecmascript-6 ×1

javascript ×1

react-native ×1

reactjs ×1

sqlite ×1