Skip to main content

useScrollToBlock

This hook is used to scroll to a specific block on the page.

Usage

import { useScrollToBlock } from '@appmaker-xyz/react-native';

const Button =()=> {
const { scrollToIndex } = useScrollToBlock();

return(
<Button onPress={() => scrollToIndex(0)} />
)
}
import { useScrollToBlock } from '@appmaker-xyz/react-native';

const { scrollToClientId } = useScrollToBlock();

// Specify the client ID of the block you want to scroll to
const blockClientId = 'block-unique-client-id'

// Call the scrollToClientId function to scroll to the desired block
scrollToClientId(blockClientId);