import type * as React from "react"; import { codegenNativeCommands, codegenNativeComponent, type ColorValue, type HostComponent, type ViewProps, } from "react-native"; import type { DirectEventHandler, Double, WithDefault, } from "react-native/Libraries/Types/CodegenTypes"; export type NativeScrollerScrollEvent = Readonly<{ contentInset: Readonly<{ top: Double; right: Double; bottom: Double; left: Double; }>; contentOffset: Readonly<{ x: Double; y: Double }>; contentSize: Readonly<{ width: Double; height: Double }>; layoutMeasurement: Readonly<{ width: Double; height: Double }>; velocity: Readonly<{ x: Double; y: Double }>; targetContentOffset: Readonly<{ x: Double; y: Double }>; zoomScale: Double; }>; export interface NativeProps extends ViewProps { contentWidth?: WithDefault; contentHeight?: WithDefault; scrollEnabled?: WithDefault; nestedScrollEnabled?: WithDefault; showsVerticalScrollIndicator?: WithDefault; showsHorizontalScrollIndicator?: WithDefault; bounces?: WithDefault; alwaysBounceVertical?: WithDefault; keyboardDismissMode?: WithDefault<"none" | "on-drag" | "interactive", "none">; keyboardShouldPersistTaps?: WithDefault< "never" | "always" | "handled", "never" >; scrollEventThrottle?: WithDefault; decelerationRate?: WithDefault; contentInsetTop?: WithDefault; contentInsetRight?: WithDefault; contentInsetBottom?: WithDefault; contentInsetLeft?: WithDefault; topScrollEdgeEffect?: WithDefault<"none" | "hard" | "soft", "none">; topOverlayHeight?: WithDefault; refreshEnabled?: WithDefault; refreshing?: WithDefault; refreshTintColor?: ColorValue; refreshColors?: ReadonlyArray; refreshProgressBackgroundColor?: ColorValue; refreshProgressViewOffset?: WithDefault; refreshTitle?: string; refreshTitleColor?: ColorValue; refreshSize?: WithDefault<"default" | "large", "default">; onContentViewportChange?: DirectEventHandler>; onRefresh?: DirectEventHandler; onScroll?: DirectEventHandler; onScrollBeginDrag?: DirectEventHandler; onScrollEndDrag?: DirectEventHandler; onMomentumScrollBegin?: DirectEventHandler; onMomentumScrollEnd?: DirectEventHandler; } type NativeScrollerHost = HostComponent; export interface NativeCommands { scrollTo: ( viewRef: React.ElementRef, x: Double, y: Double, animated: boolean ) => void; scrollToEnd: ( viewRef: React.ElementRef, animated: boolean ) => void; flashScrollIndicators: ( viewRef: React.ElementRef ) => void; setRefreshState: ( viewRef: React.ElementRef, refreshing: boolean ) => void; } export const Commands: NativeCommands = codegenNativeCommands({ supportedCommands: [ "scrollTo", "scrollToEnd", "flashScrollIndicators", "setRefreshState", ], }); export default codegenNativeComponent("RNCNativeScroller", { interfaceOnly: true, }) as NativeScrollerHost;