import { createContext, useContext } from 'react'; import type { View } from 'react-native'; /** * Lets MarkdownText scroll the enclosing conversation ScrollView when an * in-document anchor link (e.g. `[jump](#setup)`) is tapped. The conversation * owns the ScrollView, so it provides this scroller; MarkdownText only hands it * the target heading view to bring into view. * * Null when MarkdownText is rendered outside a provider (e.g. standalone) — in * that case anchor links are simply no-ops. */ export type MarkdownScroller = { scrollViewIntoView: (target: View) => void; }; export const MarkdownScrollContext = createContext(null); export function useMarkdownScroll(): MarkdownScroller | null { return useContext(MarkdownScrollContext); }