Skip to content

Commit 4d248b5

Browse files
authored
Fix: ScrollView getScrollResponder returns a ScrollResponderMixin rather than a JSX element (DefinitelyTyped#47325)
1 parent 63d3b1b commit 4d248b5

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

types/react-native/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6836,7 +6836,7 @@ export class ScrollView extends ScrollViewBase {
68366836
* implement this method so that they can be composed while providing access
68376837
* to the underlying scroll responder's methods.
68386838
*/
6839-
getScrollResponder(): JSX.Element;
6839+
getScrollResponder(): ScrollResponderMixin;
68406840

68416841
getScrollableNode(): any;
68426842

types/react-native/test/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,14 @@ class ScrollerListComponentTest extends React.Component<{}, { dataSource: ListVi
602602
scrollView: ScrollView | null = null;
603603

604604
testNativeMethods() {
605-
this.scrollView && this.scrollView.setNativeProps({ scrollEnabled: false });
605+
if (this.scrollView) {
606+
this.scrollView.setNativeProps({ scrollEnabled: false });
607+
608+
// Dummy values for scroll dimenions changes
609+
this.scrollView.getScrollResponder().scrollResponderZoomTo({
610+
x: 0, y: 0, width: 300, height: 500, animated: true
611+
})
612+
}
606613
}
607614

608615
render() {

0 commit comments

Comments
 (0)