Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Mobile - Update onLayout naming for BlockListItemCell
  • Loading branch information
Gerardo committed May 17, 2022
commit f68a4b707b6af4e8ce60cce06465071fb41228cd
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