@applicaster/zapp-react-native-ui-components 12.0.0-alpha.9531194637 → 12.0.0-alpha.9834532023

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.
@@ -200,10 +200,19 @@ function ComponentsMapComponent(props: Props) {
200
200
  contentOffset: { y },
201
201
  } = nativeEvent;
202
202
 
203
- useScreenScrollStore.setState({
204
- scrollingVelocity: isScrollingDone ? 0 : 1,
205
- scrollPosition: y,
206
- });
203
+ const oldState = useScreenScrollStore.getState();
204
+ const scrollingVelocity = isScrollingDone ? 0 : 1;
205
+ const scrollPosition = y;
206
+
207
+ if (
208
+ scrollingVelocity !== oldState.scrollingVelocity ||
209
+ scrollPosition !== oldState.scrollPosition
210
+ ) {
211
+ useScreenScrollStore.setState({
212
+ scrollingVelocity,
213
+ scrollPosition,
214
+ });
215
+ }
207
216
  },
208
217
  []
209
218
  );
@@ -215,6 +224,15 @@ function ComponentsMapComponent(props: Props) {
215
224
  [onScrollFlatList]
216
225
  );
217
226
 
227
+ const onScrollEndDrag = React.useCallback(
228
+ ({ nativeEvent }) => {
229
+ if (nativeEvent.velocity.y === 0) {
230
+ onScrollFlatList({ nativeEvent }, true);
231
+ }
232
+ },
233
+ [onScrollFlatList]
234
+ );
235
+
218
236
  if (shouldShowLoadingError) {
219
237
  return <RiverError />;
220
238
  }
@@ -250,8 +268,9 @@ function ComponentsMapComponent(props: Props) {
250
268
  ListFooterComponent={renderFooter}
251
269
  refreshControl={refreshControl}
252
270
  onScroll={onScrollFlatList}
271
+ onScrollEndDrag={Platform.OS === "ios" && onScrollEndDrag}
253
272
  onMomentumScrollEnd={onMomentumScrollEnd}
254
- scrollEventThrottle={16}
273
+ scrollEventThrottle={50}
255
274
  {...scrollViewExtraProps}
256
275
  />
257
276
  </ViewportTracker>
@@ -6,7 +6,10 @@ import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
6
6
 
7
7
  import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
8
8
  import { getComponentModule } from "@applicaster/zapp-react-native-utils/pluginUtils";
9
- import { getNavigationPropsV2 } from "@applicaster/zapp-react-native-utils/navigationUtils";
9
+ import {
10
+ getNavigationPropsV2,
11
+ resolveNavigationPlugin,
12
+ } from "@applicaster/zapp-react-native-utils/navigationUtils";
10
13
  import { useSafeAreaInsets } from "react-native-safe-area-context";
11
14
  import {
12
15
  useDimensions,
@@ -52,11 +55,11 @@ function isValidColor(string) {
52
55
  }
53
56
 
54
57
  type Props = {
55
- setToggleMenu: () => void;
56
- setCloseMenu: () => void;
58
+ pathname: unknown;
59
+ screenData: unknown;
57
60
  };
58
61
 
59
- export function Screen({ setToggleMenu, setCloseMenu }: Props) {
62
+ export function Screen(_props: Props) {
60
63
  const theme = useTheme<BaseThemePropertiesMobile>();
61
64
  const navigation = useNavigation();
62
65
  const { plugins } = usePickFromState(["plugins"]);
@@ -70,26 +73,38 @@ export function Screen({ setToggleMenu, setCloseMenu }: Props) {
70
73
  fullDimensions: true,
71
74
  });
72
75
 
73
- const routeData = useRoute();
76
+ const { screenData, pathname } = useRoute();
74
77
 
75
78
  const currentRiver = useScreenData(
76
- getScreenId(routeData.screenData, navigation.activeRiver)
79
+ getScreenId(screenData, navigation.activeRiver)
77
80
  );
78
81
 
79
82
  const { title } = useNavbarState();
80
83
 
81
- const navBarProps = React.useMemo(
82
- () => ({
83
- ...getNavigationPropsV2({
84
- currentRiver,
85
- title,
86
- category: "nav_bar",
87
- }),
88
- setToggleMenu,
89
- setCloseMenu,
90
- }),
91
- [currentRiver, setCloseMenu, setToggleMenu]
92
- );
84
+ const hasMenu =
85
+ resolveNavigationPlugin({
86
+ category: "menu",
87
+ navigations: currentRiver.navigations,
88
+ plugins,
89
+ })?.identifier === "quick_brick_side_menu";
90
+
91
+ const navBarProps = React.useMemo<MobileNavBarPluginProps | null>(() => {
92
+ const props = getNavigationPropsV2({
93
+ currentRiver,
94
+ title,
95
+ category: "nav_bar",
96
+ });
97
+
98
+ if (props) {
99
+ return {
100
+ ...props,
101
+ id: pathname,
102
+ pathname: pathname,
103
+ };
104
+ }
105
+
106
+ return null;
107
+ }, [currentRiver, pathname]);
93
108
 
94
109
  const NavBar = React.useMemo(
95
110
  () =>
@@ -97,12 +112,10 @@ export function Screen({ setToggleMenu, setCloseMenu }: Props) {
97
112
  "nav_bar",
98
113
  currentRiver,
99
114
  plugins
100
- ) as React.ComponentType<MobileNavBarPluginProps>,
115
+ ) as React.ComponentType<MobileNavBarPluginProps & { hasMenu: boolean }>,
101
116
  []
102
117
  );
103
118
 
104
- const { screenData, pathname } = routeData;
105
-
106
119
  const offlinePlugin = getComponentModule({
107
120
  plugins,
108
121
  components: {},
@@ -133,9 +146,7 @@ export function Screen({ setToggleMenu, setCloseMenu }: Props) {
133
146
  return (
134
147
  <ScreenContextProvider pathname={pathname}>
135
148
  <View style={style}>
136
- <NavBar
137
- {...{ ...(navBarProps as MobileNavBarPluginProps), id: pathname }}
138
- />
149
+ {navBarProps && <NavBar {...navBarProps} hasMenu={hasMenu} />}
139
150
 
140
151
  <OfflineFallbackScreen screenData={targetScreenData}>
141
152
  {/* @TODO RouteManager doesn't use props, can they be removed ? */}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "12.0.0-alpha.9531194637",
3
+ "version": "12.0.0-alpha.9834532023",
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",
@@ -34,10 +34,10 @@
34
34
  "redux-mock-store": "^1.5.3"
35
35
  },
36
36
  "dependencies": {
37
- "@applicaster/applicaster-types": "12.0.0-alpha.9531194637",
38
- "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.9531194637",
39
- "@applicaster/zapp-react-native-redux": "12.0.0-alpha.9531194637",
40
- "@applicaster/zapp-react-native-utils": "12.0.0-alpha.9531194637",
37
+ "@applicaster/applicaster-types": "12.0.0-alpha.9834532023",
38
+ "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.9834532023",
39
+ "@applicaster/zapp-react-native-redux": "12.0.0-alpha.9834532023",
40
+ "@applicaster/zapp-react-native-utils": "12.0.0-alpha.9834532023",
41
41
  "promise": "^8.3.0",
42
42
  "react-router-native": "^5.1.2",
43
43
  "url": "^0.11.0",