Open sarawieckowska opened 6 years ago
Hi @sarawieckowska, I have tested this case with our sample project, however, I was unable to recreate such an issue. Can you provide a sample project, which can be used for debugging?
Hi @tsonevn, I've managed to recreate a sample project in the Playground, please find it here https://play.nativescript.org/?template=play-ng&id=VRZiHM&v=2
Hi @sarawieckowska, This problem seems to be related to using an ObservableArray while loading the data from the promise. I will mark this as a bug. Meanwhile, try replacing the ObservableArray with the core JavaScript Array. For example:
this.dept.autoCompleteTextView.loadSuggestionsAsync = (text: string) =>
new Promise((resolve, reject) => {
this.queryService.getResults(text).subscribe((searchResults: any) => {
this._myResults = searchResults;
const myResults = new Array<TokenWithId>();
this._myResults.forEach((elem) => {
myResults.push(new TokenWithId(elem.name, null, elem.id));
});
resolve(myResults);
});
});
Hi @tsonevn, Of course. Thank you for your help, meanwhile I'll replace the ObservableArray.
+1
Any news on resolving this? Switching from ObservableArrays just causes the following error for me:
System.err: Calling js method onCreateViewHolder failed
System.err:
System.err: Error: Expecting a valid View instance.
Please, provide the details below:
when trying to load data asynchronically, the app works and suggestions load into sugestionview, but first and the second requests throw this error into my console
The app doesn't crash, but this is not looking good and can lead to crashes in the future.
Did you verify this is a real problem by searching the NativeScript Forum?
Yes
Which platform(s) does your issue occur on?
Android
Please provide the following version numbers that your issue occurs with:
nativescript-ui-autocomplete: ^3.9.0
Please tell us how to recreate the issue in as much detail as possible.
Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.
(You can paste entire code snippets or attach a runnable project)