INNER CODE UNIT · JavaScript
_itemChanged
fullstackreact/react-native-firestack · lib/firestackModule.js:103
const _itemChanged = (snapshot, prevKey) => {
const state = this._getState()
const existingItem = toObject(snapshot, state);
let list = state.items;
let listIds = state.items.map(i => i._key);
const itemIdx = listIds.indexOf(existingItem._key);
list.splice(itemIdx, 1, existingItem);
return this._handleUpdate(T.ITEM_CHANGED, {items: list}, cb);
}
return new Promise((resolve, reject) => {
listenRef.on('child_added', _itemAdded);
listenRef.on('child_removed', _itemRemoved);
listenRef.on('child_changed', _itemChanged);
this._handleUpdate(T.ACTION_LISTEN, null, (state) => {