Update example apps with new schema API
This commit is contained in:
parent
15052985f1
commit
09752846e5
|
@ -10,17 +10,17 @@ module.exports = new Realm({
|
|||
schema: [
|
||||
{
|
||||
name: 'Todo',
|
||||
properties: [
|
||||
{name: 'done', type: Realm.Types.BOOL, default: false},
|
||||
{name: 'text', type: Realm.Types.STRING, default: ''},
|
||||
]
|
||||
properties: {
|
||||
done: {type: Realm.Types.BOOL, default: false},
|
||||
text: Realm.Types.STRING,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'TodoList',
|
||||
properties: [
|
||||
{name: 'name', type: Realm.Types.STRING},
|
||||
{name: 'items', type: Realm.Types.LIST, objectType: 'Todo'},
|
||||
]
|
||||
properties: {
|
||||
name: Realm.Types.STRING,
|
||||
items: {type: Realm.Types.LIST, objectType: 'Todo', default: []},
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
|
|
@ -19,7 +19,7 @@ class TodoApp extends React.Component {
|
|||
let todoLists = realm.objects('TodoList');
|
||||
if (todoLists.length < 1) {
|
||||
realm.write(() => {
|
||||
realm.create('TodoList', {name: 'Todo List', items: []});
|
||||
realm.create('TodoList', {name: 'Todo List'});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ class TodoApp extends React.Component {
|
|||
}
|
||||
|
||||
realm.write(() => {
|
||||
realm.create('TodoList', {name: '', items: []});
|
||||
realm.create('TodoList', {name: ''});
|
||||
});
|
||||
|
||||
this._setEditingRow(items.length - 1);
|
||||
|
|
Loading…
Reference in New Issue