Update example apps with new schema API

This commit is contained in:
Scott Kyle 2015-11-02 23:05:06 -08:00
parent 15052985f1
commit 09752846e5
2 changed files with 10 additions and 10 deletions

View File

@ -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: []},
},
},
],
});

View File

@ -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);