React native 无法从领域数据库架构获取值
我正在使用react native和realm作为DB创建一个访客管理应用程序。 为了添加访问者,我使用带有各种文本字段的PopUpDialog。 一个是Headercomponent,标题和“+”用于显示弹出窗口React native 无法从领域数据库架构获取值,react-native,realm,React Native,Realm,我正在使用react native和realm作为DB创建一个访客管理应用程序。 为了添加访问者,我使用带有各种文本字段的PopUpDialog。 一个是Headercomponent,标题和“+”用于显示弹出窗口 export const TodoSchema = { name: TODO_SCHEMA, primaryKey: 'id', properties: { id: 'int', // primary key name:
export const TodoSchema = {
name: TODO_SCHEMA,
primaryKey: 'id',
properties: {
id: 'int', // primary key
name: { type: 'string', indexed: true },
age: { type: 'string', indexed: true },
reason: { type: 'string', indexed: true },
address: { type: 'string', indexed: true },
visitorid: { type: 'string', indexed: true },
visitingperson: { type: 'string', indexed: true },
number: { type: 'string', indexed: true },
done: { type: 'bool', default: false }
}
};
export const TodoListSchema = {
name: TODOLIST_SCHEMA,
primaryKey: 'id',
properties: {
id: 'int', // primary key
name: 'string',
creationDate: 'date',
exitDate: 'date',
todos: { type: 'list', objectType: TODO_SCHEMA }
}
};
现在在主组件中,我正在尝试获取creationDate的值,它是未定义的,任何建议都是好的
MainComponent.js的代码
Imports required for components
import React, { Component } from 'react';
import { View, FlatList, Text, TouchableOpacity, StyleSheet, Alert } from 'react-native';
import { updateTodoList, deleteTodoList, queryAllTodoLists } from '../databases/allSchemas';
import realm from '../databases/allSchemas';
import Swipeout from 'react-native-swipeout';
import HeaderComponent from './HeaderComponent';
import PopupDialogComponent from './PopupDialogComponent';
let FlatListItem = props => {
const { itemIndex, id, name, creationDate, exitDate, popupDialogComponent, onPressItem } = props;
在这里,我试图从db creationdate、name、id中获取对象,并将其返回为未定义