Skip to content

Commit 899306b

Browse files
authored
fix(ui-collectionview): Ensure cell view binding context during loaded event
fix(ui-collectionview): Ensure cell view binding context during loaded event
2 parents 56c2ec6 + 63dfb92 commit 899306b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/collectionview/index.android.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,7 +1291,7 @@ export class CollectionView extends CollectionViewBase {
12911291

12921292
@profile
12931293
notifyForItemAtIndex(eventName: string, view: View, index: number, bindingContext?, native?: any) {
1294-
const args = { eventName, object: this, index, view, ios: native, bindingContext };
1294+
const args = { eventName, object: this, index, view, android: native, bindingContext };
12951295
this.notify(args);
12961296
return args as any;
12971297
}
@@ -1317,10 +1317,15 @@ export class CollectionView extends CollectionViewBase {
13171317

13181318
if (isNonSync && args.view !== view) {
13191319
view = args.view;
1320+
1321+
// Set binding context before adding view to parent to ensure it's available during view loaded event
1322+
view.bindingContext = bindingContext;
1323+
13201324
// the view has been changed on the event handler
1321-
(holder.view as ContentView).content = args.view;
1325+
(holder.view as ContentView).content = view;
1326+
} else {
1327+
view.bindingContext = bindingContext;
13221328
}
1323-
view.bindingContext = bindingContext;
13241329
view.notify({ eventName: CollectionViewBase.bindedEvent });
13251330
let width = this._effectiveColWidth;
13261331
let height = this._effectiveRowHeight;

0 commit comments

Comments
 (0)