@nativescript-community/ui-refreshlayout 0.0.0-stage → 1.0.0

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.
package/index.ios.d.ts ADDED
@@ -0,0 +1,49 @@
1
+ import { RefreshLayoutBase, bottomEnabledProperty, bottomRefreshingProperty, indicatorColorProperty, indicatorFillColorProperty, refreshingProperty, topEnabledProperty } from './index-common';
2
+ export * from './index-common';
3
+ /**
4
+ * iOS: the scroll view has two edges: the start of its content (UIRefreshControl) and the end (a spinner under the last item, pulled by the user).
5
+ * The visual top/bottom are mapped to them: with a reversed content (CollectionView `reverseLayout` rotates the scroll view) the top is the end.
6
+ */
7
+ export declare class RefreshLayout extends RefreshLayoutBase {
8
+ [refreshingProperty.setNative]: (value: boolean) => void;
9
+ [bottomRefreshingProperty.setNative]: (value: boolean) => void;
10
+ [topEnabledProperty.setNative]: (value: boolean) => void;
11
+ [bottomEnabledProperty.setNative]: (value: boolean) => void;
12
+ [indicatorColorProperty.getDefault]: () => UIColor;
13
+ [indicatorColorProperty.setNative]: (value: any) => void;
14
+ [indicatorFillColorProperty.getDefault]: () => UIColor;
15
+ [indicatorFillColorProperty.setNative]: (value: any) => void;
16
+ private mRefreshControl;
17
+ private mHandler;
18
+ private mPanHandler;
19
+ private mScrollView;
20
+ private mFooter;
21
+ private mObserving;
22
+ private mEndRefreshing;
23
+ private mEndInset;
24
+ private mReversed;
25
+ constructor();
26
+ get refreshControl(): UIRefreshControl;
27
+ onLoaded(): void;
28
+ onUnloaded(): void;
29
+ _onContentChanged(oldView: any, newView: any): void;
30
+ /** the visual edge at the start of the scrolling */
31
+ private get startIsTop();
32
+ private get startEnabled();
33
+ private get endEnabled();
34
+ /** the pull at the start is the top refresh, else the bottom one */
35
+ _onStartEdgeRefresh(): void;
36
+ private setup;
37
+ private teardown;
38
+ private applyStartEdge;
39
+ private syncRefreshingState;
40
+ private setStartRefreshing;
41
+ /** distance the user pulled beyond the end of the content */
42
+ private get endOverscroll();
43
+ /** the end of the scrolling is at the visual bottom, or at the visual top when the content is reversed */
44
+ private layoutFooter;
45
+ onLayout(left: number, top: number, right: number, bottom: number): void;
46
+ _onPan(state: UIGestureRecognizerState): void;
47
+ private onPan;
48
+ private setEndRefreshing;
49
+ }
package/index.ios.js ADDED
@@ -0,0 +1,339 @@
1
+ import { Trace } from '@nativescript/core';
2
+ import { RefreshLayoutBase, bottomEnabledProperty, bottomRefreshingProperty, indicatorColorProperty, indicatorFillColorProperty, refreshingProperty, topEnabledProperty } from './index-common';
3
+ export * from './index-common';
4
+ const TRIGGER = 70;
5
+ const FOOTER_HEIGHT = 56;
6
+ var RefreshHandler = /** @class */ (function (_super) {
7
+ __extends(RefreshHandler, _super);
8
+ function RefreshHandler() {
9
+ return _super !== null && _super.apply(this, arguments) || this;
10
+ }
11
+ RefreshHandler.initWithOwner = function (owner) {
12
+ var handler = RefreshHandler.new();
13
+ handler._owner = new WeakRef(owner);
14
+ return handler;
15
+ };
16
+ RefreshHandler.prototype.handleRefresh = function () {
17
+ var _a;
18
+ (_a = this._owner.get()) === null || _a === void 0 ? void 0 : _a._onStartEdgeRefresh();
19
+ };
20
+ RefreshHandler.ObjCExposedMethods = {
21
+ handleRefresh: { returns: interop.types.void, params: [] }
22
+ };
23
+ return RefreshHandler;
24
+ }(NSObject));
25
+ var PanHandler = /** @class */ (function (_super) {
26
+ __extends(PanHandler, _super);
27
+ function PanHandler() {
28
+ return _super !== null && _super.apply(this, arguments) || this;
29
+ }
30
+ PanHandler.initWithOwner = function (owner) {
31
+ var handler = PanHandler.new();
32
+ handler._owner = new WeakRef(owner);
33
+ return handler;
34
+ };
35
+ PanHandler.prototype.handlePan = function (recognizer) {
36
+ var _a, _b;
37
+ (_b = (_a = this._owner) === null || _a === void 0 ? void 0 : _a.get()) === null || _b === void 0 ? void 0 : _b._onPan(recognizer.state);
38
+ };
39
+ PanHandler.ObjCExposedMethods = {
40
+ handlePan: { returns: interop.types.void, params: [UIPanGestureRecognizer] }
41
+ };
42
+ return PanHandler;
43
+ }(NSObject));
44
+ const edgeInsets = (top, left, bottom, right) => ({ top, left, bottom, right });
45
+ function findScrollView(view) {
46
+ if (view instanceof UIScrollView) {
47
+ return view;
48
+ }
49
+ // WKWebView
50
+ const webScrollView = view.scrollView;
51
+ if (webScrollView instanceof UIScrollView) {
52
+ return webScrollView;
53
+ }
54
+ for (let i = 0; i < view.subviews.count; i++) {
55
+ const found = findScrollView(view.subviews.objectAtIndex(i));
56
+ if (found) {
57
+ return found;
58
+ }
59
+ }
60
+ return null;
61
+ }
62
+ /**
63
+ * iOS: the scroll view has two edges: the start of its content (UIRefreshControl) and the end (a spinner under the last item, pulled by the user).
64
+ * The visual top/bottom are mapped to them: with a reversed content (CollectionView `reverseLayout` rotates the scroll view) the top is the end.
65
+ */
66
+ export class RefreshLayout extends RefreshLayoutBase {
67
+ constructor() {
68
+ super();
69
+ this.mObserving = false;
70
+ this.mEndRefreshing = false;
71
+ this.mEndInset = 0;
72
+ this.mReversed = false;
73
+ this.mRefreshControl = UIRefreshControl.new();
74
+ this.mHandler = RefreshHandler.initWithOwner(this);
75
+ this.mRefreshControl.addTargetActionForControlEvents(this.mHandler, 'handleRefresh', 4096 /* UIControlEvents.ValueChanged */);
76
+ this.mPanHandler = PanHandler.initWithOwner(this);
77
+ }
78
+ get refreshControl() {
79
+ return this.mRefreshControl;
80
+ }
81
+ onLoaded() {
82
+ super.onLoaded();
83
+ try {
84
+ this.setup();
85
+ }
86
+ catch (error) {
87
+ Trace.write(`RefreshLayout error: ${error?.stack || error}`, Trace.categories.Error, Trace.messageType.error);
88
+ console.log('RefreshLayout error ' + (error?.stack || error));
89
+ }
90
+ }
91
+ onUnloaded() {
92
+ this.teardown();
93
+ super.onUnloaded();
94
+ }
95
+ _onContentChanged(oldView, newView) {
96
+ super['_onContentChanged']?.(oldView, newView);
97
+ if (this.isLoaded) {
98
+ this.teardown();
99
+ this.setup();
100
+ }
101
+ }
102
+ // ---- visual edges <-> scroll edges
103
+ /** the visual edge at the start of the scrolling */
104
+ get startIsTop() {
105
+ return !this.mReversed;
106
+ }
107
+ get startEnabled() {
108
+ return this.startIsTop ? this.topEnabled !== false : this.bottomEnabled === true;
109
+ }
110
+ get endEnabled() {
111
+ return this.startIsTop ? this.bottomEnabled === true : this.topEnabled !== false;
112
+ }
113
+ /** the pull at the start is the top refresh, else the bottom one */
114
+ _onStartEdgeRefresh() {
115
+ const bottom = !this.startIsTop;
116
+ if (bottom) {
117
+ this.bottomRefreshing = true;
118
+ }
119
+ else {
120
+ this.refreshing = true;
121
+ }
122
+ this.notifyRefresh(bottom);
123
+ }
124
+ setup() {
125
+ const native = this.content?.nativeViewProtected;
126
+ const scrollView = native ? findScrollView(native) : null;
127
+ if (!scrollView) {
128
+ return;
129
+ }
130
+ this.mScrollView = scrollView;
131
+ this.mReversed = this.contentReversed;
132
+ this.applyStartEdge();
133
+ // the end edge
134
+ this.mFooter = UIActivityIndicatorView.alloc().initWithActivityIndicatorStyle(100 /* UIActivityIndicatorViewStyle.Medium */);
135
+ this.mFooter.hidesWhenStopped = false;
136
+ this.mFooter.alpha = 0;
137
+ const color = this.style.indicatorColor;
138
+ if (color) {
139
+ this.mFooter.color = color.ios;
140
+ }
141
+ // behind the scroll view, at the visual edge: revealed when the content is pulled away
142
+ this.nativeViewProtected.insertSubviewAtIndex(this.mFooter, 0);
143
+ scrollView.panGestureRecognizer.addTargetAction(this.mPanHandler, 'handlePan');
144
+ this.mObserving = true;
145
+ this.layoutFooter();
146
+ if (this.refreshing || this.bottomRefreshing) {
147
+ this.syncRefreshingState();
148
+ }
149
+ }
150
+ teardown() {
151
+ const scrollView = this.mScrollView;
152
+ if (scrollView) {
153
+ if (this.mObserving) {
154
+ scrollView.panGestureRecognizer.removeTargetAction(this.mPanHandler, 'handlePan');
155
+ this.mObserving = false;
156
+ }
157
+ if (scrollView.refreshControl === this.mRefreshControl) {
158
+ scrollView.refreshControl = null;
159
+ }
160
+ this.mFooter?.removeFromSuperview();
161
+ }
162
+ this.mFooter = null;
163
+ this.mScrollView = null;
164
+ this.mEndRefreshing = false;
165
+ this.mEndInset = 0;
166
+ }
167
+ applyStartEdge() {
168
+ const scrollView = this.mScrollView;
169
+ if (!scrollView) {
170
+ return;
171
+ }
172
+ if (this.startEnabled) {
173
+ if (scrollView.refreshControl !== this.mRefreshControl) {
174
+ scrollView.refreshControl = this.mRefreshControl;
175
+ }
176
+ }
177
+ else if (scrollView.refreshControl === this.mRefreshControl) {
178
+ scrollView.refreshControl = null;
179
+ }
180
+ }
181
+ syncRefreshingState() {
182
+ const startRefreshing = this.startIsTop ? this.refreshing : this.bottomRefreshing;
183
+ const endRefreshing = this.startIsTop ? this.bottomRefreshing : this.refreshing;
184
+ if (this.startEnabled) {
185
+ this.setStartRefreshing(startRefreshing);
186
+ }
187
+ this.setEndRefreshing(endRefreshing && this.endEnabled);
188
+ }
189
+ setStartRefreshing(value) {
190
+ if (value) {
191
+ if (!this.mRefreshControl.refreshing) {
192
+ this.mRefreshControl.beginRefreshing();
193
+ const scrollView = this.mScrollView;
194
+ if (scrollView) {
195
+ scrollView.setContentOffsetAnimated(CGPointMake(0, -(scrollView.adjustedContentInset.top + this.mRefreshControl.frame.size.height)), true);
196
+ }
197
+ }
198
+ }
199
+ else if (this.mRefreshControl.refreshing) {
200
+ this.mRefreshControl.endRefreshing();
201
+ }
202
+ }
203
+ // ---- end of the content
204
+ /** distance the user pulled beyond the end of the content */
205
+ get endOverscroll() {
206
+ const scrollView = this.mScrollView;
207
+ const inset = scrollView.adjustedContentInset;
208
+ const endOffset = Math.max(scrollView.contentSize.height + inset.bottom - this.mEndInset - scrollView.bounds.size.height, -inset.top);
209
+ return scrollView.contentOffset.y - endOffset;
210
+ }
211
+ /** the end of the scrolling is at the visual bottom, or at the visual top when the content is reversed */
212
+ layoutFooter() {
213
+ const container = this.nativeViewProtected;
214
+ if (!container || !this.mFooter) {
215
+ return;
216
+ }
217
+ const { width, height } = container.bounds.size;
218
+ this.mFooter.frame = CGRectMake(0, this.startIsTop ? height - FOOTER_HEIGHT : 0, width, FOOTER_HEIGHT);
219
+ }
220
+ onLayout(left, top, right, bottom) {
221
+ super.onLayout(left, top, right, bottom);
222
+ // after the frame of the container is set
223
+ setTimeout(() => this.layoutFooter(), 0);
224
+ }
225
+ _onPan(state) {
226
+ try {
227
+ this.onPan(state);
228
+ }
229
+ catch (error) {
230
+ console.log('RefreshLayout error ' + (error?.stack || error));
231
+ }
232
+ }
233
+ onPan(state) {
234
+ const scrollView = this.mScrollView;
235
+ if (!scrollView || !this.endEnabled || this.mEndRefreshing) {
236
+ return;
237
+ }
238
+ const overscroll = this.endOverscroll;
239
+ if (state === 1 /* UIGestureRecognizerState.Began */ || state === 2 /* UIGestureRecognizerState.Changed */) {
240
+ const progress = Math.max(0, Math.min(1, overscroll / TRIGGER));
241
+ this.mFooter.alpha = progress;
242
+ if (progress > 0 && !this.mFooter.animating) {
243
+ this.mFooter.startAnimating();
244
+ }
245
+ else if (progress === 0 && this.mFooter.animating) {
246
+ this.mFooter.stopAnimating();
247
+ }
248
+ }
249
+ else if (state === 3 /* UIGestureRecognizerState.Ended */ || state === 4 /* UIGestureRecognizerState.Cancelled */ || state === 5 /* UIGestureRecognizerState.Failed */) {
250
+ if (overscroll >= TRIGGER) {
251
+ this.setEndRefreshing(true);
252
+ const bottom = this.startIsTop;
253
+ if (bottom) {
254
+ this.bottomRefreshing = true;
255
+ }
256
+ else {
257
+ this.refreshing = true;
258
+ }
259
+ this.notifyRefresh(bottom);
260
+ }
261
+ else {
262
+ this.mFooter.alpha = 0;
263
+ this.mFooter.stopAnimating();
264
+ }
265
+ }
266
+ }
267
+ setEndRefreshing(value) {
268
+ const scrollView = this.mScrollView;
269
+ if (!scrollView || !this.mFooter || value === this.mEndRefreshing) {
270
+ return;
271
+ }
272
+ this.mEndRefreshing = value;
273
+ if (value) {
274
+ this.mFooter.alpha = 1;
275
+ this.mFooter.startAnimating();
276
+ this.mEndInset = FOOTER_HEIGHT;
277
+ const inset = scrollView.contentInset;
278
+ UIView.animateWithDurationAnimations(0.25, () => {
279
+ scrollView.contentInset = edgeInsets(inset.top, inset.left, inset.bottom + FOOTER_HEIGHT, inset.right);
280
+ });
281
+ }
282
+ else {
283
+ const inset = scrollView.contentInset;
284
+ const extra = this.mEndInset;
285
+ this.mEndInset = 0;
286
+ UIView.animateWithDurationAnimationsCompletion(0.25, () => {
287
+ scrollView.contentInset = edgeInsets(inset.top, inset.left, Math.max(0, inset.bottom - extra), inset.right);
288
+ this.mFooter.alpha = 0;
289
+ }, () => this.mFooter?.stopAnimating());
290
+ }
291
+ this.layoutFooter();
292
+ }
293
+ // ---- properties
294
+ [refreshingProperty.setNative](value) {
295
+ if (!this.mScrollView) {
296
+ return;
297
+ }
298
+ if (this.startIsTop) {
299
+ this.startEnabled && this.setStartRefreshing(!!value);
300
+ }
301
+ else {
302
+ this.setEndRefreshing(!!value && this.endEnabled);
303
+ }
304
+ }
305
+ [bottomRefreshingProperty.setNative](value) {
306
+ if (!this.mScrollView) {
307
+ return;
308
+ }
309
+ if (this.startIsTop) {
310
+ this.setEndRefreshing(!!value && this.endEnabled);
311
+ }
312
+ else {
313
+ this.startEnabled && this.setStartRefreshing(!!value);
314
+ }
315
+ }
316
+ [topEnabledProperty.setNative](value) {
317
+ this.applyStartEdge();
318
+ }
319
+ [bottomEnabledProperty.setNative](value) {
320
+ this.applyStartEdge();
321
+ }
322
+ [indicatorColorProperty.getDefault]() {
323
+ return this.mRefreshControl.tintColor;
324
+ }
325
+ [indicatorColorProperty.setNative](value) {
326
+ const color = value ? value.ios : null;
327
+ this.mRefreshControl.tintColor = color;
328
+ if (this.mFooter) {
329
+ this.mFooter.color = color;
330
+ }
331
+ }
332
+ [indicatorFillColorProperty.getDefault]() {
333
+ return this.mRefreshControl.backgroundColor;
334
+ }
335
+ [indicatorFillColorProperty.setNative](value) {
336
+ this.mRefreshControl.backgroundColor = value ? value.ios : null;
337
+ }
338
+ }
339
+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}
package/package.json CHANGED
@@ -1,6 +1,50 @@
1
1
  {
2
- "name": "@nativescript-community/ui-refreshlayout",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@nativescript-community/ui-refreshlayout",
3
+ "version": "1.0.0",
4
+ "description": "Pull to refresh at the top and the bottom of a scrollable view: SwipeRefreshLayout on Android, UIRefreshControl on iOS. Made for CollectionView and chat UX.",
5
+ "main": "./index",
6
+ "sideEffects": false,
7
+ "typings": "./index.d.ts",
8
+ "scripts": {
9
+ "tsc": "cpy '**/*.d.ts' '../../packages/ui-refreshlayout' --parents --cwd=../../src/ui-refreshlayout && tsc --build",
10
+ "readme": "readme generate -c ../../tools/readme/blueprint.json",
11
+ "build": "npm run tsc && npm run readme",
12
+ "build.watch": "npm run tsc -- -w",
13
+ "build.all": "npm run build",
14
+ "clean": "bin/rimraf ./*.d.ts ./*.js ./*.js.map ./*.tsbuildinfo ./*.mjs ./*.mjs.map ./angular ./svelte ./vue* ./react"
15
+ },
16
+ "nativescript": {
17
+ "platforms": {
18
+ "android": "6.2.0",
19
+ "ios": "6.2.0"
20
+ }
21
+ },
22
+ "keywords": [
23
+ "NativeScript",
24
+ "JavaScript",
25
+ "Android",
26
+ "iOS"
27
+ ],
28
+ "author": {
29
+ "name": "Martin Guillon",
30
+ "email": "martin@akylas.fr"
31
+ },
32
+ "bugs": {
33
+ "url": "https://github.com/nativescript-community/ui-native-components/issues"
34
+ },
35
+ "license": "Apache-2.0",
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "homepage": "https://github.com/nativescript-community/ui-native-components/tree/master/packages/ui-refreshlayout#readme",
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "https://github.com/nativescript-community/ui-native-components.git",
43
+ "directory": "packages/ui-refreshlayout"
44
+ },
45
+ "readmeFilename": "README.md",
46
+ "dependencies": {
47
+ "@nativescript-community/ui-core": "^1.0.0"
48
+ },
49
+ "gitHead": "237dd97d2b9e0f62ea9d9810169bb800dd531f7b"
50
+ }
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.nativescript.ui.refreshlayout"/>
@@ -0,0 +1,4 @@
1
+ dependencies {
2
+ def androidxSwipeRefreshLayoutVersion = project.hasProperty("androidxSwipeRefreshLayoutVersion") ? project.androidxSwipeRefreshLayoutVersion : "1.1.0"
3
+ implementation "androidx.swiperefreshlayout:swiperefreshlayout:$androidxSwipeRefreshLayoutVersion"
4
+ }