Skip to content

Commit

Permalink
feat: update
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuever committed Jan 14, 2025
1 parent 9820c7a commit d01e7d0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
6 changes: 3 additions & 3 deletions ui/scroller/src/react-native/ScrollEventHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Marshal from './Marshal';
class ScrollEventHelper {
private _disposer: Function;
// private _scrollHelper: ScrollHelper;
private _marshal: Marshal;
readonly marshal: Marshal;
private _onScroll: SyntheticEventHandler | undefined;
private _onScrollEndDrag: SyntheticEventHandler | undefined;
private _onScrollBeginDrag: SyntheticEventHandler | undefined;
Expand All @@ -42,7 +42,7 @@ class ScrollEventHelper {
onMomentumScrollBegin,
} = props;

this._marshal = marshal;
this.marshal = marshal;
this._onScroll = onScroll;
// this._scrollHelper = scrollHelper;
this._onScrollBeginDrag = onScrollBeginDrag;
Expand All @@ -67,7 +67,7 @@ class ScrollEventHelper {
}

register() {
this._disposer = this._marshal
this._disposer = this.marshal
.getScrollHelper()
.registerScrollEventHelper(this);
}
Expand Down
11 changes: 2 additions & 9 deletions ui/scroller/src/react-native/ScrollHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class ScrollHelper {

readonly _horizontal: boolean;

private _marshal?: Marshal;
private _marshal: Marshal;

private _scrollEnabledHandler?: { (falsy: boolean): void };

Expand Down Expand Up @@ -131,7 +131,7 @@ class ScrollHelper {
// }

return this._marshal
?.getScrollEventHelper()
.getScrollEventHelper()
.subscribeEventHandler(eventName, handler);
}

Expand Down Expand Up @@ -159,13 +159,6 @@ class ScrollHelper {
}
}

_setMarshal(marshal: Marshal) {
if (!this._marshal) {
// set marshal only if this._marshal is null
this._marshal = marshal;
}
}

getMarshal() {
return this._marshal;
}
Expand Down
5 changes: 1 addition & 4 deletions ui/scroller/src/react-native/ScrollView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ import {
ScrollView as RNScrollView,
View as RNView,
} from 'react-native';
import { IntersectionObserver } from '@infinite-list/intersection-observer/react-native';
import isRefObject from '@x-oasis/is-ref';

import Marshal from './Marshal';
import ScrollEventHelper from './ScrollEventHelper';
import ScrollHelper from './ScrollHelper';
import { DEFAULT_SCROLL_EVENT_THROTTLE } from './commons/constants';
import { isIos } from './commons/platform';
Expand Down Expand Up @@ -93,8 +91,7 @@ const ScrollView: FC<SpectrumScrollViewPropsWithForwardRef> = (props) => {

const removeClippedSubviews = false;
const scrollHelperDisposerRef = useRef<Function>();
const { marshal: parentMarshal, intersectionObserver } =
scrollViewContextValues;
const { marshal: parentMarshal } = scrollViewContextValues;
const defaultScrollViewRef = useRef<RNScrollView | RNView>();
const scrollViewRef = (
isRefObject(forwardRef) ? forwardRef : defaultScrollViewRef
Expand Down

0 comments on commit d01e7d0

Please sign in to comment.