@@ -85,7 +85,7 @@ class BigList extends PureComponent {
8585 } ;
8686 }
8787 const self = BigList ;
88- const layoutItemHeight = self . getItemHeight ( itemHeight , getItemLayout ) ;
88+ const layoutItemHeight = self . getItemHeight ( itemHeight , getItemLayout , data , sections ) ;
8989 const sectionLengths = self . getSectionLengths ( sections , data ) ;
9090 const processor = new BigListProcessor ( {
9191 sections : sectionLengths ,
@@ -160,11 +160,15 @@ class BigList extends PureComponent {
160160 * Get item height.
161161 * @param {number } itemHeight
162162 * @param {function|null|undefined } getItemLayout
163+ * @param {array|null|undefined } data
164+ * @param {array[]|object|null|undefined } sections
163165 * @return {null|* }
164166 */
165- static getItemHeight ( itemHeight , getItemLayout ) {
167+ static getItemHeight ( itemHeight , getItemLayout , data = null , sections = null ) {
166168 if ( getItemLayout ) {
167- const itemLayout = getItemLayout ( [ ] , 0 ) ;
169+ // Pass the actual data array to getItemLayout (sections takes precedence over data)
170+ const dataArray = sections || data || [ ] ;
171+ const itemLayout = getItemLayout ( dataArray , 0 ) ;
168172 return itemLayout . length ;
169173 }
170174 if ( itemHeight ) {
@@ -178,8 +182,8 @@ class BigList extends PureComponent {
178182 * @return {null|* }
179183 */
180184 getItemHeight ( ) {
181- const { itemHeight, getItemLayout } = this . props ;
182- return this . constructor . getItemHeight ( itemHeight , getItemLayout ) ;
185+ const { itemHeight, getItemLayout, data , sections } = this . props ;
186+ return this . constructor . getItemHeight ( itemHeight , getItemLayout , data , sections ) ;
183187 }
184188
185189 /**
0 commit comments