import type { RefObject } from 'react'; export declare function clearWorkletRefLastIdForTesting(): void; declare abstract class WorkletRef { get current(): T; set current(_: T); } /** * A `MainThreadRef` is a ref that can only be accessed on the main thread. It is used to preserve * states between main thread function calls. * The data saved in `current` property of the `MainThreadRef` can be read and written in * multiple main thread functions. * @public */ export declare class MainThreadRef extends WorkletRef { constructor(initValue: T); } /** * Create A `MainThreadRef`. * * A `MainThreadRef` is a ref that can only be accessed on the main thread. It is used to preserve * states between main thread function calls. * The data saved in `current` property of the `MainThreadRef` can be read and written in * multiple main thread functions. * * It is a hook and it should only be called at the top level of your component. * * @param initValue - The init value of the `MainThreadRef`. * * @example * * ```ts * import { useMainThreadRef } from '@lynx-js/react' * import type { MainThread } from '@lynx-js/types' * * export function App() { * const ref = useMainThreadRef(null) * * const handleTap = () => { * 'main thread' * ref.current?.setStyleProperty('background-color', 'blue') * } * * return ( * * ) * } * ``` * * @public */ export declare function useMainThreadRef(initValue: T): MainThreadRef; /** * Create A `MainThreadRef`. * * A `MainThreadRef` is a ref that can only be accessed on the main thread. It is used to preserve * states between main thread function calls. * The data saved in `current` property of the `MainThreadRef` can be read and written in * multiple main thread functions. * * It is a hook and it should only be called at the top level of your component. * * @param initValue - The init value of the `MainThreadRef`. * * @example * * ```ts * import { useMainThreadRef } from '@lynx-js/react' * import type { MainThread } from '@lynx-js/types' * * export function App() { * const ref = useMainThreadRef(null) * * const handleTap = () => { * 'main thread' * ref.current?.setStyleProperty('background-color', 'blue') * } * * return ( * * ) * } * ``` * * @public */ export declare function useMainThreadRef(initValue: T | null): RefObject; /** * Create A `MainThreadRef`. * * A `MainThreadRef` is a ref that can only be accessed on the main thread. It is used to preserve * states between main thread function calls. * The data saved in `current` property of the `MainThreadRef` can be read and written in * multiple main thread functions. * * It is a hook and it should only be called at the top level of your component. * * @example * * ```ts * import { useMainThreadRef } from '@lynx-js/react' * import type { MainThread } from '@lynx-js/types' * * export function App() { * const ref = useMainThreadRef(null) * * const handleTap = () => { * 'main thread' * ref.current?.setStyleProperty('background-color', 'blue') * } * * return ( * * ) * } * ``` * * @public */ export declare function useMainThreadRef(): MainThreadRef; export {};