Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export interface ScrollViewImperativeMethods {
+getScrollableNode: () => ?number;
+getInnerViewNode: () => ?number;
+getInnerViewRef: () => InnerViewInstance | null;
+getNativeScrollRef: () => HostInstance | null;
+getNativeScrollRef: () => PublicScrollViewInstance | null;
+scrollTo: (
options?: ScrollViewScrollToOptions | number,
deprecatedX?: number,
Expand Down Expand Up @@ -873,6 +873,9 @@ class ScrollView extends React.Component<ScrollViewProps, ScrollViewState> {

getNativeScrollRef: ScrollViewImperativeMethods['getNativeScrollRef'] =
() => {
// Object.assign in _scrollView's mutator augments nativeInstance in place,
// so it is already a PublicScrollViewInstance at runtime.
// $FlowFixMe[incompatible-type]
return this._scrollView.nativeInstance;
};

Expand Down
8 changes: 2 additions & 6 deletions packages/react-native/Libraries/Lists/FlatList.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @format
*/

import typeof ScrollViewNativeComponent from '../Components/ScrollView/ScrollViewNativeComponent';
import type {PublicScrollViewInstance} from '../Components/ScrollView/ScrollView';
import type {ViewStyleProp} from '../StyleSheet/StyleSheet';
import type {
ListRenderItem,
Expand Down Expand Up @@ -397,12 +397,8 @@ class FlatList<ItemT = any> extends React.PureComponent<FlatListProps<ItemT>> {
/**
* Provides a reference to the underlying host component
*/
getNativeScrollRef():
| ?React.ElementRef<typeof View>
| ?React.ElementRef<ScrollViewNativeComponent> {
getNativeScrollRef(): ?PublicScrollViewInstance {
if (this._listRef) {
/* $FlowFixMe[incompatible-return] Suppresses errors found when fixing
* TextInput typing */
return this._listRef.getScrollRef();
}
}
Expand Down
101 changes: 14 additions & 87 deletions packages/react-native/ReactNativeApi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<eeffa8d1c270f98debd70024251b4a1a>>
* @generated SignedSource<<64be490fbc4d36e47ba200ba0846131f>>
*
* This file was generated by scripts/js-api/build-types/index.js.
*/
Expand Down Expand Up @@ -90,7 +90,6 @@ declare const $$NativeDialogManagerAndroid: null | Spec | undefined
declare const $$ProgressBarAndroidNativeComponent: HostComponent<AndroidProgressBarNativeProps>
declare const $$ReactFabric: typeof ReactFabric_default
declare const $$ScrollViewContext: typeof ScrollViewContext_default
declare const $$ScrollViewNativeComponent: typeof ScrollViewNativeComponent_default
declare const $$SwitchNativeComponent: ComponentType
declare const $$ViewNativeComponent: typeof ViewNativeComponent_default
declare const absoluteFill: AbsoluteFillStyle
Expand Down Expand Up @@ -400,7 +399,6 @@ declare const SafeAreaView_default: (
) => React.ReactNode
declare const ScrollView: typeof ScrollViewWrapper & ScrollViewComponentStatics
declare const ScrollViewContext_default: React.Context<Value>
declare const ScrollViewNativeComponent_default: HostComponent<ScrollViewNativeProps>
declare const ScrollViewWrapper: (
props: ScrollViewProps & {
ref?: React.Ref<PublicScrollViewInstance>
Expand Down Expand Up @@ -1016,7 +1014,6 @@ declare type $$ProgressBarAndroidNativeComponent =
typeof $$ProgressBarAndroidNativeComponent
declare type $$ReactFabric = typeof $$ReactFabric
declare type $$ScrollViewContext = typeof $$ScrollViewContext
declare type $$ScrollViewNativeComponent = typeof $$ScrollViewNativeComponent
declare type $$SwitchNativeComponent = typeof $$SwitchNativeComponent
declare type $$ViewNativeComponent = typeof $$ViewNativeComponent
declare type absoluteFill = typeof absoluteFill
Expand Down Expand Up @@ -2334,9 +2331,7 @@ declare class FlatList<ItemT = any> extends React.PureComponent<
componentDidUpdate(prevProps: FlatListProps<ItemT>): void
constructor(props: FlatListProps<ItemT>)
flashScrollIndicators(): void
getNativeScrollRef():
| (null | React.ComponentRef<ScrollViewNativeComponent> | undefined)
| (null | React.ComponentRef<typeof View> | undefined)
getNativeScrollRef(): null | PublicScrollViewInstance | undefined
getScrollableNode(): any
getScrollResponder(): null | ScrollResponderType | undefined
recordInteraction(): void
Expand Down Expand Up @@ -4478,7 +4473,7 @@ declare interface ScrollViewImperativeMethods {
readonly flashScrollIndicators: () => void
readonly getInnerViewNode: () => number | undefined
readonly getInnerViewRef: () => InnerViewInstance | null
readonly getNativeScrollRef: () => HostInstance | null
readonly getNativeScrollRef: () => null | PublicScrollViewInstance
readonly getScrollableNode: () => number | undefined
readonly getScrollResponder: () => ScrollResponderType
readonly scrollResponderScrollNativeHandleToKeyboard: (
Expand All @@ -4505,74 +4500,6 @@ declare interface ScrollViewImperativeMethods {
options?: ScrollViewScrollToOptions | undefined,
) => void
}
declare type ScrollViewNativeComponent = typeof $$ScrollViewNativeComponent
declare type ScrollViewNativeProps = Readonly<
Omit<ViewProps, "onResponderGrant"> & {
alwaysBounceHorizontal?: boolean
alwaysBounceVertical?: boolean
automaticallyAdjustContentInsets?: boolean
automaticallyAdjustKeyboardInsets?: boolean
automaticallyAdjustsScrollIndicatorInsets?: boolean
bounces?: boolean
bouncesZoom?: boolean
canCancelContentTouches?: boolean
centerContent?: boolean
contentInset?: EdgeInsetsProp
contentInsetAdjustmentBehavior?:
| "always"
| "automatic"
| "never"
| "scrollableAxes"
contentOffset?: PointProp
decelerationRate?: "fast" | "normal" | number
directionalLockEnabled?: boolean
disableIntervalMomentum?: boolean
endFillColor?: ColorValue
fadingEdgeLength?:
| (number | undefined)
| {
end: number
start: number
}
indicatorStyle?: "black" | "default" | "white"
isInvertedVirtualizedList?: boolean
keyboardDismissMode?: "interactive" | "none" | "on-drag"
maintainVisibleContentPosition?: {
readonly autoscrollToTopThreshold?: number
readonly minIndexForVisible: number
}
maximumZoomScale?: number
minimumZoomScale?: number
nestedScrollEnabled?: boolean
onMomentumScrollBegin?: (event: ScrollEvent) => void
onMomentumScrollEnd?: (event: ScrollEvent) => void
onResponderGrant?: (e: GestureResponderEvent) => boolean | void
onScroll?: (event: ScrollEvent) => void
onScrollBeginDrag?: (event: ScrollEvent) => void
onScrollEndDrag?: (event: ScrollEvent) => void
overScrollMode?: "always" | "auto" | "never"
pagingEnabled?: boolean
persistentScrollbar?: boolean
pinchGestureEnabled?: boolean
scrollEnabled?: boolean
scrollEventThrottle?: number
scrollIndicatorInsets?: EdgeInsetsProp
scrollPerfTag?: string
scrollsChildToFocus?: boolean
scrollsToTop?: boolean
scrollToOverflowEnabled?: boolean
sendMomentumEvents?: boolean
showsHorizontalScrollIndicator?: boolean
showsVerticalScrollIndicator?: boolean
snapToAlignment?: "center" | "end" | "start"
snapToEnd?: boolean
snapToInterval?: number
snapToOffsets?: ReadonlyArray<number>
snapToStart?: boolean
zoomScale?: number
onScrollToTop?: (event: ScrollEvent) => void
}
>
declare type ScrollViewProps = Readonly<
ViewProps & ScrollViewPropsIOS & ScrollViewPropsAndroid & ScrollViewBaseProps
>
Expand Down Expand Up @@ -6067,7 +5994,7 @@ export {
AlertOptions, // a0cdac0f
AlertType, // 5ab91217
AndroidKeyboardEvent, // e03becc8
Animated, // 0652b5d1
Animated, // 5254e138
AppConfig, // ce4209a7
AppRegistry, // 5edf0524
AppState, // 12012be5
Expand Down Expand Up @@ -6114,8 +6041,8 @@ export {
EventSubscription, // b8d084aa
ExtendedExceptionData, // 5a6ccf5a
FilterFunction, // bf24c0e3
FlatList, // 8c50f04a
FlatListProps, // e170f2c9
FlatList, // 869c5a5f
FlatListProps, // 2a81c428
FocusEvent, // 62fc1eb8
FontVariant, // 7c7558bb
GestureResponderEvent, // f693e9a5
Expand Down Expand Up @@ -6250,18 +6177,18 @@ export {
SafeAreaView, // 9589fa67
ScaledSize, // 07e417c7
ScrollEvent, // 5d529218
ScrollResponderType, // c6860ec8
ScrollResponderType, // 114c7cc8
ScrollToLocationParamsType, // d7ecdad1
ScrollView, // a3918d1a
ScrollViewImperativeMethods, // 7cd8d8de
ScrollViewProps, // 429fdd65
ScrollView, // 7180dc9b
ScrollViewImperativeMethods, // 3f95ab77
ScrollViewProps, // 57e1167c
ScrollViewPropsAndroid, // 44210553
ScrollViewPropsIOS, // b34b696c
ScrollViewScrollToOptions, // 3313411e
SectionBase, // b376bddc
SectionList, // 92031230
SectionList, // c7dfd290
SectionListData, // 119baf83
SectionListProps, // c0d0a46a
SectionListProps, // 54f880fa
SectionListRenderItem, // 1fad0435
SectionListRenderItemInfo, // 745e1992
Separators, // 6a45f7e3
Expand Down Expand Up @@ -6326,9 +6253,9 @@ export {
ViewStyle, // 00a0f8fb
VirtualViewMode, // 6be59722
VirtualizedList, // 68c7345e
VirtualizedListProps, // c7e8e7d7
VirtualizedListProps, // d414f5ca
VirtualizedSectionList, // 9fd9cd61
VirtualizedSectionListProps, // 53a7e6a4
VirtualizedSectionListProps, // 01460821
WrapperComponentProvider, // 9cf3844c
codegenNativeCommands, // 628a7c0a
codegenNativeComponent, // 2baac257
Expand Down
Loading