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: [
|
schema: [
|
||||||
{
|
{
|
||||||
name: 'Todo',
|
name: 'Todo',
|
||||||
properties: [
|
properties: {
|
||||||
{name: 'done', type: Realm.Types.BOOL, default: false},
|
done: {type: Realm.Types.BOOL, default: false},
|
||||||
{name: 'text', type: Realm.Types.STRING, default: ''},
|
text: Realm.Types.STRING,
|
||||||
]
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'TodoList',
|
name: 'TodoList',
|
||||||
properties: [
|
properties: {
|
||||||
{name: 'name', type: Realm.Types.STRING},
|
name: Realm.Types.STRING,
|
||||||
{name: 'items', type: Realm.Types.LIST, objectType: 'Todo'},
|
items: {type: Realm.Types.LIST, objectType: 'Todo', default: []},
|
||||||
]
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,7 +19,7 @@ class TodoApp extends React.Component {
|
||||||
let todoLists = realm.objects('TodoList');
|
let todoLists = realm.objects('TodoList');
|
||||||
if (todoLists.length < 1) {
|
if (todoLists.length < 1) {
|
||||||
realm.write(() => {
|
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.write(() => {
|
||||||
realm.create('TodoList', {name: '', items: []});
|
realm.create('TodoList', {name: ''});
|
||||||
});
|
});
|
||||||
|
|
||||||
this._setEditingRow(items.length - 1);
|
this._setEditingRow(items.length - 1);
|
||||||
|
|
Loading…
Reference in New Issue