@applicaster/zapp-react-native-ui-components 14.0.0-alpha.5114565431 → 14.0.0-alpha.5243406255
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/Components/BaseFocusable/index.tsx +25 -12
- package/Components/Cell/index.js +1 -1
- package/Components/ComponentResolver/index.ts +1 -1
- package/Components/FeedLoader/index.js +1 -1
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +42 -59
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +12 -8
- package/Components/Layout/TV/LayoutBackground.tsx +1 -1
- package/Components/MasterCell/DefaultComponents/Button.tsx +1 -1
- package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +1 -1
- package/Components/OfflineHandler/__tests__/index.test.tsx +20 -22
- package/Components/PlayerContainer/ErrorDisplay/index.ts +1 -1
- package/Components/PlayerContainer/ProgramInfo/index.tsx +1 -1
- package/Components/PlayerContainer/index.ts +1 -1
- package/Components/River/RefreshControl.tsx +6 -4
- package/Components/River/index.tsx +1 -1
- package/Components/Screen/__tests__/Screen.test.tsx +23 -12
- package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +3 -6
- package/package.json +5 -5
|
@@ -146,10 +146,14 @@ export class BaseFocusable<
|
|
|
146
146
|
* @param {Object} scrollDirection
|
|
147
147
|
* @returns {Promise}
|
|
148
148
|
*/
|
|
149
|
-
onFocus: FocusManager.FocusEventCB = (
|
|
149
|
+
onFocus: FocusManager.FocusEventCB = (
|
|
150
|
+
focusable,
|
|
151
|
+
scrollDirection,
|
|
152
|
+
context
|
|
153
|
+
) => {
|
|
150
154
|
const { onFocus = noop } = this.props;
|
|
151
155
|
this.setFocusedState(true);
|
|
152
|
-
onFocus(focusable, scrollDirection);
|
|
156
|
+
onFocus(focusable, scrollDirection, context);
|
|
153
157
|
};
|
|
154
158
|
|
|
155
159
|
/**
|
|
@@ -247,8 +251,8 @@ export class BaseFocusable<
|
|
|
247
251
|
* @param {Object} scrollDirection
|
|
248
252
|
* @returns {Promise}
|
|
249
253
|
*/
|
|
250
|
-
focus(_, scrollDirection) {
|
|
251
|
-
return this.onFocus(this, scrollDirection); // invokeComponentMethod(this, "onFocus", scrollDirection);
|
|
254
|
+
focus(_, scrollDirection, context?: FocusManager.FocusContext) {
|
|
255
|
+
return this.onFocus(this, scrollDirection, context); // invokeComponentMethod(this, "onFocus", scrollDirection, context);
|
|
252
256
|
}
|
|
253
257
|
|
|
254
258
|
/**
|
|
@@ -258,9 +262,10 @@ export class BaseFocusable<
|
|
|
258
262
|
*/
|
|
259
263
|
blur(
|
|
260
264
|
_,
|
|
261
|
-
scrollDirection?: FocusManager.Web.Direction | FocusManager.IOS.Direction
|
|
265
|
+
scrollDirection?: FocusManager.Web.Direction | FocusManager.IOS.Direction,
|
|
266
|
+
context?: FocusManager.FocusContext
|
|
262
267
|
) {
|
|
263
|
-
return this.onBlur(this, scrollDirection);
|
|
268
|
+
return this.onBlur(this, scrollDirection, context);
|
|
264
269
|
}
|
|
265
270
|
|
|
266
271
|
/**
|
|
@@ -272,7 +277,7 @@ export class BaseFocusable<
|
|
|
272
277
|
* @param {string} scrollDirection string representation of the direction of the navigation which landed
|
|
273
278
|
* to this item being focused
|
|
274
279
|
*/
|
|
275
|
-
_executeFocusSequence(methodNames, scrollDirection) {
|
|
280
|
+
_executeFocusSequence(methodNames, scrollDirection, context) {
|
|
276
281
|
return R.reduce(
|
|
277
282
|
(sequence, methodName) => {
|
|
278
283
|
const method = this[methodName]; // Access the method by name
|
|
@@ -284,7 +289,9 @@ export class BaseFocusable<
|
|
|
284
289
|
}
|
|
285
290
|
|
|
286
291
|
return sequence
|
|
287
|
-
.then(() =>
|
|
292
|
+
.then(() => {
|
|
293
|
+
return method.call(this, this, scrollDirection, context);
|
|
294
|
+
})
|
|
288
295
|
.catch((e) => {
|
|
289
296
|
throw e; // Re-throw for consistent error handling
|
|
290
297
|
});
|
|
@@ -294,15 +301,21 @@ export class BaseFocusable<
|
|
|
294
301
|
);
|
|
295
302
|
}
|
|
296
303
|
|
|
297
|
-
setFocus(
|
|
304
|
+
setFocus(
|
|
305
|
+
scrollDirection?: ScrollDirection,
|
|
306
|
+
context?: FocusManager.FocusContext
|
|
307
|
+
) {
|
|
298
308
|
const focusMethods = ["willReceiveFocus", "focus", "hasReceivedFocus"];
|
|
299
309
|
|
|
300
|
-
return this._executeFocusSequence(focusMethods, scrollDirection);
|
|
310
|
+
return this._executeFocusSequence(focusMethods, scrollDirection, context);
|
|
301
311
|
}
|
|
302
312
|
|
|
303
|
-
setBlur(
|
|
313
|
+
setBlur(
|
|
314
|
+
scrollDirection?: ScrollDirection,
|
|
315
|
+
context?: FocusManager.FocusContext
|
|
316
|
+
) {
|
|
304
317
|
const blurMethods = ["willLoseFocus", "blur", "hasLostFocus"];
|
|
305
318
|
|
|
306
|
-
return this._executeFocusSequence(blurMethods, scrollDirection);
|
|
319
|
+
return this._executeFocusSequence(blurMethods, scrollDirection, context);
|
|
307
320
|
}
|
|
308
321
|
}
|
package/Components/Cell/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as R from "ramda";
|
|
2
2
|
|
|
3
|
-
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
3
|
+
import { connectToStore } from "@applicaster/zapp-react-native-redux/utils/connectToStore";
|
|
4
4
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
5
5
|
|
|
6
6
|
import {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as R from "ramda";
|
|
2
2
|
|
|
3
|
-
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
3
|
+
import { connectToStore } from "@applicaster/zapp-react-native-redux/utils/connectToStore";
|
|
4
4
|
|
|
5
5
|
import { ComponentResolverComponent } from "./ComponentResolver";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as R from "ramda";
|
|
2
2
|
|
|
3
|
-
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
3
|
+
import { connectToStore } from "@applicaster/zapp-react-native-redux/utils/connectToStore";
|
|
4
4
|
import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
5
5
|
|
|
6
6
|
import { FeedLoaderComponent } from "./FeedLoader";
|
|
@@ -8,13 +8,10 @@ import {
|
|
|
8
8
|
useCurationAPI,
|
|
9
9
|
} from "../useCurationAPI";
|
|
10
10
|
import * as redux from "react-redux";
|
|
11
|
-
import * as layoutPresets from "@applicaster/zapp-react-native-redux/hooks/useLayoutPresets";
|
|
12
|
-
import * as pipesFeeds from "@applicaster/zapp-react-native-redux/hooks/useZappPipesFeeds";
|
|
13
11
|
import { NavigationContext } from "@applicaster/zapp-react-native-ui-components/Contexts/NavigationContext";
|
|
14
12
|
import { PathnameContext } from "@applicaster/zapp-react-native-ui-components/Contexts/PathnameContext";
|
|
15
13
|
|
|
16
|
-
import {
|
|
17
|
-
import configureStore from "redux-mock-store";
|
|
14
|
+
import { WrappedWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
|
|
18
15
|
|
|
19
16
|
jest.mock(
|
|
20
17
|
"@applicaster/zapp-react-native-utils/reactHooks/navigation/useRoute",
|
|
@@ -42,19 +39,20 @@ const mainStackNavigator = {
|
|
|
42
39
|
},
|
|
43
40
|
};
|
|
44
41
|
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
42
|
+
const getWrapper =
|
|
43
|
+
(store) =>
|
|
44
|
+
// eslint-disable-next-line react/display-name, react/prop-types
|
|
45
|
+
({ children }) => (
|
|
46
|
+
<WrappedWithProviders store={store}>
|
|
47
|
+
<NavigationContext.Provider
|
|
48
|
+
value={{ ...mainStackNavigator, currentRoute: homeStack.route }}
|
|
49
|
+
>
|
|
50
|
+
<PathnameContext.Provider value={homeStack.route}>
|
|
51
|
+
{children}
|
|
52
|
+
</PathnameContext.Provider>
|
|
53
|
+
</NavigationContext.Provider>
|
|
54
|
+
</WrappedWithProviders>
|
|
55
|
+
);
|
|
58
56
|
|
|
59
57
|
describe("getTransformedPreset should return the passed components if smartComponents is empty", () => {
|
|
60
58
|
describe("getTransformedPreset function", () => {
|
|
@@ -312,19 +310,10 @@ describe("getTransformedPreset should return the passed components if smartCompo
|
|
|
312
310
|
{ id: "02", component_type: "not_smart_another" },
|
|
313
311
|
];
|
|
314
312
|
|
|
315
|
-
// mock the hooks
|
|
316
|
-
const mockUseZappPipesFeeds = jest.spyOn(pipesFeeds, "useZappPipesFeeds");
|
|
317
|
-
mockUseZappPipesFeeds.mockReturnValue({});
|
|
318
|
-
|
|
319
|
-
const mockUseLayoutPresets = jest.spyOn(
|
|
320
|
-
layoutPresets,
|
|
321
|
-
"useLayoutPresets"
|
|
322
|
-
);
|
|
323
|
-
|
|
324
|
-
mockUseLayoutPresets.mockReturnValue({});
|
|
325
|
-
|
|
326
313
|
const { result } = renderHook(() => useCurationAPI(mockComponents), {
|
|
327
|
-
wrapper
|
|
314
|
+
wrapper: getWrapper({
|
|
315
|
+
zappPipes: {},
|
|
316
|
+
}),
|
|
328
317
|
});
|
|
329
318
|
|
|
330
319
|
// if there are no smart components, it should return the original array
|
|
@@ -366,18 +355,15 @@ describe("getTransformedPreset should return the passed components if smartCompo
|
|
|
366
355
|
"http://curation": { loading: false, data: { entry: mockPresetEntry } },
|
|
367
356
|
};
|
|
368
357
|
|
|
369
|
-
const mockUseZappPipesFeeds = jest.spyOn(pipesFeeds, "useZappPipesFeeds");
|
|
370
|
-
mockUseZappPipesFeeds.mockReturnValue(mockFeeds);
|
|
371
|
-
|
|
372
|
-
const mockUseLayoutPresets = jest.spyOn(
|
|
373
|
-
layoutPresets,
|
|
374
|
-
"useLayoutPresets"
|
|
375
|
-
);
|
|
376
|
-
|
|
377
|
-
mockUseLayoutPresets.mockReturnValue(mockLayoutPresets);
|
|
378
|
-
|
|
379
358
|
const { result } = renderHook(() => useCurationAPI(mockComponents), {
|
|
380
|
-
wrapper
|
|
359
|
+
wrapper: getWrapper({
|
|
360
|
+
zappPipes: mockFeeds,
|
|
361
|
+
presetsMapping: {
|
|
362
|
+
presets_mappings: {
|
|
363
|
+
...mockLayoutPresets,
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
}),
|
|
381
367
|
});
|
|
382
368
|
|
|
383
369
|
expect(result.current).toEqual(mockTransformedComponents);
|
|
@@ -437,19 +423,15 @@ describe("getTransformedPreset should return the passed components if smartCompo
|
|
|
437
423
|
},
|
|
438
424
|
};
|
|
439
425
|
|
|
440
|
-
// mock the hooks
|
|
441
|
-
const mockUseZappPipesFeeds = jest.spyOn(pipesFeeds, "useZappPipesFeeds");
|
|
442
|
-
mockUseZappPipesFeeds.mockReturnValue(mockFeeds);
|
|
443
|
-
|
|
444
|
-
const mockUseLayoutPresets = jest.spyOn(
|
|
445
|
-
layoutPresets,
|
|
446
|
-
"useLayoutPresets"
|
|
447
|
-
);
|
|
448
|
-
|
|
449
|
-
mockUseLayoutPresets.mockReturnValue(mockLayoutPresets);
|
|
450
|
-
|
|
451
426
|
const { result } = renderHook(() => useCurationAPI(mockComponents), {
|
|
452
|
-
wrapper
|
|
427
|
+
wrapper: getWrapper({
|
|
428
|
+
zappPipes: mockFeeds,
|
|
429
|
+
presetsMapping: {
|
|
430
|
+
presets_mappings: {
|
|
431
|
+
...mockLayoutPresets,
|
|
432
|
+
},
|
|
433
|
+
},
|
|
434
|
+
}),
|
|
453
435
|
});
|
|
454
436
|
|
|
455
437
|
expect(result.current).toEqual(mockTransformedComponents);
|
|
@@ -495,14 +477,15 @@ describe("getTransformedPreset should return the passed components if smartCompo
|
|
|
495
477
|
"http://curation": { loading: false, data: { entry: mockPresetEntry } },
|
|
496
478
|
};
|
|
497
479
|
|
|
498
|
-
// mock the hooks
|
|
499
|
-
const mockUseZappPipesFeeds = jest.spyOn(pipesFeeds, "useZappPipesFeeds");
|
|
500
|
-
mockUseZappPipesFeeds.mockReturnValue(mockFeeds);
|
|
501
|
-
const mockUseLayoutPresets = jest.spyOn(layoutPresets, "useLayoutPresets");
|
|
502
|
-
mockUseLayoutPresets.mockReturnValue(mockLayoutPresets);
|
|
503
|
-
|
|
504
480
|
const { result } = renderHook(() => useCurationAPI(mockComponents), {
|
|
505
|
-
wrapper
|
|
481
|
+
wrapper: getWrapper({
|
|
482
|
+
zappPipes: mockFeeds,
|
|
483
|
+
presetsMapping: {
|
|
484
|
+
presets_mappings: {
|
|
485
|
+
...mockLayoutPresets,
|
|
486
|
+
},
|
|
487
|
+
},
|
|
488
|
+
}),
|
|
506
489
|
});
|
|
507
490
|
|
|
508
491
|
expect(result.current).toEqual(mockTransformedComponents);
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { all, equals, path, prop, isEmpty, pluck, values } from "ramda";
|
|
2
2
|
|
|
3
3
|
import { useEffect, useMemo } from "react";
|
|
4
|
-
import { useDispatch } from "react-redux";
|
|
5
4
|
|
|
6
5
|
import {
|
|
6
|
+
ZappPipes,
|
|
7
|
+
useAppDispatch,
|
|
7
8
|
useLayoutPresets,
|
|
8
|
-
|
|
9
|
-
} from "@applicaster/zapp-react-native-redux
|
|
10
|
-
import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
9
|
+
useZappPipesFeed,
|
|
10
|
+
} from "@applicaster/zapp-react-native-redux";
|
|
11
11
|
import { isEmptyOrNil } from "@applicaster/zapp-react-native-utils/cellUtils";
|
|
12
12
|
import { Categories } from "./logger";
|
|
13
13
|
import { createLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
14
14
|
import { useRoute } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useRoute";
|
|
15
|
+
|
|
15
16
|
import {
|
|
16
17
|
ZappPipesEntryContext,
|
|
17
18
|
ZappPipesScreenContext,
|
|
@@ -26,7 +27,10 @@ import {
|
|
|
26
27
|
import { produce } from "immer";
|
|
27
28
|
// types reference
|
|
28
29
|
|
|
29
|
-
declare
|
|
30
|
+
declare interface CurationEntry {
|
|
31
|
+
preset_name: string;
|
|
32
|
+
feed_url: string;
|
|
33
|
+
}
|
|
30
34
|
|
|
31
35
|
type Feeds = Record<string, ZappPipesData>;
|
|
32
36
|
|
|
@@ -122,7 +126,7 @@ export const getFinalComponents = (
|
|
|
122
126
|
export const useCurationAPI = (
|
|
123
127
|
components: Array<ZappUIComponent>
|
|
124
128
|
): ZappUIComponent[] => {
|
|
125
|
-
const dispatch =
|
|
129
|
+
const dispatch = useAppDispatch();
|
|
126
130
|
|
|
127
131
|
const smartComponents = useMemo(
|
|
128
132
|
() => components?.filter?.(isSmartComponent) ?? [],
|
|
@@ -162,7 +166,7 @@ export const useCurationAPI = (
|
|
|
162
166
|
useEffect(() => {
|
|
163
167
|
urls.forEach((url, index) => {
|
|
164
168
|
if (url) {
|
|
165
|
-
dispatch(loadPipesData(url, { clearCache: false }));
|
|
169
|
+
dispatch(ZappPipes.loadPipesData(url, { clearCache: false }));
|
|
166
170
|
} else {
|
|
167
171
|
logger.log_error("Curation url is empty", {
|
|
168
172
|
componentId: smartComponents?.[index]?.id,
|
|
@@ -171,7 +175,7 @@ export const useCurationAPI = (
|
|
|
171
175
|
});
|
|
172
176
|
}, [urls]);
|
|
173
177
|
|
|
174
|
-
const feeds =
|
|
178
|
+
const feeds = useZappPipesFeed(urls);
|
|
175
179
|
const layoutPresets = useLayoutPresets();
|
|
176
180
|
|
|
177
181
|
const enrichedComponents = useMemo(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks
|
|
2
|
+
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
3
3
|
import { getBackgroundImageUrl } from "../utils";
|
|
4
4
|
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
5
5
|
|
|
@@ -4,7 +4,7 @@ import * as R from "ramda";
|
|
|
4
4
|
import { TouchableOpacity } from "react-native";
|
|
5
5
|
// import { SvgUri } from "react-native-svg";
|
|
6
6
|
|
|
7
|
-
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
7
|
+
import { connectToStore } from "@applicaster/zapp-react-native-redux/utils/connectToStore";
|
|
8
8
|
import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
|
|
9
9
|
|
|
10
10
|
import Image from "./Image";
|
|
@@ -19,29 +19,27 @@ jest.mock("@applicaster/zapp-react-native-utils/reactHooks/utils", () => {
|
|
|
19
19
|
};
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
jest.mock(
|
|
23
|
-
"@applicaster/zapp-react-native-redux/hooks
|
|
24
|
-
() => ({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}),
|
|
39
|
-
},
|
|
22
|
+
jest.mock("@applicaster/zapp-react-native-redux/hooks", () => ({
|
|
23
|
+
...jest.requireActual("@applicaster/zapp-react-native-redux/hooks"),
|
|
24
|
+
usePickFromState: () => ({
|
|
25
|
+
plugins: [
|
|
26
|
+
{
|
|
27
|
+
name: "offline experience",
|
|
28
|
+
identifier: "offline-experience",
|
|
29
|
+
type: "general",
|
|
30
|
+
module: {
|
|
31
|
+
useOfflineExperienceConfiguration: () => ({
|
|
32
|
+
configurationFields: {},
|
|
33
|
+
localizations: {
|
|
34
|
+
offline_toast_message: "No internet connection",
|
|
35
|
+
online_toast_message: "You are back online",
|
|
36
|
+
},
|
|
37
|
+
}),
|
|
40
38
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
})
|
|
44
|
-
);
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
}),
|
|
42
|
+
}));
|
|
45
43
|
|
|
46
44
|
jest.mock("react-native-safe-area-context", () => ({
|
|
47
45
|
useSafeAreaInsets: () => ({ top: 44 }),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
1
|
+
import { connectToStore } from "@applicaster/zapp-react-native-redux/utils/connectToStore";
|
|
2
2
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
3
3
|
import { styleKeys } from "@applicaster/zapp-react-native-utils/styleKeysUtils";
|
|
4
4
|
import { transformColorCode as fixColorHexCode } from "@applicaster/zapp-react-native-utils/transform";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as R from "ramda";
|
|
2
2
|
|
|
3
|
-
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
3
|
+
import { connectToStore } from "@applicaster/zapp-react-native-redux/utils/connectToStore";
|
|
4
4
|
import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
5
5
|
|
|
6
6
|
import { PlayerContainer as PlayerContainerComponent } from "./PlayerContainer";
|
|
@@ -10,11 +10,13 @@ import { useLocalizedStrings } from "@applicaster/zapp-react-native-utils/locali
|
|
|
10
10
|
import { useAnalytics } from "@applicaster/zapp-react-native-utils/analyticsUtils";
|
|
11
11
|
import { useSendAnalyticsEventWithFunction } from "@applicaster/zapp-react-native-utils/analyticsUtils/helpers/hooks";
|
|
12
12
|
import { useCurrentScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useCurrentScreenData";
|
|
13
|
-
import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
14
|
-
import { useDispatch } from "react-redux";
|
|
15
13
|
import { useShallow } from "zustand/react/shallow";
|
|
16
14
|
import { useScreenContextV2 } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
|
|
17
15
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
16
|
+
import {
|
|
17
|
+
ZappPipes,
|
|
18
|
+
useAppDispatch,
|
|
19
|
+
} from "@applicaster/zapp-react-native-redux";
|
|
18
20
|
|
|
19
21
|
const BRIGHTNESS_THRESHOLD = 160;
|
|
20
22
|
const ABOVE_DEFAULT_COLOR = "gray";
|
|
@@ -61,7 +63,7 @@ export const usePullToRefresh = (
|
|
|
61
63
|
) => {
|
|
62
64
|
const isPipesV1 = !!pullToRefreshPipesV1RefreshingStateUpdater;
|
|
63
65
|
|
|
64
|
-
const dispatch =
|
|
66
|
+
const dispatch = useAppDispatch();
|
|
65
67
|
|
|
66
68
|
const [refreshing, setRefreshing] = React.useState(false);
|
|
67
69
|
|
|
@@ -81,7 +83,7 @@ export const usePullToRefresh = (
|
|
|
81
83
|
if (refreshing && !isPipesV1) {
|
|
82
84
|
feeds.forEach((feed) => {
|
|
83
85
|
dispatch(
|
|
84
|
-
loadPipesData(feed, {
|
|
86
|
+
ZappPipes.loadPipesData(feed, {
|
|
85
87
|
silentRefresh: true,
|
|
86
88
|
clearCache: true,
|
|
87
89
|
callback: () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as R from "ramda";
|
|
2
|
-
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
2
|
+
import { connectToStore } from "@applicaster/zapp-react-native-redux/utils/connectToStore";
|
|
3
3
|
|
|
4
4
|
import { withRiver } from "../../Decorators/RiverResolver";
|
|
5
5
|
import { withNavigator } from "../../Decorators/Navigator";
|
|
@@ -68,12 +68,33 @@ jest.mock(
|
|
|
68
68
|
})
|
|
69
69
|
);
|
|
70
70
|
|
|
71
|
+
jest.mock(
|
|
72
|
+
"@applicaster/zapp-react-native-utils/reactHooks/state/useRivers",
|
|
73
|
+
() => ({
|
|
74
|
+
useRivers: jest.fn(() => ({
|
|
75
|
+
rivers: [{ id: "testId", name: "Test River" }],
|
|
76
|
+
})),
|
|
77
|
+
})
|
|
78
|
+
);
|
|
79
|
+
|
|
71
80
|
jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation", () => ({
|
|
72
81
|
isNavBarVisible: mockIsNavBarVisible,
|
|
73
82
|
useIsScreenActive: jest.fn().mockReturnValue(true),
|
|
83
|
+
useNavigation: jest.fn(() => ({
|
|
84
|
+
canGoBack: () => false,
|
|
85
|
+
currentRoute: "/river/testId",
|
|
86
|
+
activeRiver: { id: "testId" },
|
|
87
|
+
screenData: { id: "testId" },
|
|
88
|
+
data: { screen: { id: "testId" } },
|
|
89
|
+
})),
|
|
90
|
+
useRoute: jest.fn(() => ({
|
|
91
|
+
pathname: "/river/testId",
|
|
92
|
+
screenData: { id: "testId" },
|
|
93
|
+
})),
|
|
74
94
|
}));
|
|
75
95
|
|
|
76
96
|
jest.mock("@applicaster/zapp-react-native-utils/reactHooks", () => ({
|
|
97
|
+
...jest.requireActual("@applicaster/zapp-react-native-utils/reactHooks"),
|
|
77
98
|
useCurrentScreenData: jest.fn(() => ({
|
|
78
99
|
id: "testId",
|
|
79
100
|
})),
|
|
@@ -84,17 +105,6 @@ jest.mock("@applicaster/zapp-react-native-utils/reactHooks", () => ({
|
|
|
84
105
|
id: "testId",
|
|
85
106
|
navigations: [{ id: "testId", category: "nav_bar" }],
|
|
86
107
|
})),
|
|
87
|
-
useNavigation: jest.fn(() => ({
|
|
88
|
-
canGoBack: () => false,
|
|
89
|
-
currentRoute: "/river/testId",
|
|
90
|
-
activeRiver: { id: "testId" },
|
|
91
|
-
screenData: { id: "testId" },
|
|
92
|
-
data: { screen: { id: "testId" } },
|
|
93
|
-
})),
|
|
94
|
-
useRoute: jest.fn(() => ({
|
|
95
|
-
pathname: "/river/testId",
|
|
96
|
-
screenData: { id: "testId" },
|
|
97
|
-
})),
|
|
98
108
|
useDimensions: jest.fn(() => ({
|
|
99
109
|
width: 1920,
|
|
100
110
|
height: 1080,
|
|
@@ -102,10 +112,11 @@ jest.mock("@applicaster/zapp-react-native-utils/reactHooks", () => ({
|
|
|
102
112
|
useIsTablet: jest.fn(() => false),
|
|
103
113
|
}));
|
|
104
114
|
|
|
105
|
-
jest.mock("@applicaster/zapp-react-native-redux/hooks
|
|
115
|
+
jest.mock("@applicaster/zapp-react-native-redux/hooks", () => {
|
|
106
116
|
const View = jest.requireActual("react-native").View;
|
|
107
117
|
|
|
108
118
|
return {
|
|
119
|
+
...jest.requireActual("@applicaster/zapp-react-native-redux/hooks"),
|
|
109
120
|
usePickFromState: () => ({
|
|
110
121
|
plugins: [
|
|
111
122
|
{
|
|
@@ -13,12 +13,9 @@ const rivers = {
|
|
|
13
13
|
},
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
jest.doMock(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
usePickFromState: jest.fn(() => ({ rivers })),
|
|
20
|
-
})
|
|
21
|
-
);
|
|
16
|
+
jest.doMock("@applicaster/zapp-react-native-redux/hooks", () => ({
|
|
17
|
+
usePickFromState: jest.fn(() => ({ rivers })),
|
|
18
|
+
}));
|
|
22
19
|
|
|
23
20
|
jest.doMock(
|
|
24
21
|
"@applicaster/zapp-react-native-utils/reactHooks/navigation/usePathname",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "14.0.0-alpha.
|
|
3
|
+
"version": "14.0.0-alpha.5243406255",
|
|
4
4
|
"description": "Applicaster Zapp React Native ui components for the Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "14.0.0-alpha.
|
|
32
|
-
"@applicaster/zapp-react-native-bridge": "14.0.0-alpha.
|
|
33
|
-
"@applicaster/zapp-react-native-redux": "14.0.0-alpha.
|
|
34
|
-
"@applicaster/zapp-react-native-utils": "14.0.0-alpha.
|
|
31
|
+
"@applicaster/applicaster-types": "14.0.0-alpha.5243406255",
|
|
32
|
+
"@applicaster/zapp-react-native-bridge": "14.0.0-alpha.5243406255",
|
|
33
|
+
"@applicaster/zapp-react-native-redux": "14.0.0-alpha.5243406255",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "14.0.0-alpha.5243406255",
|
|
35
35
|
"promise": "^8.3.0",
|
|
36
36
|
"url": "^0.11.0",
|
|
37
37
|
"uuid": "^3.3.2"
|