@@ -827,10 +827,29 @@ export interface ScrollViewProps
827827 StickyHeaderComponent ?: React . ComponentType < any > | undefined ;
828828}
829829
830- declare class ScrollViewComponent extends React . Component < ScrollViewProps > { }
831- export declare const ScrollViewBase : Constructor < ScrollResponderMixin > &
832- typeof ScrollViewComponent ;
833- export class ScrollView extends ScrollViewBase {
830+ export interface ScrollViewScrollToOptions {
831+ x ?: number ;
832+ y ?: number ;
833+ animated ?: boolean ;
834+ }
835+
836+ // Public methods for ScrollView
837+ export interface ScrollViewImperativeMethods {
838+ /**
839+ * Returns a reference to the underlying scroll responder, which supports
840+ * operations like `scrollTo`. All ScrollView-like components should
841+ * implement this method so that they can be composed while providing access
842+ * to the underlying scroll responder's methods.
843+ */
844+ readonly getScrollResponder : ( ) => ScrollResponderType ;
845+ readonly getScrollableNode : ( ) => number | undefined ;
846+ readonly getInnerViewNode : ( ) => number | undefined ;
847+ readonly getInnerViewRef : ( ) => React . ComponentRef < typeof View > | null ;
848+ /**
849+ * Returns a reference to the underlying native scroll view, or null if the
850+ * native instance is not mounted.
851+ */
852+ readonly getNativeScrollRef : ( ) => HostInstance | null ;
834853 /**
835854 * Scrolls to a given x, y offset, either immediately or with a smooth animation.
836855 * Syntax:
@@ -841,18 +860,11 @@ export class ScrollView extends ScrollViewBase {
841860 * the function also accepts separate arguments as an alternative to the options object.
842861 * This is deprecated due to ambiguity (y before x), and SHOULD NOT BE USED.
843862 */
844- scrollTo (
845- y ?:
846- | number
847- | {
848- x ?: number | undefined ;
849- y ?: number | undefined ;
850- animated ?: boolean | undefined ;
851- } ,
863+ readonly scrollTo : (
864+ options ?: ScrollViewScrollToOptions | number ,
852865 deprecatedX ?: number ,
853866 deprecatedAnimated ?: boolean ,
854- ) : void ;
855-
867+ ) => void ;
856868 /**
857869 * A helper function that scrolls to the end of the scrollview;
858870 * If this is a vertical ScrollView, it scrolls to the bottom.
@@ -861,32 +873,39 @@ export class ScrollView extends ScrollViewBase {
861873 * The options object has an animated prop, that enables the scrolling animation or not.
862874 * The animated prop defaults to true
863875 */
864- scrollToEnd ( options ?: { animated ?: boolean | undefined } ) : void ;
865-
876+ readonly scrollToEnd : ( options ?: ScrollViewScrollToOptions | null ) => void ;
866877 /**
867878 * Displays the scroll indicators momentarily.
868879 */
869- flashScrollIndicators ( ) : void ;
870-
871- /**
872- * Returns a reference to the underlying scroll responder, which supports
873- * operations like `scrollTo`. All ScrollView-like components should
874- * implement this method so that they can be composed while providing access
875- * to the underlying scroll responder's methods.
876- */
877- getScrollResponder ( ) : ScrollResponderMixin ;
878-
879- getScrollableNode ( ) : any ;
880+ readonly flashScrollIndicators : ( ) => void ;
881+ readonly scrollResponderZoomTo : (
882+ rect : {
883+ x : number ;
884+ y : number ;
885+ width : number ;
886+ height : number ;
887+ animated ?: boolean ;
888+ } ,
889+ animated ?: boolean , // deprecated, put this inside the rect argument instead
890+ ) => void ;
891+ readonly scrollResponderScrollNativeHandleToKeyboard : (
892+ nodeHandle : number | HostInstance ,
893+ additionalOffset ?: number ,
894+ preventNegativeScrollOffset ?: boolean ,
895+ ) => void ;
896+ }
880897
881- // Undocumented
882- getInnerViewNode ( ) : any ;
898+ export type ScrollResponderType = ScrollViewImperativeMethods ;
883899
884- /**
885- * Returns a reference to the underlying native scroll view, or null if the
886- * native instance is not mounted.
887- */
888- getNativeScrollRef : ( ) => HostInstance | null ;
900+ export interface PublicScrollViewInstance
901+ extends HostInstance ,
902+ ScrollViewImperativeMethods { }
889903
904+ declare class ScrollViewComponent extends React . Component < ScrollViewProps > { }
905+ export declare const ScrollViewBase : Constructor < ScrollResponderMixin > &
906+ typeof ScrollViewComponent ;
907+ export interface ScrollView extends ScrollViewImperativeMethods { }
908+ export class ScrollView extends ScrollViewBase {
890909 /**
891910 * @deprecated Use scrollTo instead
892911 */
0 commit comments