@onekeyfe/react-native-pager-view 3.0.111 → 3.0.113

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+
3
+ import React from "react";
4
+ import { I18nManager, Platform, StyleSheet, View } from "react-native";
5
+ import CollapsiblePagerViewNativeComponent, { Commands as CollapsiblePagerViewNativeCommands } from "./CollapsiblePagerViewNativeComponent";
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ const pageKey = (child, index) => {
8
+ if (/*#__PURE__*/React.isValidElement(child) && child.key != null) {
9
+ return String(child.key);
10
+ }
11
+ return `page-${index}`;
12
+ };
13
+
14
+ /**
15
+ * Pager variant whose vertical header coordination is performed by the native
16
+ * scrolling containers. React participates only at settled page boundaries to
17
+ * retain the selected/adjacent heavy page subtrees.
18
+ */
19
+ export class CollapsiblePagerView extends React.PureComponent {
20
+ state = {
21
+ selectedPage: Math.max(0, this.props.initialPage ?? 0)
22
+ };
23
+ nativeRef = null;
24
+ lastMountSignature = null;
25
+ componentDidMount() {
26
+ this.notifyMountedPagesChanged();
27
+ }
28
+ componentDidUpdate() {
29
+ this.notifyMountedPagesChanged();
30
+ }
31
+ setPage = selectedPage => {
32
+ if (this.nativeRef) {
33
+ CollapsiblePagerViewNativeCommands.setPage(this.nativeRef, selectedPage);
34
+ }
35
+ };
36
+ setPageWithoutAnimation = selectedPage => {
37
+ if (this.nativeRef) {
38
+ CollapsiblePagerViewNativeCommands.setPageWithoutAnimation(this.nativeRef, selectedPage);
39
+ }
40
+ };
41
+ setScrollEnabled = scrollEnabled => {
42
+ if (this.nativeRef) {
43
+ CollapsiblePagerViewNativeCommands.setScrollEnabledImperatively(this.nativeRef, scrollEnabled);
44
+ }
45
+ };
46
+ pages() {
47
+ return React.Children.toArray(this.props.children);
48
+ }
49
+ retentionDistance() {
50
+ return Math.max(0, Math.floor(this.props.pageRetentionDistance ?? 1));
51
+ }
52
+ mountedPages(pageCount = this.pages().length) {
53
+ const distance = this.retentionDistance();
54
+ const selected = Math.min(Math.max(0, this.state.selectedPage), Math.max(0, pageCount - 1));
55
+ const mounted = [];
56
+ for (let index = 0; index < pageCount; index += 1) {
57
+ if (Math.abs(index - selected) <= distance) {
58
+ mounted.push(index);
59
+ }
60
+ }
61
+ return mounted;
62
+ }
63
+ notifyMountedPagesChanged = () => {
64
+ if (!this.props.onMountedPagesChanged) {
65
+ return;
66
+ }
67
+ const pages = this.pages();
68
+ const state = {
69
+ position: this.state.selectedPage,
70
+ mountedPages: this.mountedPages(pages.length),
71
+ pageKeys: pages.map(pageKey)
72
+ };
73
+ const signature = JSON.stringify(state);
74
+ if (signature === this.lastMountSignature) {
75
+ return;
76
+ }
77
+ this.lastMountSignature = signature;
78
+ this.props.onMountedPagesChanged(state);
79
+ };
80
+ onPageSelected = event => {
81
+ const position = Math.max(0, Math.trunc(event.nativeEvent.position));
82
+ if (position !== this.state.selectedPage) {
83
+ this.setState({
84
+ selectedPage: position
85
+ }, this.notifyMountedPagesChanged);
86
+ }
87
+ this.props.onPageSelected?.(event);
88
+ };
89
+ render() {
90
+ const {
91
+ children: _children,
92
+ header,
93
+ stickyHeader,
94
+ headerHeight,
95
+ stickyHeaderHeight,
96
+ pageRetentionDistance: _pageRetentionDistance,
97
+ onMountedPagesChanged: _onMountedPagesChanged,
98
+ onPageSelected: _onPageSelected,
99
+ layoutDirection,
100
+ offscreenPageLimit,
101
+ ...nativeProps
102
+ } = this.props;
103
+ const pages = this.pages();
104
+ const pageKeys = pages.map(pageKey);
105
+ const retained = new Set(this.mountedPages(pages.length));
106
+ const deducedLayoutDirection = !layoutDirection || layoutDirection === "locale" ? I18nManager.isRTL ? "rtl" : "ltr" : layoutDirection;
107
+ return /*#__PURE__*/_jsxs(CollapsiblePagerViewNativeComponent, {
108
+ ...nativeProps,
109
+ ref: ref => {
110
+ this.nativeRef = ref;
111
+ },
112
+ layoutDirection: deducedLayoutDirection,
113
+ offscreenPageLimit: Math.max(1, offscreenPageLimit ?? 1),
114
+ headerHeight: Math.max(0, Math.round(headerHeight)),
115
+ stickyHeaderHeight: Math.max(0, Math.round(stickyHeaderHeight)),
116
+ pageKeys: JSON.stringify(pageKeys),
117
+ retainedPages: JSON.stringify([...retained]),
118
+ onPageSelected: this.onPageSelected,
119
+ children: [/*#__PURE__*/_jsx(View, {
120
+ collapsable: false,
121
+ pointerEvents: "box-none",
122
+ style: [styles.slot, {
123
+ bottom: undefined,
124
+ height: Math.max(0, Math.round(headerHeight))
125
+ }],
126
+ children: header
127
+ }, "collapsible-header"), /*#__PURE__*/_jsx(View, {
128
+ collapsable: false,
129
+ pointerEvents: "box-none",
130
+ style: [styles.slot, {
131
+ top: Math.max(0, Math.round(headerHeight)),
132
+ bottom: undefined,
133
+ height: Math.max(0, Math.round(stickyHeaderHeight))
134
+ }],
135
+ children: stickyHeader
136
+ }, "sticky-header"), pages.map((page, index) => /*#__PURE__*/_jsx(View, {
137
+ collapsable: false,
138
+ style: [styles.slot,
139
+ // Android translates the expanded pager while consuming header scroll.
140
+ // Keep Yoga's page bounds aligned with that native viewport.
141
+ Platform.OS === "android" ? {
142
+ bottom: -Math.max(0, Math.round(headerHeight))
143
+ } : null],
144
+ children: retained.has(index) ? page : null
145
+ }, pageKeys[index]))]
146
+ });
147
+ }
148
+ }
149
+ const styles = {
150
+ slot: StyleSheet.absoluteFill
151
+ };
152
+ //# sourceMappingURL=CollapsiblePagerView.js.map
@@ -0,0 +1,364 @@
1
+ "use strict";
2
+
3
+ import React from "react";
4
+ import { I18nManager, StyleSheet, View } from "react-native";
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ const COLLAPSE_ANIMATION_NAME = "ok-collapsible-pager-collapse";
7
+ const COLLAPSE_STYLE_ID = "ok-collapsible-pager-styles";
8
+ let collapsiblePagerWebInstance = 0;
9
+ const timelineStyle = element => element.style;
10
+ function ensureCollapseAnimation(document) {
11
+ if (document.getElementById(COLLAPSE_STYLE_ID)) return;
12
+ const style = document.createElement("style");
13
+ style.id = COLLAPSE_STYLE_ID;
14
+ style.textContent = `@keyframes ${COLLAPSE_ANIMATION_NAME}{from{transform:translateY(0)}to{transform:translateY(calc(-1 * var(--ok-collapsible-header-height)))}}`;
15
+ document.head.appendChild(style);
16
+ }
17
+ const pageKey = (child, index) => {
18
+ if (/*#__PURE__*/React.isValidElement(child) && child.key != null) return String(child.key);
19
+ return `page-${index}`;
20
+ };
21
+
22
+ /** Web counterpart of the native collapsible pager contract. */
23
+ export class CollapsiblePagerView extends React.PureComponent {
24
+ state = {
25
+ selectedPage: Math.max(0, this.props.initialPage ?? 0),
26
+ animateTransition: true
27
+ };
28
+ root = null;
29
+ touchStartX = null;
30
+ touchStartY = null;
31
+ pageOffsets = new Map();
32
+ pageHosts = new Map();
33
+ sharedHeaderOffset = 0;
34
+ scrollEnabled = this.props.scrollEnabled ?? true;
35
+ lastMountSignature = null;
36
+ configureFrame = null;
37
+ configuredScrollElement = null;
38
+ timelineName = `--ok-collapsible-pager-${++collapsiblePagerWebInstance}`;
39
+ componentDidMount() {
40
+ if (this.root) ensureCollapseAnimation(this.root.ownerDocument);
41
+ this.scheduleScrollConfiguration();
42
+ this.notifyMountedPagesChanged();
43
+ this.emitDiagnostics("mounted");
44
+ }
45
+ componentDidUpdate(previousProps) {
46
+ if (previousProps.scrollEnabled !== this.props.scrollEnabled) {
47
+ this.scrollEnabled = this.props.scrollEnabled ?? true;
48
+ }
49
+ this.scheduleScrollConfiguration();
50
+ this.notifyMountedPagesChanged();
51
+ }
52
+ componentWillUnmount() {
53
+ this.savePageOffset(this.state.selectedPage);
54
+ if (this.configureFrame !== null) {
55
+ cancelAnimationFrame(this.configureFrame);
56
+ this.configureFrame = null;
57
+ }
58
+ this.restoreConfiguredScrollElement();
59
+ }
60
+ setPage = selectedPage => {
61
+ this.selectPage(selectedPage, true);
62
+ };
63
+ setPageWithoutAnimation = selectedPage => {
64
+ this.selectPage(selectedPage, false);
65
+ };
66
+ setScrollEnabled = scrollEnabled => {
67
+ this.scrollEnabled = scrollEnabled;
68
+ };
69
+ pages() {
70
+ return React.Children.toArray(this.props.children);
71
+ }
72
+ retentionDistance() {
73
+ return Math.max(0, Math.floor(this.props.pageRetentionDistance ?? 1));
74
+ }
75
+ mountedPages(pageCount = this.pages().length, selected = this.state.selectedPage) {
76
+ const mounted = [];
77
+ const distance = this.retentionDistance();
78
+ for (let index = 0; index < pageCount; index += 1) {
79
+ if (Math.abs(index - selected) <= distance) mounted.push(index);
80
+ }
81
+ return mounted;
82
+ }
83
+ nativeEvent(nativeEvent) {
84
+ return {
85
+ nativeEvent
86
+ };
87
+ }
88
+ pageScrollElement(index) {
89
+ const pageHost = this.pageHosts.get(index);
90
+ return pageHost?.querySelector(".ok-native-list-viewport, [data-collapsible-pager-scroll]") ?? pageHost;
91
+ }
92
+ restoreConfiguredScrollElement() {
93
+ const configured = this.configuredScrollElement;
94
+ if (!configured) return;
95
+ configured.element.removeEventListener("scrollend", this.onVerticalScrollSettled);
96
+ const style = timelineStyle(configured.element);
97
+ style.paddingTop = configured.paddingTop;
98
+ style.boxSizing = configured.boxSizing;
99
+ style.scrollTimelineName = configured.scrollTimelineName;
100
+ style.scrollTimelineAxis = configured.scrollTimelineAxis;
101
+ configured.element.removeAttribute("data-collapsible-pager-active");
102
+ this.configuredScrollElement = null;
103
+ }
104
+ configureActiveScrollElement = () => {
105
+ this.configureFrame = null;
106
+ const element = this.pageScrollElement(this.state.selectedPage);
107
+ if (!element) return;
108
+ if (this.configuredScrollElement?.element !== element) {
109
+ this.restoreConfiguredScrollElement();
110
+ const style = timelineStyle(element);
111
+ this.configuredScrollElement = {
112
+ element,
113
+ paddingTop: style.paddingTop,
114
+ boxSizing: style.boxSizing,
115
+ scrollTimelineName: style.scrollTimelineName,
116
+ scrollTimelineAxis: style.scrollTimelineAxis
117
+ };
118
+ element.addEventListener("scrollend", this.onVerticalScrollSettled);
119
+ }
120
+ const style = timelineStyle(element);
121
+ style.paddingTop = `${Math.max(0, this.props.headerHeight + this.props.stickyHeaderHeight)}px`;
122
+ style.boxSizing = "border-box";
123
+ style.scrollTimelineName = this.timelineName;
124
+ style.scrollTimelineAxis = "block";
125
+ element.setAttribute("data-collapsible-pager-active", "true");
126
+ };
127
+ scheduleScrollConfiguration() {
128
+ if (this.configureFrame !== null) return;
129
+ if (typeof requestAnimationFrame === "function") {
130
+ this.configureFrame = requestAnimationFrame(this.configureActiveScrollElement);
131
+ } else {
132
+ this.configureActiveScrollElement();
133
+ }
134
+ }
135
+ onVerticalScrollSettled = () => {
136
+ this.savePageOffset(this.state.selectedPage);
137
+ this.emitDiagnostics("scroll-settled");
138
+ };
139
+ savePageOffset(index) {
140
+ const key = this.pages().map(pageKey)[index];
141
+ const scrollElement = this.pageScrollElement(index);
142
+ if (key && scrollElement) {
143
+ this.pageOffsets.set(key, scrollElement.scrollTop);
144
+ this.sharedHeaderOffset = Math.min(Math.max(scrollElement.scrollTop, 0), Math.max(0, this.props.headerHeight));
145
+ }
146
+ }
147
+ restorePageOffset(index) {
148
+ const key = this.pages().map(pageKey)[index];
149
+ const scrollElement = this.pageScrollElement(index);
150
+ if (!key || !scrollElement) return;
151
+ scrollElement.scrollTop = Math.max(this.pageOffsets.get(key) ?? this.sharedHeaderOffset, this.sharedHeaderOffset);
152
+ }
153
+ selectPage(selectedPage, animated) {
154
+ const pages = this.pages();
155
+ if (selectedPage < 0 || selectedPage >= pages.length || selectedPage === this.state.selectedPage) {
156
+ return;
157
+ }
158
+ this.savePageOffset(this.state.selectedPage);
159
+ this.props.onPageScrollStateChanged?.(this.nativeEvent({
160
+ pageScrollState: animated ? "settling" : "idle"
161
+ }));
162
+ this.setState({
163
+ selectedPage,
164
+ animateTransition: animated
165
+ }, () => {
166
+ this.scheduleScrollConfiguration();
167
+ const restore = () => {
168
+ this.configureActiveScrollElement();
169
+ this.restorePageOffset(selectedPage);
170
+ };
171
+ if (typeof requestAnimationFrame === "function") {
172
+ requestAnimationFrame(restore);
173
+ } else {
174
+ setTimeout(restore, 0);
175
+ }
176
+ this.props.onPageSelected?.(this.nativeEvent({
177
+ position: selectedPage
178
+ }));
179
+ this.props.onPageScroll?.(this.nativeEvent({
180
+ position: selectedPage,
181
+ offset: 0
182
+ }));
183
+ if (animated) {
184
+ this.props.onPageScrollStateChanged?.(this.nativeEvent({
185
+ pageScrollState: "idle"
186
+ }));
187
+ }
188
+ this.notifyMountedPagesChanged();
189
+ this.emitDiagnostics("page-selected");
190
+ });
191
+ }
192
+ notifyMountedPagesChanged = () => {
193
+ if (!this.props.onMountedPagesChanged) return;
194
+ const pages = this.pages();
195
+ const state = {
196
+ position: this.state.selectedPage,
197
+ mountedPages: this.mountedPages(pages.length),
198
+ pageKeys: pages.map(pageKey)
199
+ };
200
+ const signature = JSON.stringify(state);
201
+ if (signature === this.lastMountSignature) return;
202
+ this.lastMountSignature = signature;
203
+ this.props.onMountedPagesChanged(state);
204
+ };
205
+ emitDiagnostics(reason) {
206
+ const pages = this.pages();
207
+ const retainedPages = this.mountedPages(pages.length);
208
+ this.props.onCollapsibleStateChanged?.(this.nativeEvent({
209
+ position: this.state.selectedPage,
210
+ headerOffset: Math.min(Math.max(this.pageScrollElement(this.state.selectedPage)?.scrollTop ?? 0, 0), Math.max(0, this.props.headerHeight)),
211
+ nativePageCount: pages.length,
212
+ attachedPageCount: retainedPages.length,
213
+ observedScrollableCount: retainedPages.reduce((count, index) => count + (this.pageScrollElement(index) ? 1 : 0), 0),
214
+ retainedPages: JSON.stringify(retainedPages),
215
+ reason
216
+ }));
217
+ }
218
+ onTouchStart = event => {
219
+ if (!this.scrollEnabled) return;
220
+ const touch = event.nativeEvent.touches[0];
221
+ if (!touch) return;
222
+ this.touchStartX = touch.pageX;
223
+ this.touchStartY = touch.pageY;
224
+ this.props.onPageScrollStateChanged?.(this.nativeEvent({
225
+ pageScrollState: "dragging"
226
+ }));
227
+ };
228
+ onTouchEnd = event => {
229
+ if (this.touchStartX == null || !this.scrollEnabled) return;
230
+ const touch = event.nativeEvent.changedTouches[0];
231
+ if (!touch) return;
232
+ const delta = touch.pageX - this.touchStartX;
233
+ const verticalDelta = touch.pageY - (this.touchStartY ?? touch.pageY);
234
+ this.touchStartX = null;
235
+ this.touchStartY = null;
236
+ const rtl = this.props.layoutDirection === "rtl" || !this.props.layoutDirection && I18nManager.isRTL;
237
+ const direction = Math.abs(delta) >= 40 && Math.abs(delta) > Math.abs(verticalDelta) ? delta < 0 ? 1 : -1 : 0;
238
+ const next = this.state.selectedPage + (rtl ? -direction : direction);
239
+ if (direction === 0 || next < 0 || next >= this.pages().length) {
240
+ this.props.onPageScrollStateChanged?.(this.nativeEvent({
241
+ pageScrollState: "idle"
242
+ }));
243
+ return;
244
+ }
245
+ this.selectPage(next, true);
246
+ };
247
+ render() {
248
+ const {
249
+ header,
250
+ stickyHeader,
251
+ style,
252
+ testID,
253
+ accessibilityLabel
254
+ } = this.props;
255
+ const pages = this.pages();
256
+ const keys = pages.map(pageKey);
257
+ const retained = new Set(this.mountedPages(pages.length));
258
+ const pageWidth = pages.length > 0 ? `${100 / pages.length}%` : "100%";
259
+ const collapseAnimation = {
260
+ "--ok-collapsible-header-height": `${Math.max(0, this.props.headerHeight)}px`,
261
+ animationName: COLLAPSE_ANIMATION_NAME,
262
+ animationDuration: "auto",
263
+ animationFillMode: "both",
264
+ animationTimingFunction: "linear",
265
+ animationTimeline: this.timelineName,
266
+ animationRange: `0px ${Math.max(1, this.props.headerHeight)}px`
267
+ };
268
+ const trackStyle = [styles.track, {
269
+ width: `${Math.max(1, pages.length) * 100}%`,
270
+ transform: [{
271
+ translateX: `${-this.state.selectedPage * 100 / Math.max(1, pages.length)}%`
272
+ }],
273
+ transitionProperty: "transform",
274
+ transitionDuration: this.state.animateTransition ? "240ms" : "0ms"
275
+ }];
276
+ return /*#__PURE__*/_jsxs(View, {
277
+ ref: node => {
278
+ this.root = node;
279
+ },
280
+ style: [styles.root, {
281
+ timelineScope: this.timelineName
282
+ }, style],
283
+ testID: testID,
284
+ accessibilityLabel: accessibilityLabel,
285
+ children: [/*#__PURE__*/_jsx(View, {
286
+ style: [styles.header, {
287
+ height: Math.max(0, this.props.headerHeight)
288
+ }, collapseAnimation],
289
+ children: header
290
+ }), /*#__PURE__*/_jsx(View, {
291
+ style: [styles.sticky, {
292
+ top: Math.max(0, this.props.headerHeight),
293
+ height: Math.max(0, this.props.stickyHeaderHeight)
294
+ }, collapseAnimation],
295
+ children: stickyHeader
296
+ }), /*#__PURE__*/_jsx(View, {
297
+ style: trackStyle,
298
+ onTouchStart: this.onTouchStart,
299
+ onTouchEnd: this.onTouchEnd,
300
+ onTouchCancel: () => {
301
+ this.touchStartX = null;
302
+ this.touchStartY = null;
303
+ },
304
+ children: pages.map((page, index) => /*#__PURE__*/_jsx(View, {
305
+ ref: node => {
306
+ if (node) {
307
+ const host = node;
308
+ host.inert = index !== this.state.selectedPage;
309
+ this.pageHosts.set(index, host);
310
+ } else {
311
+ this.pageHosts.delete(index);
312
+ }
313
+ },
314
+ style: [styles.page, {
315
+ width: pageWidth
316
+ }],
317
+ "aria-hidden": index !== this.state.selectedPage,
318
+ children: retained.has(index) ? page : null
319
+ }, keys[index]))
320
+ })]
321
+ });
322
+ }
323
+ }
324
+ const styles = StyleSheet.create({
325
+ root: {
326
+ flex: 1,
327
+ overflow: "hidden",
328
+ position: "relative"
329
+ },
330
+ header: {
331
+ position: "absolute",
332
+ left: 0,
333
+ right: 0,
334
+ top: 0,
335
+ zIndex: 3,
336
+ overflow: "hidden"
337
+ },
338
+ sticky: {
339
+ position: "absolute",
340
+ left: 0,
341
+ right: 0,
342
+ zIndex: 4,
343
+ overflow: "hidden"
344
+ },
345
+ track: {
346
+ position: "absolute",
347
+ inset: 0,
348
+ display: "flex",
349
+ flexDirection: "row",
350
+ alignItems: "stretch",
351
+ touchAction: "pan-y"
352
+ },
353
+ page: {
354
+ flexShrink: 0,
355
+ minWidth: 0,
356
+ minHeight: 0,
357
+ height: "100%",
358
+ display: "flex",
359
+ position: "relative",
360
+ overflowY: "auto",
361
+ overflowX: "hidden"
362
+ }
363
+ });
364
+ //# sourceMappingURL=CollapsiblePagerView.web.js.map
@@ -0,0 +1,85 @@
1
+ import type * as React from "react";
2
+ import {
3
+ codegenNativeCommands,
4
+ codegenNativeComponent,
5
+ type HostComponent,
6
+ type ViewProps,
7
+ } from "react-native";
8
+
9
+ import type {
10
+ DirectEventHandler,
11
+ Double,
12
+ Int32,
13
+ WithDefault,
14
+ } from "react-native/Libraries/Types/CodegenTypes";
15
+
16
+ export type OnPageScrollEventData = Readonly<{
17
+ position: Double;
18
+ offset: Double;
19
+ }>;
20
+
21
+ export type OnPageSelectedEventData = Readonly<{
22
+ position: Double;
23
+ }>;
24
+
25
+ export type OnPageScrollStateChangedEventData = Readonly<{
26
+ pageScrollState: "idle" | "dragging" | "settling";
27
+ }>;
28
+
29
+ export type OnCollapsibleStateChangedEventData = Readonly<{
30
+ position: Int32;
31
+ headerOffset: Double;
32
+ nativePageCount: Int32;
33
+ attachedPageCount: Int32;
34
+ observedScrollableCount: Int32;
35
+ retainedPages: string;
36
+ reason: string;
37
+ }>;
38
+
39
+ /**
40
+ * Internal native props. Consumers should use CollapsiblePagerViewProps from
41
+ * CollapsiblePagerView instead of mounting this host component directly.
42
+ */
43
+ export interface NativeProps extends ViewProps {
44
+ scrollEnabled?: WithDefault<boolean, true>;
45
+ layoutDirection?: WithDefault<"ltr" | "rtl", "ltr">;
46
+ initialPage?: Int32;
47
+ offscreenPageLimit?: Int32;
48
+ headerHeight?: Int32;
49
+ stickyHeaderHeight?: Int32;
50
+ pageKeys?: string;
51
+ retainedPages?: string;
52
+ onPageScroll?: DirectEventHandler<OnPageScrollEventData>;
53
+ onPageSelected?: DirectEventHandler<OnPageSelectedEventData>;
54
+ onPageScrollStateChanged?: DirectEventHandler<OnPageScrollStateChangedEventData>;
55
+ onCollapsibleStateChanged?: DirectEventHandler<OnCollapsibleStateChangedEventData>;
56
+ }
57
+
58
+ type CollapsiblePagerViewNativeType = HostComponent<NativeProps>;
59
+
60
+ export interface NativeCommands {
61
+ setPage: (
62
+ viewRef: React.ElementRef<CollapsiblePagerViewNativeType>,
63
+ selectedPage: Int32
64
+ ) => void;
65
+ setPageWithoutAnimation: (
66
+ viewRef: React.ElementRef<CollapsiblePagerViewNativeType>,
67
+ selectedPage: Int32
68
+ ) => void;
69
+ setScrollEnabledImperatively: (
70
+ viewRef: React.ElementRef<CollapsiblePagerViewNativeType>,
71
+ scrollEnabled: boolean
72
+ ) => void;
73
+ }
74
+
75
+ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
76
+ supportedCommands: [
77
+ "setPage",
78
+ "setPageWithoutAnimation",
79
+ "setScrollEnabledImperatively",
80
+ ],
81
+ });
82
+
83
+ export default codegenNativeComponent<NativeProps>(
84
+ "RNCCollapsiblePagerView"
85
+ ) as HostComponent<NativeProps>;