@@ -836,10 +836,29 @@ export interface ScrollViewProps
836836 StickyHeaderComponent ?: React . ComponentType < any > | undefined ;
837837}
838838
839- declare class ScrollViewComponent extends React . Component < ScrollViewProps > { }
840- export declare const ScrollViewBase : Constructor < ScrollResponderMixin > &
841- typeof ScrollViewComponent ;
842- export class ScrollView extends ScrollViewBase {
839+ export interface ScrollViewScrollToOptions {
840+ x ?: number ;
841+ y ?: number ;
842+ animated ?: boolean ;
843+ }
844+
845+ // Public methods for ScrollView
846+ export interface ScrollViewImperativeMethods {
847+ /**
848+ * Returns a reference to the underlying scroll responder, which supports
849+ * operations like `scrollTo`. All ScrollView-like components should
850+ * implement this method so that they can be composed while providing access
851+ * to the underlying scroll responder's methods.
852+ */
853+ readonly getScrollResponder : ( ) => ScrollResponderType ;
854+ readonly getScrollableNode : ( ) => number | undefined ;
855+ readonly getInnerViewNode : ( ) => number | undefined ;
856+ readonly getInnerViewRef : ( ) => React . ComponentRef < typeof View > | null ;
857+ /**
858+ * Returns a reference to the underlying native scroll view, or null if the
859+ * native instance is not mounted.
860+ */
861+ readonly getNativeScrollRef : ( ) => HostInstance | null ;
843862 /**
844863 * Scrolls to a given x, y offset, either immediately or with a smooth animation.
845864 * Syntax:
@@ -850,18 +869,11 @@ export class ScrollView extends ScrollViewBase {
850869 * the function also accepts separate arguments as an alternative to the options object.
851870 * This is deprecated due to ambiguity (y before x), and SHOULD NOT BE USED.
852871 */
853- scrollTo (
854- y ?:
855- | number
856- | {
857- x ?: number | undefined ;
858- y ?: number | undefined ;
859- animated ?: boolean | undefined ;
860- } ,
872+ readonly scrollTo : (
873+ options ?: ScrollViewScrollToOptions | number ,
861874 deprecatedX ?: number ,
862875 deprecatedAnimated ?: boolean ,
863- ) : void ;
864-
876+ ) => void ;
865877 /**
866878 * A helper function that scrolls to the end of the scrollview;
867879 * If this is a vertical ScrollView, it scrolls to the bottom.
@@ -870,32 +882,39 @@ export class ScrollView extends ScrollViewBase {
870882 * The options object has an animated prop, that enables the scrolling animation or not.
871883 * The animated prop defaults to true
872884 */
873- scrollToEnd ( options ?: { animated ?: boolean | undefined } ) : void ;
874-
885+ readonly scrollToEnd : ( options ?: ScrollViewScrollToOptions | null ) => void ;
875886 /**
876887 * Displays the scroll indicators momentarily.
877888 */
878- flashScrollIndicators ( ) : void ;
879-
880- /**
881- * Returns a reference to the underlying scroll responder, which supports
882- * operations like `scrollTo`. All ScrollView-like components should
883- * implement this method so that they can be composed while providing access
884- * to the underlying scroll responder's methods.
885- */
886- getScrollResponder ( ) : ScrollResponderMixin ;
887-
888- getScrollableNode ( ) : any ;
889+ readonly flashScrollIndicators : ( ) => void ;
890+ readonly scrollResponderZoomTo : (
891+ rect : {
892+ x : number ;
893+ y : number ;
894+ width : number ;
895+ height : number ;
896+ animated ?: boolean ;
897+ } ,
898+ animated ?: boolean , // deprecated, put this inside the rect argument instead
899+ ) => void ;
900+ readonly scrollResponderScrollNativeHandleToKeyboard : (
901+ nodeHandle : number | HostInstance ,
902+ additionalOffset ?: number ,
903+ preventNegativeScrollOffset ?: boolean ,
904+ ) => void ;
905+ }
889906
890- // Undocumented
891- getInnerViewNode ( ) : any ;
907+ export type ScrollResponderType = ScrollViewImperativeMethods ;
892908
893- /**
894- * Returns a reference to the underlying native scroll view, or null if the
895- * native instance is not mounted.
896- */
897- getNativeScrollRef : ( ) => HostInstance | null ;
909+ export interface PublicScrollViewInstance
910+ extends HostInstance ,
911+ ScrollViewImperativeMethods { }
898912
913+ declare class ScrollViewComponent extends React . Component < ScrollViewProps > { }
914+ export declare const ScrollViewBase : Constructor < ScrollResponderMixin > &
915+ typeof ScrollViewComponent ;
916+ export interface ScrollView extends ScrollViewImperativeMethods { }
917+ export class ScrollView extends ScrollViewBase {
899918 /**
900919 * @deprecated Use scrollTo instead
901920 */
0 commit comments