@applicaster/zapp-react-native-ui-components 14.0.10-alpha.4515005205 → 14.0.10-alpha.7235445407
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/GeneralContentScreen/GeneralContentScreen.tsx +2 -0
- package/Components/River/ComponentsMap/ComponentsMap.tsx +14 -0
- package/Components/River/River.tsx +4 -0
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +1 -0
- package/Components/Tabs/TabContent.tsx +3 -0
- package/events/index.ts +3 -0
- package/events/scrollEndReached.ts +10 -0
- package/index.d.ts +1 -0
- package/package.json +5 -5
|
@@ -33,6 +33,7 @@ export const GeneralContentScreen = ({
|
|
|
33
33
|
parentFocus,
|
|
34
34
|
containerHeight,
|
|
35
35
|
preferredFocus = false,
|
|
36
|
+
isScreenWrappedInScrollView = false,
|
|
36
37
|
}: GeneralContentScreenProps) => {
|
|
37
38
|
const screenData = useScreenData(screenId);
|
|
38
39
|
|
|
@@ -119,6 +120,7 @@ export const GeneralContentScreen = ({
|
|
|
119
120
|
getStaticComponentFeed={getStaticComponentFeed}
|
|
120
121
|
extraAnchorPointYOffset={extraAnchorPointYOffset}
|
|
121
122
|
isScreenWrappedInContainer={isScreenWrappedInContainer}
|
|
123
|
+
isScreenWrappedInScrollView={isScreenWrappedInScrollView}
|
|
122
124
|
parentFocus={parentFocus}
|
|
123
125
|
focused={focused}
|
|
124
126
|
containerHeight={containerHeight}
|
|
@@ -23,6 +23,7 @@ import { isLast } from "@applicaster/zapp-react-native-utils/arrayUtils";
|
|
|
23
23
|
import { withComponentsMapProvider } from "@applicaster/zapp-react-native-ui-components/Decorators/ComponentsMapWrapper";
|
|
24
24
|
import { useScreenContextV2 } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
|
|
25
25
|
import { useShallow } from "zustand/react/shallow";
|
|
26
|
+
import { emitScrollEndReached } from "@applicaster/zapp-react-native-ui-components/events";
|
|
26
27
|
|
|
27
28
|
import { isAndroidPlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
28
29
|
import { ComponentsMapHeightContext } from "./ContextProviders/ComponentsMapHeightContext";
|
|
@@ -41,6 +42,7 @@ type Props = {
|
|
|
41
42
|
pullToRefreshPipesV1RefreshingStateUpdater: () => boolean;
|
|
42
43
|
refreshingPipesV1?: boolean;
|
|
43
44
|
stickyHeaderIndices?: number[];
|
|
45
|
+
isScreenWrappedInScrollView?: boolean;
|
|
44
46
|
};
|
|
45
47
|
|
|
46
48
|
const styles = StyleSheet.create({
|
|
@@ -60,6 +62,7 @@ function ComponentsMapComponent(props: Props) {
|
|
|
60
62
|
riverComponents: components,
|
|
61
63
|
scrollViewExtraProps,
|
|
62
64
|
isScreenWrappedInContainer,
|
|
65
|
+
isScreenWrappedInScrollView = false,
|
|
63
66
|
feed,
|
|
64
67
|
groupId,
|
|
65
68
|
riverId,
|
|
@@ -73,6 +76,7 @@ function ComponentsMapComponent(props: Props) {
|
|
|
73
76
|
|
|
74
77
|
const flatListRef = React.useRef<FlatList | null>(null);
|
|
75
78
|
const flatListWrapperRef = React.useRef<View | null>(null);
|
|
79
|
+
const hasUserScrolledRef = React.useRef(false);
|
|
76
80
|
const screenConfig = useScreenConfiguration(riverId);
|
|
77
81
|
const screenData = useScreenData(riverId);
|
|
78
82
|
const pullToRefreshEnabled = screenData?.rules?.pull_to_refresh_enabled;
|
|
@@ -236,6 +240,8 @@ function ComponentsMapComponent(props: Props) {
|
|
|
236
240
|
}, []);
|
|
237
241
|
|
|
238
242
|
const onScroll = React.useCallback((event) => {
|
|
243
|
+
hasUserScrolledRef.current = true;
|
|
244
|
+
|
|
239
245
|
const {
|
|
240
246
|
nativeEvent: {
|
|
241
247
|
contentOffset: { y },
|
|
@@ -308,6 +314,14 @@ function ComponentsMapComponent(props: Props) {
|
|
|
308
314
|
onScrollEndDrag={_onScrollEndDrag}
|
|
309
315
|
scrollEventThrottle={16}
|
|
310
316
|
{...scrollViewExtraProps}
|
|
317
|
+
onEndReached={
|
|
318
|
+
isScreenWrappedInScrollView
|
|
319
|
+
? undefined
|
|
320
|
+
: () => {
|
|
321
|
+
if (!hasUserScrolledRef.current) return;
|
|
322
|
+
emitScrollEndReached();
|
|
323
|
+
}
|
|
324
|
+
}
|
|
311
325
|
/>
|
|
312
326
|
</ViewportTracker>
|
|
313
327
|
</ScreenLoadingMeasurements>
|
|
@@ -21,6 +21,7 @@ type Props = ZappScreenProps & {
|
|
|
21
21
|
setIsScreenWrappedInContainer: (isInsideContainer: boolean) => void;
|
|
22
22
|
screenContext: ZappRiver;
|
|
23
23
|
river: ZappRiver;
|
|
24
|
+
isScreenWrappedInScrollView?: boolean;
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
type State = {
|
|
@@ -87,6 +88,7 @@ export class RiverComponent extends React.Component<Props, State> {
|
|
|
87
88
|
isInsideContainer,
|
|
88
89
|
groupId,
|
|
89
90
|
scrollViewExtraProps,
|
|
91
|
+
isScreenWrappedInScrollView = false,
|
|
90
92
|
} = this.props;
|
|
91
93
|
|
|
92
94
|
const { id, type } = river;
|
|
@@ -123,6 +125,7 @@ export class RiverComponent extends React.Component<Props, State> {
|
|
|
123
125
|
<GeneralContentScreen
|
|
124
126
|
screenId={id}
|
|
125
127
|
isScreenWrappedInContainer={isInsideContainer}
|
|
128
|
+
isScreenWrappedInScrollView={isScreenWrappedInScrollView}
|
|
126
129
|
groupId={groupId}
|
|
127
130
|
scrollViewExtraProps={scrollViewExtraProps}
|
|
128
131
|
/>
|
|
@@ -153,6 +156,7 @@ export class RiverComponent extends React.Component<Props, State> {
|
|
|
153
156
|
groupId={groupId}
|
|
154
157
|
feed={feed}
|
|
155
158
|
isScreenWrappedInContainer={isInsideContainer}
|
|
159
|
+
isScreenWrappedInScrollView={isScreenWrappedInScrollView}
|
|
156
160
|
scrollViewExtraProps={scrollViewExtraProps}
|
|
157
161
|
componentsMapExtraProps={{
|
|
158
162
|
pullToRefreshPipesV1RefreshingStateUpdater:
|
|
@@ -137,6 +137,7 @@ exports[`componentsMap renders renders components map correctly 1`] = `
|
|
|
137
137
|
keyExtractor={[Function]}
|
|
138
138
|
maxToRenderPerBatch={10}
|
|
139
139
|
onContentSizeChange={[Function]}
|
|
140
|
+
onEndReached={[Function]}
|
|
140
141
|
onLayout={[Function]}
|
|
141
142
|
onMomentumScrollBegin={[Function]}
|
|
142
143
|
onMomentumScrollEnd={[Function]}
|
|
@@ -12,6 +12,7 @@ type Props = {
|
|
|
12
12
|
screenId: string;
|
|
13
13
|
hasUIComponents: boolean;
|
|
14
14
|
backgroundColor: string;
|
|
15
|
+
isScreenWrappedInScrollView: boolean;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
function TabContentComponent(props: Props) {
|
|
@@ -23,6 +24,7 @@ function TabContentComponent(props: Props) {
|
|
|
23
24
|
feedUrl,
|
|
24
25
|
screenId,
|
|
25
26
|
hasUIComponents,
|
|
27
|
+
isScreenWrappedInScrollView = false,
|
|
26
28
|
} = props;
|
|
27
29
|
|
|
28
30
|
return (
|
|
@@ -42,6 +44,7 @@ function TabContentComponent(props: Props) {
|
|
|
42
44
|
feedUrl={feedUrl}
|
|
43
45
|
screenId={screenId}
|
|
44
46
|
isInsideContainer={!hasUIComponents}
|
|
47
|
+
isScreenWrappedInScrollView={isScreenWrappedInScrollView}
|
|
45
48
|
/>
|
|
46
49
|
)}
|
|
47
50
|
</View>
|
package/events/index.ts
CHANGED
|
@@ -6,4 +6,7 @@ export enum QBUIComponentEvents {
|
|
|
6
6
|
focusOnSelectedTab = "focusOnSelectedTab",
|
|
7
7
|
focusOnSelectedTopMenuItem = "focusOnSelectedTopMenuItem",
|
|
8
8
|
scrollToTopForScreenWrappedInContainer = "scrollToTopForScreenWrappedInContainer",
|
|
9
|
+
scrollEndReached = "scrollEndReached",
|
|
9
10
|
}
|
|
11
|
+
|
|
12
|
+
export { scrollEndReached$, emitScrollEndReached } from "./scrollEndReached";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Subject } from "rxjs";
|
|
2
|
+
|
|
3
|
+
const scrollEndReachedSubject = new Subject<void>();
|
|
4
|
+
|
|
5
|
+
export const scrollEndReached$ = scrollEndReachedSubject.asObservable();
|
|
6
|
+
|
|
7
|
+
/** Call from scroll container (ComponentsMap or Tabs) when scroll reaches end. */
|
|
8
|
+
export const emitScrollEndReached = (): void => {
|
|
9
|
+
scrollEndReachedSubject.next();
|
|
10
|
+
};
|
package/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ type GeneralContentScreenProps = {
|
|
|
18
18
|
}) => Promise<ZappFeed> | ZappFeed;
|
|
19
19
|
extraAnchorPointYOffset?: number;
|
|
20
20
|
isScreenWrappedInContainer?: boolean;
|
|
21
|
+
isScreenWrappedInScrollView?: boolean;
|
|
21
22
|
componentsMapExtraProps?: {
|
|
22
23
|
onContentSizeChange?: (cb: { width: number; height: number }) => any;
|
|
23
24
|
onLayout?: (LayoutChangeEvent) => any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "14.0.10-alpha.
|
|
3
|
+
"version": "14.0.10-alpha.7235445407",
|
|
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.10-alpha.
|
|
32
|
-
"@applicaster/zapp-react-native-bridge": "14.0.10-alpha.
|
|
33
|
-
"@applicaster/zapp-react-native-redux": "14.0.10-alpha.
|
|
34
|
-
"@applicaster/zapp-react-native-utils": "14.0.10-alpha.
|
|
31
|
+
"@applicaster/applicaster-types": "14.0.10-alpha.7235445407",
|
|
32
|
+
"@applicaster/zapp-react-native-bridge": "14.0.10-alpha.7235445407",
|
|
33
|
+
"@applicaster/zapp-react-native-redux": "14.0.10-alpha.7235445407",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "14.0.10-alpha.7235445407",
|
|
35
35
|
"fast-json-stable-stringify": "^2.1.0",
|
|
36
36
|
"promise": "^8.3.0",
|
|
37
37
|
"url": "^0.11.0",
|