I have tried the sample application (React Native and Couchbase lite) that was provided in below link
When I navigate the screen between Lists and List Details continuously, following error is occurred on every 5th to 8th attempt in ListDetail> index.js on ComponentWillUnmount,
“undefined is not an object (evaluating ‘this.feed.stop’)”
` componentWillMount() {
console.log(‘ListDetail mounted’);
this.setupQueries();
manager.database.get_db({db: DB_NAME})
.then(res => {
this.feed = new Feed(res.obj.update_seq, () => {
this.setupQueries();
});
console.log(‘ListDetail mounted Feed:’+this.feed);
});
}
componentWillUnmount() {
console.log(‘ListDetail unmounted’);
console.log(‘ListDetail unmounted Feed:’+this.feed);
this.feed.stop();
}`
Log message:
Attempt 7:
ListDetail mounted
ListDetail mounted Feed:[object Object]
ListDetail unmounted
ListDetail unmounted Feed:[object Object]
Attempt : 8
ListDetail mounted
ListDetail unmounted
ListDetail unmounted Feed:undefined
undefined is not an object (evaluating ‘this.feed.stop’) <=== Error
ListDetail mounted Feed:[object Object]
Error: undefined is not an object (evaluating ‘this.feed.stop’)
From the above log it shows in componentWillMount(), Feed is initialized after some delay (say 10 sec) and if the componentWillUnmount is triggered within this time period (<10sec) the reported error appears. This delay time is not consistant. Further more i observed that if i set feed heartbeat as ‘1 min’, the delay is between 10 sec to 50 sec, and if i set heartbeat as ‘15 min’, then the delay period is very high and the screen stays blank until the feed initialized.
Also I observed the same error in my own application. The application contains drawer with two menu item and each menu item displays the List page, and the list is updated by Feed (longpoll). If i navigate between this two menu item, on every fifth attempt the list page wasn’t rendered, and on the sixth attempt observed the error "Error: undefined is not an object (evaluating ‘this.feed.stop’) ", as a result i couldn’t proceed using Couchbaselite with Reactnative.
Any suggestions to overcome this issue.