We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 88d4c9e commit 9f27041Copy full SHA for 9f27041
src/collectionview/index.ios.ts
@@ -222,8 +222,18 @@ export class CollectionView extends CollectionViewBase {
222
public getViewForItemAtIndex(index: number): View {
223
let result: View;
224
if (this.nativeViewProtected) {
225
+ // when the collectionview is not loaded anymore, cellForItemAtIndexPath wont return
226
+ // then we use our cached map to get the view
227
const cell = this.nativeViewProtected.cellForItemAtIndexPath(NSIndexPath.indexPathForRowInSection(index, 0)) as CollectionViewCell;
- return cell?.view;
228
+ if (cell) {
229
+ return cell?.view;
230
+ } else {
231
+ for (const [cell, view] of this._map) {
232
+ if (cell.currentIndex === index) {
233
+ return view;
234
+ }
235
236
237
}
238
239
return result;
0 commit comments