Skip to content

Commit

Permalink
Mobile - Update onLayout naming for BlockListItemCell
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerardo committed May 17, 2022
1 parent 140b3f1 commit f68a4b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ import { useEffect, useCallback } from '@wordpress/element';
*/
import { useBlockListContext } from './block-list-context';

function BlockListItemCell( {
children,
clientId,
rootClientId,
listOnLayout,
} ) {
function BlockListItemCell( { children, clientId, rootClientId, onLayout } ) {
const { blocksLayouts, updateBlocksLayouts } = useBlockListContext();

useEffect( () => {
Expand All @@ -30,7 +25,7 @@ function BlockListItemCell( {
};
}, [] );

const onLayout = useCallback(
const onCellLayout = useCallback(
( event ) => {
const {
nativeEvent: { layout },
Expand All @@ -41,14 +36,14 @@ function BlockListItemCell( {
...layout,
} );

if ( listOnLayout ) {
listOnLayout( event );
if ( onLayout ) {
onLayout( event );
}
},
[ clientId, rootClientId, updateBlocksLayouts, listOnLayout ]
[ clientId, rootClientId, updateBlocksLayouts, onLayout ]
);

return <View onLayout={ onLayout }>{ children }</View>;
return <View onLayout={ onCellLayout }>{ children }</View>;
}

export default BlockListItemCell;
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export class BlockList extends Component {
<BlockListItemCell
children={ children }
clientId={ item }
listOnLayout={ onLayout }
onLayout={ onLayout }
rootClientId={ rootClientId }
/>
);
Expand Down

0 comments on commit f68a4b7

Please sign in to comment.