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
10 changes: 9 additions & 1 deletion src/core/RecyclerListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { ComponentCompat } from "../utils/ComponentCompat";
import ScrollComponent from "../platform/reactnative/scrollcomponent/ScrollComponent";
import ViewRenderer from "../platform/reactnative/viewrenderer/ViewRenderer";
import { DefaultJSItemAnimator as DefaultItemAnimator } from "../platform/reactnative/itemanimators/defaultjsanimator/DefaultJSItemAnimator";
import { Platform } from "react-native";
import { Platform, ScrollView } from "react-native";
const IS_WEB = !Platform || Platform.OS === "web";
//#endif

Expand All @@ -54,6 +54,7 @@ const IS_WEB = !Platform || Platform.OS === "web";
//import ViewRenderer from "../platform/web/viewrenderer/ViewRenderer";
//import { DefaultWebItemAnimator as DefaultItemAnimator } from "../platform/web/itemanimators/DefaultWebItemAnimator";
//const IS_WEB = true;
//type ScrollView = unknown;
//#endif

/***
Expand Down Expand Up @@ -398,6 +399,13 @@ export default class RecyclerListView<P extends RecyclerListViewProps, S extends
return this._virtualRenderer.getLayoutDimension();
}

public getNativeScrollRef(): ScrollView | null {
if (this._scrollComponent && this._scrollComponent.getNativeScrollRef) {
return this._scrollComponent.getNativeScrollRef();
}
return null;
}

// Force Rerender forcefully to update view renderer. Use this in rare circumstances
public forceRerender(): void {
this.setState({
Expand Down
6 changes: 6 additions & 0 deletions src/core/scrollcomponent/BaseScrollComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from "react";
import { ScrollView } from "react-native";
import { Dimension } from "../dependencies/LayoutProvider";
import BaseScrollView, { ScrollEvent, ScrollViewDefaultProps } from "./BaseScrollView";

Expand All @@ -25,4 +26,9 @@ export default abstract class BaseScrollComponent extends React.Component<Scroll
public getScrollableNode(): number | null {
return null;
}

//Override and return ref to your custom scrollview. Useful if you need to use Animated Events on the new architecture.
public getNativeScrollRef(): ScrollView | null {
return null;
}
}
4 changes: 4 additions & 0 deletions src/platform/reactnative/scrollcomponent/ScrollComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ export default class ScrollComponent extends BaseScrollComponent {
return null;
}

public getNativeScrollRef(): ScrollView | null {
return this._scrollViewRef;
}

public render(): JSX.Element {
const Scroller = TSCast.cast<ScrollView>(this.props.externalScrollView); //TSI
const renderContentContainer = this.props.renderContentContainer ? this.props.renderContentContainer : this._defaultContainer;
Expand Down