@wavemaker/app-rn-runtime 11.11.0-rc.6109 → 11.11.0-rc.6113

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.
@@ -3,7 +3,7 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
3
3
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
4
4
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
5
  import React from 'react';
6
- import { Text, View } from 'react-native';
6
+ import { Text, View, Platform } from 'react-native';
7
7
  import { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';
8
8
  import { Tappable } from '@wavemaker/app-rn-runtime/core/tappable.component';
9
9
  import { NavigationServiceConsumer } from '@wavemaker/app-rn-runtime/core/navigation.service';
@@ -13,6 +13,9 @@ import { DEFAULT_CLASS } from './label.styles';
13
13
  import { isNil, toString } from 'lodash-es';
14
14
  import { Animatedview } from '@wavemaker/app-rn-runtime/components/basic/animatedview.component';
15
15
  import { createSkeleton } from '../skeleton/skeleton.component';
16
+ import { LinearGradient } from 'expo-linear-gradient';
17
+ import MaskedView from '@react-native-masked-view/masked-view';
18
+ import { parseLinearGradient } from '@wavemaker/app-rn-runtime/core/utils';
16
19
  export class WmLabelState extends BaseComponentState {
17
20
  constructor(...args) {
18
21
  super(...args);
@@ -107,51 +110,93 @@ export default class WmLabel extends BaseComponent {
107
110
  });
108
111
  }
109
112
  }
113
+ renderLabelTextContent(navigationService, isHidden = false, hasLinearGradient = false) {
114
+ var _this$styles, _this$state$parts, _this$state$parts2;
115
+ //gradient text support for web
116
+ const gradientTextWebStyle = {
117
+ backgroundImage: (_this$styles = this.styles) === null || _this$styles === void 0 ? void 0 : _this$styles.text.color,
118
+ color: 'transparent',
119
+ backgroundClip: 'text'
120
+ };
121
+ const showWebTextGradient = hasLinearGradient && Platform.OS === 'web';
122
+
123
+ // Shared styles
124
+ const baseStyle = this.styles.text;
125
+ const hiddenStyle = isHidden ? {
126
+ opacity: 0
127
+ } : {};
128
+ const gradientStyle = showWebTextGradient ? gradientTextWebStyle : {};
129
+
130
+ // Determine if it's a single part
131
+ const isSinglePart = this.state.parts.length <= 1;
132
+
133
+ // Compose final style
134
+ const combinedTextStyle = isSinglePart ? {
135
+ ...baseStyle,
136
+ ...hiddenStyle,
137
+ ...gradientStyle
138
+ } : {
139
+ flexWrap: 'wrap',
140
+ textAlign: baseStyle.textAlign,
141
+ ...hiddenStyle,
142
+ ...gradientStyle
143
+ };
144
+ return /*#__PURE__*/React.createElement(Text, _extends({
145
+ style: combinedTextStyle
146
+ }, this.state.parts.length <= 1 ? this.getTestPropsForLabel('caption') : {}, getAccessibilityProps(AccessibilityWidgetType.LABEL, this.state.props), {
147
+ numberOfLines: this.state.props.nooflines,
148
+ ellipsizeMode: "tail"
149
+ }), ((_this$state$parts = this.state.parts) === null || _this$state$parts === void 0 ? void 0 : _this$state$parts.length) === 1 ? toString(this.state.props.caption) : (_this$state$parts2 = this.state.parts) === null || _this$state$parts2 === void 0 ? void 0 : _this$state$parts2.map((part, index) => {
150
+ const isLink = !isNil(part.link);
151
+ return /*#__PURE__*/React.createElement(Text, _extends({
152
+ key: `part_${index}`,
153
+ style: [this.styles.text, isLink ? this.styles.link.text : null, this.state.props.isValid ? null : {
154
+ color: 'red'
155
+ }]
156
+ }, this.getTestPropsForLabel(isLink ? `link_${index}` : `caption_${index}`), {
157
+ selectable: this.styles.text.userSelect === 'text',
158
+ onPress: () => {
159
+ if (part.link) {
160
+ if (part.link.startsWith('http:') || part.link.startsWith('https:') || part.link.startsWith('#')) {
161
+ navigationService.openUrl(part.link, '_blank');
162
+ } else if (part.link.startsWith('javascript:')) {
163
+ const eventName = part.link.substring(11);
164
+ this.invokeEventCallback(eventName, [null, this.proxy]);
165
+ }
166
+ }
167
+ this.invokeEventCallback('onTap', [null, this.proxy]);
168
+ }
169
+ // {...getAccessibilityProps(AccessibilityWidgetType.LABEL, props)}
170
+ }), toString(part.text));
171
+ }), this.state.props.required && this.getAsterisk());
172
+ }
110
173
  renderWidget(props) {
174
+ var _this$styles2;
111
175
  const linkStyles = this.theme.mergeStyle({
112
176
  text: this.styles.text
113
177
  }, this.styles.link);
178
+ const {
179
+ hasLinearGradient,
180
+ start,
181
+ end,
182
+ gradientColors
183
+ } = parseLinearGradient((_this$styles2 = this.styles) === null || _this$styles2 === void 0 ? void 0 : _this$styles2.text.color, true);
114
184
  return !isNil(props.caption) ? /*#__PURE__*/React.createElement(Animatedview, {
115
185
  entryanimation: props.animation,
116
186
  delay: props.animationdelay,
117
187
  style: this.styles.root,
118
188
  onLayout: event => this.handleLayout(event)
119
189
  }, this._background, /*#__PURE__*/React.createElement(NavigationServiceConsumer, null, navigationService => {
120
- var _this$state$parts, _this$state$parts2;
121
190
  return /*#__PURE__*/React.createElement(Tappable, {
122
191
  target: this,
123
192
  disableTouchEffect: this.state.props.disabletoucheffect
124
- }, /*#__PURE__*/React.createElement(Text, _extends({
125
- style: this.state.parts.length <= 1 ? this.styles.text : {
126
- flexWrap: "wrap",
127
- textAlign: this.styles.text.textAlign
128
- }
129
- }, this.state.parts.length <= 1 ? this.getTestPropsForLabel('caption') : {}, getAccessibilityProps(AccessibilityWidgetType.LABEL, props), {
130
- numberOfLines: props.nooflines,
131
- ellipsizeMode: "tail"
132
- }), ((_this$state$parts = this.state.parts) === null || _this$state$parts === void 0 ? void 0 : _this$state$parts.length) === 1 ? toString(this.state.props.caption) : (_this$state$parts2 = this.state.parts) === null || _this$state$parts2 === void 0 ? void 0 : _this$state$parts2.map((part, index) => {
133
- const isLink = !isNil(part.link);
134
- return /*#__PURE__*/React.createElement(Text, _extends({
135
- key: `part_${index}`,
136
- style: [this.styles.text, isLink ? this.styles.link.text : null, props.isValid ? null : {
137
- color: 'red'
138
- }]
139
- }, this.getTestPropsForLabel(isLink ? `link_${index}` : `caption_${index}`), {
140
- selectable: this.styles.text.userSelect === 'text',
141
- onPress: () => {
142
- if (part.link) {
143
- if (part.link.startsWith('http:') || part.link.startsWith('https:') || part.link.startsWith('#')) {
144
- navigationService.openUrl(part.link, '_blank');
145
- } else if (part.link.startsWith('javascript:')) {
146
- const eventName = part.link.substring(11);
147
- this.invokeEventCallback(eventName, [null, this.proxy]);
148
- }
149
- }
150
- this.invokeEventCallback('onTap', [null, this.proxy]);
151
- }
152
- // {...getAccessibilityProps(AccessibilityWidgetType.LABEL, props)}
153
- }), toString(part.text));
154
- }), props.required && this.getAsterisk()));
193
+ }, hasLinearGradient ? /*#__PURE__*/React.createElement(MaskedView, {
194
+ maskElement: this.renderLabelTextContent(navigationService, false, hasLinearGradient)
195
+ }, /*#__PURE__*/React.createElement(LinearGradient, {
196
+ colors: gradientColors,
197
+ start: start,
198
+ end: end
199
+ }, this.renderLabelTextContent(navigationService, true))) : this.renderLabelTextContent(navigationService));
155
200
  })) : null;
156
201
  }
157
202
  }
@@ -1 +1 @@
1
- {"version":3,"names":["React","Text","View","BaseComponent","BaseComponentState","Tappable","NavigationServiceConsumer","AccessibilityWidgetType","getAccessibilityProps","WmLabelProps","DEFAULT_CLASS","isNil","toString","Animatedview","createSkeleton","WmLabelState","constructor","args","_defineProperty","WmLabel","props","getAsterisk","createElement","style","styles","asterisk","onPropertyChange","name","$new","$old","updateState","parts","parseCaption","String","getMultilineSkeleton","width","height","borderRadius","marginBottom","theme","skeleton","caption","replace","pattern","linkRegex","captionSplit","split","i","length","isLink","test","part","isNextTextALink","_captionSplit","text","link","push","renderSkeleton","skeletonWidth","skeletonHeight","skeletonwidth","_this$styles$root","root","skeletonheight","_this$styles$root2","fontSize","multilineskeleton","renderWidget","linkStyles","mergeStyle","entryanimation","animation","delay","animationdelay","onLayout","event","handleLayout","_background","navigationService","_this$state$parts","_this$state$parts2","target","disableTouchEffect","state","disabletoucheffect","_extends","flexWrap","textAlign","getTestPropsForLabel","LABEL","numberOfLines","nooflines","ellipsizeMode","map","index","key","isValid","color","selectable","userSelect","onPress","startsWith","openUrl","eventName","substring","invokeEventCallback","proxy","required"],"sources":["label.component.tsx"],"sourcesContent":["import React from 'react';\nimport { DimensionValue, LayoutChangeEvent, Text, View } from 'react-native';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { Tappable } from '@wavemaker/app-rn-runtime/core/tappable.component';\nimport NavigationService, { NavigationServiceConsumer } from '@wavemaker/app-rn-runtime/core/navigation.service';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';\n\nimport WmLabelProps from './label.props';\nimport { DEFAULT_CLASS, WmLabelStyles } from './label.styles';\nimport { isNil, toString } from 'lodash-es';\nimport { Animatedview } from '@wavemaker/app-rn-runtime/components/basic/animatedview.component';\nimport WmSkeleton, { createSkeleton } from '../skeleton/skeleton.component';\n\ntype PartType = {\n text?: string,\n link?: string,\n};\n\nexport class WmLabelState extends BaseComponentState<WmLabelProps> {\n parts: PartType[] = []\n}\n\nexport default class WmLabel extends BaseComponent<WmLabelProps, WmLabelState, WmLabelStyles> {\n\n constructor(props: WmLabelProps) {\n super(props, DEFAULT_CLASS, new WmLabelProps(), new WmLabelState());\n }\n\n private getAsterisk () {\n return <Text style={this.styles.asterisk}>*</Text>;\n }\n\n public onPropertyChange(name: string, $new: any, $old: any): void {\n super.onPropertyChange(name, $new, $old);\n\n switch(name) {\n case \"caption\":\n this.updateState({\n parts: this.parseCaption(String($new))\n } as WmLabelState);\n break;\n }\n }\n private getMultilineSkeleton(width: any, height: any) {\n const styles = {\n borderRadius:4,\n marginBottom: 10,\n height: height\n };\n return createSkeleton(this.theme, this.styles.skeleton, {\n ...styles,\n width: width,\n height: height\n });\n }\n\n parseCaption(caption: string) {\n if (!caption) {\n return [];\n }\n caption += '';\n caption = caption.replace(/\\s*\\(\\s*\\$event,\\s*\\$widget\\s*\\)\\s*/, '');\n caption = caption.replace(/\\(\\s*\\)/, '(#/__EMPTY__)');\n const pattern = /\\[([^\\]]+)\\]\\(([^)]*)\\)/g;\n const linkRegex = /^(((http|https):\\/\\/)|javascript:|#).+$/;\n const captionSplit = caption.split(pattern);\n\n let parts = [];\n\n for (let i = 0; i < captionSplit.length; i++) {\n const isLink = linkRegex.test(captionSplit[i]);\n let part: PartType = {};\n\n const isNextTextALink = linkRegex.test(captionSplit[i + 1]);\n if (isLink) {\n part.text = captionSplit[i - 1] ?? '';\n part.link = captionSplit[i] === '#/__EMPTY__' ? '' : captionSplit[i];\n } else {\n part.text = isNextTextALink ? \"\" : captionSplit[i];\n };\n\n if (part.text) {\n parts.push(part);\n }\n }\n\n return parts;\n }\n\n public renderSkeleton(props: WmLabelProps){\n\n let skeletonWidth, skeletonHeight;\n if(this.props.skeletonwidth == \"0\") {\n skeletonWidth = 0\n } else {\n skeletonWidth = this.props.skeletonwidth || this.styles.root?.width\n }\n\n if(this.props.skeletonheight == \"0\") {\n skeletonHeight = 0\n } else {\n skeletonHeight = this.props.skeletonheight || this.styles.root?.height || this.styles.text.fontSize;\n }\n \n if(this.props.multilineskeleton) {\n return (<View style={{\n width: skeletonWidth as DimensionValue\n }}>\n {this.getMultilineSkeleton('100%', skeletonHeight)}\n {this.getMultilineSkeleton('70%', skeletonHeight)}\n {this.getMultilineSkeleton('40%', skeletonHeight)}\n </View>)\n }\n else{\n return createSkeleton(this.theme, this.styles.skeleton, {\n ...this.styles.root,\n width: skeletonWidth as DimensionValue,\n height: skeletonHeight as DimensionValue\n });\n }\n }\n\n renderWidget(props: WmLabelProps) {\n const linkStyles = this.theme.mergeStyle({text: this.styles.text}, this.styles.link);\n return !isNil(props.caption) ? (\n <Animatedview \n entryanimation={props.animation} \n delay={props.animationdelay} \n style={this.styles.root}\n onLayout={(event: LayoutChangeEvent) => this.handleLayout(event)}\n >\n {this._background}\n <NavigationServiceConsumer>\n {(navigationService: NavigationService) => {\n return (<Tappable target={this} disableTouchEffect={this.state.props.disabletoucheffect} >\n <Text style={ this.state.parts.length <= 1 ? this.styles.text : {flexWrap: \"wrap\", textAlign: this.styles.text.textAlign}}\n {...this.state.parts.length <= 1 ? this.getTestPropsForLabel('caption') : {}}\n {...getAccessibilityProps(AccessibilityWidgetType.LABEL, props)}\n numberOfLines={props.nooflines} ellipsizeMode=\"tail\">\n {this.state.parts?.length === 1 ? toString(this.state.props.caption) : this.state.parts?.map((part, index) => {\n const isLink = !isNil(part.link);\n return (\n <Text\n key={`part_${index}`}\n style={[\n this.styles.text,\n isLink ? this.styles.link.text : null,\n props.isValid ? null : { color: 'red'}\n ]}\n {...this.getTestPropsForLabel(isLink ? `link_${index}` : `caption_${index}`)}\n selectable={this.styles.text.userSelect === 'text'}\n onPress={() => {\n if (part.link) {\n if (part.link.startsWith('http:')\n || part.link.startsWith('https:')\n || part.link.startsWith('#')) {\n navigationService.openUrl(part.link, '_blank');\n } else if (part.link.startsWith('javascript:')) {\n const eventName = part.link.substring(11);\n this.invokeEventCallback(eventName, [null, this.proxy]);\n }\n }\n this.invokeEventCallback('onTap', [null, this.proxy]);\n }}\n // {...getAccessibilityProps(AccessibilityWidgetType.LABEL, props)}\n >\n {toString(part.text)}\n </Text>\n );\n })}\n {props.required && this.getAsterisk()}\n </Text>\n </Tappable>)}}\n </NavigationServiceConsumer>\n </Animatedview>\n ) : null;\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAA4CC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAC5E,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AACjG,SAASC,QAAQ,QAAQ,mDAAmD;AAC5E,SAA4BC,yBAAyB,QAAQ,mDAAmD;AAChH,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,8CAA8C;AAE7G,OAAOC,YAAY,MAAM,eAAe;AACxC,SAASC,aAAa,QAAuB,gB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I,CAACI,IAAI,CAAC8C,UAAU,CAAC,GAAG,CAAC,EAAE;gBAC9BvB,iBAAiB,CAACwB,OAAO,CAACnD,IAAI,CAACI,IAAI,EAAE,QAAQ,CAAC;cAChD,CAAC,MAAM,IAAIJ,IAAI,CAACI,IAAI,CAAC8C,UAAU,CAAC,aAAa,CAAC,EAAE;gBAC9C,MAAME,SAAS,GAAGpD,IAAI,CAACI,IAAI,CAACiD,SAAS,CAAC,EAAE,CAAC;gBACzC,IAAI,CAACC,mBAAmB,CAACF,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,CAACG,KAAK,CAAC,CAAC;cACzD;YACF;YACA,IAAI,CAACD,mBAAmB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,CAACC,KAAK,CAAC,CAAC;UACvD;UACA;QAAA,IAEC9F,QAAQ,CAACuC,IAAI,CAACG,IAAI,CACf,CAAC;MAEX,CAAC,CAAC,EACAlC,KAAK,CAACuF,QAAQ,IAAI,IAAI,CAACtF,WAAW,CAAC,CACjC,CACE,CAAC;IAAC,CACa,CACf,CAAC,GACb,IAAI;EACV;AACF","ignoreList":[]}
1
+ {"version":3,"names":["React","Text","View","Platform","BaseComponent","BaseComponentState","Tappable","NavigationServiceConsumer","AccessibilityWidgetType","getAccessibilityProps","WmLabelProps","DEFAULT_CLASS","isNil","toString","Animatedview","createSkeleton","LinearGradient","MaskedView","parseLinearGradient","WmLabelState","constructor","args","_defineProperty","WmLabel","props","getAsterisk","createElement","style","styles","asterisk","onPropertyChange","name","$new","$old","updateState","parts","parseCaption","String","getMultilineSkeleton","width","height","borderRadius","marginBottom","theme","skeleton","caption","replace","pattern","linkRegex","captionSplit","split","i","length","isLink","test","part","isNextTextALink","_captionSplit","text","link","push","renderSkeleton","skeletonWidth","skeletonHeight","skeletonwidth","_this$styles$root","root","skeletonheight","_this$styles$root2","fontSize","multilineskeleton","renderLabelTextContent","navigationService","isHidden","hasLinearGradient","_this$styles","_this$state$parts","_this$state$parts2","gradientTextWebStyle","backgroundImage","color","backgroundClip","showWebTextGradient","OS","baseStyle","hiddenStyle","opacity","gradientStyle","isSinglePart","state","combinedTextStyle","flexWrap","textAlign","_extends","getTestPropsForLabel","LABEL","numberOfLines","nooflines","ellipsizeMode","map","index","key","isValid","selectable","userSelect","onPress","startsWith","openUrl","eventName","substring","invokeEventCallback","proxy","required","renderWidget","_this$styles2","linkStyles","mergeStyle","start","end","gradientColors","entryanimation","animation","delay","animationdelay","onLayout","event","handleLayout","_background","target","disableTouchEffect","disabletoucheffect","maskElement","colors"],"sources":["label.component.tsx"],"sourcesContent":["import React from 'react';\nimport { DimensionValue, LayoutChangeEvent, Text, View,Platform } from 'react-native';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { Tappable } from '@wavemaker/app-rn-runtime/core/tappable.component';\nimport NavigationService, { NavigationServiceConsumer } from '@wavemaker/app-rn-runtime/core/navigation.service';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';\n\nimport WmLabelProps from './label.props';\nimport { DEFAULT_CLASS, WmLabelStyles } from './label.styles';\nimport { isNil, toString } from 'lodash-es';\nimport { Animatedview } from '@wavemaker/app-rn-runtime/components/basic/animatedview.component';\nimport WmSkeleton, { createSkeleton } from '../skeleton/skeleton.component';\nimport { LinearGradient } from 'expo-linear-gradient';\nimport MaskedView from '@react-native-masked-view/masked-view';\nimport { parseLinearGradient } from '@wavemaker/app-rn-runtime/core/utils';\n\n\ntype PartType = {\n text?: string,\n link?: string,\n};\n\nexport class WmLabelState extends BaseComponentState<WmLabelProps> {\n parts: PartType[] = []\n}\n\nexport default class WmLabel extends BaseComponent<WmLabelProps, WmLabelState, WmLabelStyles> {\n\n constructor(props: WmLabelProps) {\n super(props, DEFAULT_CLASS, new WmLabelProps(), new WmLabelState());\n }\n\n private getAsterisk() {\n return <Text style={this.styles.asterisk}>*</Text>;\n }\n\n public onPropertyChange(name: string, $new: any, $old: any): void {\n super.onPropertyChange(name, $new, $old);\n\n switch (name) {\n case \"caption\":\n this.updateState({\n parts: this.parseCaption(String($new))\n } as WmLabelState);\n break;\n }\n }\n private getMultilineSkeleton(width: any, height: any) {\n const styles = {\n borderRadius: 4,\n marginBottom: 10,\n height: height\n };\n return createSkeleton(this.theme, this.styles.skeleton, {\n ...styles,\n width: width,\n height: height\n });\n }\n\n parseCaption(caption: string) {\n if (!caption) {\n return [];\n }\n caption += '';\n caption = caption.replace(/\\s*\\(\\s*\\$event,\\s*\\$widget\\s*\\)\\s*/, '');\n caption = caption.replace(/\\(\\s*\\)/, '(#/__EMPTY__)');\n const pattern = /\\[([^\\]]+)\\]\\(([^)]*)\\)/g;\n const linkRegex = /^(((http|https):\\/\\/)|javascript:|#).+$/;\n const captionSplit = caption.split(pattern);\n\n let parts = [];\n\n for (let i = 0; i < captionSplit.length; i++) {\n const isLink = linkRegex.test(captionSplit[i]);\n let part: PartType = {};\n\n const isNextTextALink = linkRegex.test(captionSplit[i + 1]);\n if (isLink) {\n part.text = captionSplit[i - 1] ?? '';\n part.link = captionSplit[i] === '#/__EMPTY__' ? '' : captionSplit[i];\n } else {\n part.text = isNextTextALink ? \"\" : captionSplit[i];\n };\n\n if (part.text) {\n parts.push(part);\n }\n }\n\n return parts;\n }\n\n public renderSkeleton(props: WmLabelProps) {\n\n let skeletonWidth, skeletonHeight;\n if (this.props.skeletonwidth == \"0\") {\n skeletonWidth = 0\n } else {\n skeletonWidth = this.props.skeletonwidth || this.styles.root?.width\n }\n\n if (this.props.skeletonheight == \"0\") {\n skeletonHeight = 0\n } else {\n skeletonHeight = this.props.skeletonheight || this.styles.root?.height || this.styles.text.fontSize;\n }\n\n if (this.props.multilineskeleton) {\n return (<View style={{\n width: skeletonWidth as DimensionValue\n }}>\n {this.getMultilineSkeleton('100%', skeletonHeight)}\n {this.getMultilineSkeleton('70%', skeletonHeight)}\n {this.getMultilineSkeleton('40%', skeletonHeight)}\n </View>)\n }\n else {\n return createSkeleton(this.theme, this.styles.skeleton, {\n ...this.styles.root,\n width: skeletonWidth as DimensionValue,\n height: skeletonHeight as DimensionValue\n });\n }\n }\n\n private renderLabelTextContent(navigationService: NavigationService, isHidden: boolean = false, hasLinearGradient: boolean = false) {\n //gradient text support for web\n const gradientTextWebStyle = {\n backgroundImage: (this.styles?.text.color as string),\n color: 'transparent',\n backgroundClip: 'text',\n }\n const showWebTextGradient = (hasLinearGradient && Platform.OS === 'web');\n\n // Shared styles\n const baseStyle = this.styles.text;\n const hiddenStyle = isHidden ? { opacity: 0 } : {};\n const gradientStyle = showWebTextGradient ? gradientTextWebStyle : {};\n\n // Determine if it's a single part\n const isSinglePart = this.state.parts.length <= 1;\n\n // Compose final style\n const combinedTextStyle = isSinglePart\n ? { ...baseStyle, ...hiddenStyle, ...gradientStyle }\n : {\n flexWrap: 'wrap',\n textAlign: baseStyle.textAlign,\n ...hiddenStyle,\n ...gradientStyle,\n };\n\n\n\n return (\n <Text style={combinedTextStyle}\n {...this.state.parts.length <= 1 ? this.getTestPropsForLabel('caption') : {}}\n {...getAccessibilityProps(AccessibilityWidgetType.LABEL, this.state.props)}\n numberOfLines={this.state.props.nooflines} ellipsizeMode=\"tail\">\n {this.state.parts?.length === 1 ? toString(this.state.props.caption) : this.state.parts?.map((part, index) => {\n const isLink = !isNil(part.link);\n return (\n <Text\n key={`part_${index}`}\n style={[\n this.styles.text,\n isLink ? this.styles.link.text : null,\n this.state.props.isValid ? null : { color: 'red' }\n ]}\n {...this.getTestPropsForLabel(isLink ? `link_${index}` : `caption_${index}`)}\n selectable={this.styles.text.userSelect === 'text'}\n onPress={() => {\n if (part.link) {\n if (part.link.startsWith('http:')\n || part.link.startsWith('https:')\n || part.link.startsWith('#')) {\n navigationService.openUrl(part.link, '_blank');\n } else if (part.link.startsWith('javascript:')) {\n const eventName = part.link.substring(11);\n this.invokeEventCallback(eventName, [null, this.proxy]);\n }\n }\n this.invokeEventCallback('onTap', [null, this.proxy]);\n }}\n // {...getAccessibilityProps(AccessibilityWidgetType.LABEL, props)}\n >\n {toString(part.text)}\n </Text>\n );\n })}\n {this.state.props.required && this.getAsterisk()}\n </Text>\n )\n\n }\n renderWidget(props: WmLabelProps) {\n const linkStyles = this.theme.mergeStyle({ text: this.styles.text }, this.styles.link);\n const { hasLinearGradient, start, end, gradientColors } = parseLinearGradient((this.styles?.text.color) as string, true);\n\n\n return !isNil(props.caption) ? (\n <Animatedview\n entryanimation={props.animation}\n delay={props.animationdelay}\n style={this.styles.root}\n onLayout={(event: LayoutChangeEvent) => this.handleLayout(event)}\n >\n {this._background}\n <NavigationServiceConsumer>\n {(navigationService: NavigationService) => {\n return (<Tappable target={this} disableTouchEffect={this.state.props.disabletoucheffect} >\n {hasLinearGradient ? <MaskedView\n maskElement={this.renderLabelTextContent(navigationService, false, hasLinearGradient)}\n >\n <LinearGradient colors={gradientColors} start={start} end={end}>\n {this.renderLabelTextContent(navigationService, true)}\n </LinearGradient>\n </MaskedView> : this.renderLabelTextContent(navigationService)}\n </Tappable>)\n }}\n </NavigationServiceConsumer>\n </Animatedview>\n ) : null;\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAA4CC,IAAI,EAAEC,IAAI,EAACC,QAAQ,QAAQ,cAAc;AACrF,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AACjG,SAASC,QAAQ,QAAQ,mDAAmD;AAC5E,SAA4BC,yBAAyB,QAAQ,mDAAmD;AAChH,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,8CAA8C;AAE7G,OAAOC,YAAY,MAAM,eAAe;AACxC,SAASC,aAAa,QAAuB,gBAAgB;AAC7D,SAASC,KAAK,EAAEC,QAAQ,QAAQ,WAAW;AAC3C,SAASC,YAAY,QAAQ,mEAAmE;AAChG,SAAqBC,cAAc,QAAQ,gCAAgC;AAC3E,SAASC,cAAc,QAAQ,sBAAsB;AACrD,OAAOC,UAAU,MAAM,uCAAuC;AAC9D,SAASC,mBA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,KAAK,CAACmG,cAAe;MAC5BhG,KAAK,EAAE,IAAI,CAACC,MAAM,CAACsC,IAAK;MACxB0D,QAAQ,EAAGC,KAAwB,IAAK,IAAI,CAACC,YAAY,CAACD,KAAK;IAAE,GAEhE,IAAI,CAACE,WAAW,eACjB/H,KAAA,CAAA0B,aAAA,CAACnB,yBAAyB,QACtBiE,iBAAoC,IAAK;MACzC,oBAAQxE,KAAA,CAAA0B,aAAA,CAACpB,QAAQ;QAAC0H,MAAM,EAAE,IAAK;QAACC,kBAAkB,EAAE,IAAI,CAACxC,KAAK,CAACjE,KAAK,CAAC0G;MAAmB,GACrFxD,iBAAiB,gBAAG1E,KAAA,CAAA0B,aAAA,CAACT,UAAU;QAC9BkH,WAAW,EAAE,IAAI,CAAC5D,sBAAsB,CAACC,iBAAiB,EAAE,KAAK,EAAEE,iBAAiB;MAAE,gBAEtF1E,KAAA,CAAA0B,aAAA,CAACV,cAAc;QAACoH,MAAM,EAAEb,cAAe;QAACF,KAAK,EAAEA,KAAM;QAACC,GAAG,EAAEA;MAAI,GAC5D,IAAI,CAAC/C,sBAAsB,CAACC,iBAAiB,EAAE,IAAI,CACtC,CACN,CAAC,GAAG,IAAI,CAACD,sBAAsB,CAACC,iBAAiB,CACrD,CAAC;IACb,CACyB,CACf,CAAC,GACb,IAAI;EACV;AACF","ignoreList":[]}
@@ -33,6 +33,17 @@ export default class WmAppNavbar extends BaseComponent {
33
33
  this.cleanup.push(() => subscription.remove());
34
34
  }
35
35
  }
36
+ updatePageScrollTopThreshold(event) {
37
+ const {
38
+ height
39
+ } = event.nativeEvent.layout;
40
+ // maintaining pageScrollTopThreshold value for sticky header to attach from top position
41
+ if (this.props.hideonscroll) {
42
+ this.appConfig.pageScrollTopThreshold = 0;
43
+ } else {
44
+ this.appConfig.pageScrollTopThreshold = Math.ceil(height);
45
+ }
46
+ }
36
47
  renderContent(props) {
37
48
  //@ts-ignore
38
49
  const badge = props.badgevalue != undefined ? /*#__PURE__*/React.createElement(Badge, _extends({
@@ -57,7 +68,10 @@ export default class WmAppNavbar extends BaseComponent {
57
68
  ref: ref => {
58
69
  this.baseView = ref;
59
70
  },
60
- onLayout: event => this.handleLayout(event)
71
+ onLayout: event => {
72
+ this.handleLayout(event);
73
+ this.updatePageScrollTopThreshold(event);
74
+ }
61
75
  }, this._background, /*#__PURE__*/React.createElement(View, {
62
76
  style: this.styles.leftSection
63
77
  }, props.showDrawerButton && /*#__PURE__*/React.createElement(WmIcon, {
@@ -1 +1 @@
1
- {"version":3,"names":["React","Text","View","BackHandler","Badge","isAndroid","isWebPreviewMode","BaseComponent","BaseComponentState","WmIcon","WmPicture","WmAppNavbarProps","DEFAULT_CLASS","StickyView","SafeAreaInsetsContext","injector","WmAppNavbarState","WmAppNavbar","constructor","props","_defineProperty","get","onDrawerBtnPress","invokeEventCallback","bind","onBackBtnPress","onSearchBtnPress","subscription","addEventListener","cleanup","push","remove","renderContent","badge","badgevalue","undefined","createElement","_extends","style","styles","getTestProps","Consumer","insets","top","bottom","left","right","_this$appConfig","paddingTopVal","root","paddingTop","padding","statusBarCustomisation","appConfig","preferences","statusbarStyles","isFullScreenMode","translucent","stylesWithFs","height","ref","baseView","onLayout","event","handleLayout","_background","leftSection","showDrawerButton","id","getTestId","hint","theme","mergeStyle","action","leftnavIcon","iconclass","leftnavpaneliconclass","onTap","backbutton","backIcon","backbuttoniconclass","caption","backbuttonlabel","middleSection","imgsrc","image","picturesource","content","getTestPropsForLabel","accessibilityRole","title","rightSection","searchbutton","searchbuttoniconclass","children","renderWidget","hideonscroll","isSticky","component","slide"],"sources":["appnavbar.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, View, BackHandler } from 'react-native';\nimport { Badge } from 'react-native-paper';\n\nimport { isAndroid, isWebPreviewMode } from '@wavemaker/app-rn-runtime/core/utils';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport WmPicture from '@wavemaker/app-rn-runtime/components/basic/picture/picture.component';\n\nimport WmAppNavbarProps from './appnavbar.props';\nimport { DEFAULT_CLASS, WmAppNavbarStyles } from './appnavbar.styles';\nimport { StickyView } from '@wavemaker/app-rn-runtime/core/sticky-container.component';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\nimport injector from '@wavemaker/app-rn-runtime/core/injector';\nimport AppConfig from '@wavemaker/app-rn-runtime/core/AppConfig';\n\nexport class WmAppNavbarState extends BaseComponentState<WmAppNavbarProps> {}\n\nexport default class WmAppNavbar extends BaseComponent<WmAppNavbarProps, WmAppNavbarState, WmAppNavbarStyles> {\n\n private onDrawerBtnPress: Function;\n private onBackBtnPress: Function;\n private onSearchBtnPress: Function;\n private appConfig = injector.get<AppConfig>('APP_CONFIG');\n\n constructor(props: WmAppNavbarProps) {\n super(props, DEFAULT_CLASS, new WmAppNavbarProps());\n this.onDrawerBtnPress = (() => this.invokeEventCallback('onDrawerbuttonpress', [null, this])).bind(this);\n this.onBackBtnPress = (() => this.invokeEventCallback('onBackbtnclick', [null, this])).bind(this);\n this.onSearchBtnPress = (() => this.invokeEventCallback('onSearchbuttonpress', [null, this])).bind(this);\n if (isAndroid() && !isWebPreviewMode()) {\n const subscription = BackHandler.addEventListener('hardwareBackPress', () => {\n this.onBackBtnPress();\n return true;\n });\n this.cleanup.push(() => subscription.remove());\n }\n }\n\n renderContent(props: WmAppNavbarProps) {\n //@ts-ignore\n const badge = props.badgevalue != undefined ? (<Badge style={this.styles.badge} {...this.getTestProps('badge')}>{props.badgevalue}</Badge>): null;\n return (\n <SafeAreaInsetsContext.Consumer>\n {(insets = { top: 0, bottom: 0, left: 0, right: 0 }) => {\n const paddingTopVal = this.styles.root.paddingTop || this.styles.root.padding;\n const statusBarCustomisation = this.appConfig?.preferences?.statusbarStyles;\n const isFullScreenMode = !!statusBarCustomisation?.translucent;\n const stylesWithFs = isFullScreenMode ? {height: this.styles.root.height as number + (insets?.top || 0) as number, \n paddingTop: (paddingTopVal || 0) as number + (insets?.top || 0) as number} : {}\n return (\n <View style={[this.styles.root, stylesWithFs]} ref={ref => {this.baseView = ref as View}} onLayout={(event) => this.handleLayout(event)}>\n {this._background}\n <View style={this.styles.leftSection}>\n {props.showDrawerButton && (<WmIcon\n id={this.getTestId('leftnavbtn')}\n hint={'menu'}\n styles={this.theme.mergeStyle({}, this.styles.action, this.styles.leftnavIcon)}\n iconclass={props.leftnavpaneliconclass}\n onTap={this.onDrawerBtnPress}\n />)}\n {props.backbutton && (<WmIcon\n id={this.getTestId('backbtn')}\n hint={'back'}\n styles={this.theme.mergeStyle({}, this.styles.action, this.styles.backIcon)}\n iconclass={props.backbuttoniconclass}\n caption={props.backbuttonlabel}\n onTap={this.onBackBtnPress}/>)}\n </View>\n <View style={this.styles.middleSection}>\n {props.imgsrc && (\n <WmPicture\n id={this.getTestId('picture')}\n styles={this.styles.image}\n picturesource={props.imgsrc} />)}\n <Text style={this.styles.content} {...this.getTestPropsForLabel('title')} accessibilityRole='header'>{props.title}</Text>\n {badge}\n </View>\n <View style={this.styles.rightSection}>\n {props.searchbutton && (<WmIcon\n id={this.getTestId('searchbtn')}\n styles={this.theme.mergeStyle({}, this.styles.action, this.styles.leftnavIcon)}\n iconclass={props.searchbuttoniconclass}\n onTap={this.onSearchBtnPress}\n />)}\n {props.children}\n </View>\n </View>\n )}}\n </SafeAreaInsetsContext.Consumer>\n )\n }\n\n renderWidget(props: WmAppNavbarProps){\n if(props.hideonscroll) this.isSticky = true;\n return props.hideonscroll ? \n <StickyView\n theme={this.theme}\n component={this}\n slide={true}\n >\n {this.renderContent(props)}\n </StickyView>\n : this.renderContent(props);\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,WAAW,QAAQ,cAAc;AACtD,SAASC,KAAK,QAAQ,oBAAoB;AAE1C,SAASC,SAAS,EAAEC,gBAAgB,QAAQ,sCAAsC;AAClF,SAASC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5E,KAAuB,EAAC;IACnC,IAAGA,KAAK,CAAC6E,YAAY,EAAE,IAAI,CAACC,QAAQ,GAAG,IAAI;IAC3C,OAAO9E,KAAK,CAAC6E,YAAY,gBACvBhG,KAAA,CAAAoC,aAAA,CAACvB,UAAU;MACT0D,KAAK,EAAE,IAAI,CAACA,KAAM;MAClB2B,SAAS,EAAE,IAAK;MAChBC,KAAK,EAAE;IAAK,GAEX,IAAI,CAACnE,aAAa,CAACb,KAAK,CACf,CAAC,GACX,IAAI,CAACa,aAAa,CAACb,KAAK,CAAC;EAC/B;AACF","ignoreList":[]}
1
+ {"version":3,"names":["React","Text","View","BackHandler","Badge","isAndroid","isWebPreviewMode","BaseComponent","BaseComponentState","WmIcon","WmPicture","WmAppNavbarProps","DEFAULT_CLASS","StickyView","SafeAreaInsetsContext","injector","WmAppNavbarState","WmAppNavbar","constructor","props","_defineProperty","get","onDrawerBtnPress","invokeEventCallback","bind","onBackBtnPress","onSearchBtnPress","subscription","addEventListener","cleanup","push","remove","updatePageScrollTopThreshold","event","height","nativeEvent","layout","hideonscroll","appConfig","pageScrollTopThreshold","Math","ceil","renderContent","badge","badgevalue","undefined","createElement","_extends","style","styles","getTestProps","Consumer","insets","top","bottom","left","right","_this$appConfig","paddingTopVal","root","paddingTop","padding","statusBarCustomisation","preferences","statusbarStyles","isFullScreenMode","translucent","stylesWithFs","ref","baseView","onLayout","handleLayout","_background","leftSection","showDrawerButton","id","getTestId","hint","theme","mergeStyle","action","leftnavIcon","iconclass","leftnavpaneliconclass","onTap","backbutton","backIcon","backbuttoniconclass","caption","backbuttonlabel","middleSection","imgsrc","image","picturesource","content","getTestPropsForLabel","accessibilityRole","title","rightSection","searchbutton","searchbuttoniconclass","children","renderWidget","isSticky","component","slide"],"sources":["appnavbar.component.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, View, BackHandler } from 'react-native';\nimport { Badge } from 'react-native-paper';\n\nimport { isAndroid, isWebPreviewMode } from '@wavemaker/app-rn-runtime/core/utils';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\nimport WmIcon from '@wavemaker/app-rn-runtime/components/basic/icon/icon.component';\nimport WmPicture from '@wavemaker/app-rn-runtime/components/basic/picture/picture.component';\n\nimport WmAppNavbarProps from './appnavbar.props';\nimport { DEFAULT_CLASS, WmAppNavbarStyles } from './appnavbar.styles';\nimport { StickyView } from '@wavemaker/app-rn-runtime/core/sticky-container.component';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\nimport injector from '@wavemaker/app-rn-runtime/core/injector';\nimport AppConfig from '@wavemaker/app-rn-runtime/core/AppConfig';\n\nexport class WmAppNavbarState extends BaseComponentState<WmAppNavbarProps> {}\n\nexport default class WmAppNavbar extends BaseComponent<WmAppNavbarProps, WmAppNavbarState, WmAppNavbarStyles> {\n\n private onDrawerBtnPress: Function;\n private onBackBtnPress: Function;\n private onSearchBtnPress: Function;\n private appConfig = injector.get<AppConfig>('APP_CONFIG');\n\n constructor(props: WmAppNavbarProps) {\n super(props, DEFAULT_CLASS, new WmAppNavbarProps());\n this.onDrawerBtnPress = (() => this.invokeEventCallback('onDrawerbuttonpress', [null, this])).bind(this);\n this.onBackBtnPress = (() => this.invokeEventCallback('onBackbtnclick', [null, this])).bind(this);\n this.onSearchBtnPress = (() => this.invokeEventCallback('onSearchbuttonpress', [null, this])).bind(this);\n if (isAndroid() && !isWebPreviewMode()) {\n const subscription = BackHandler.addEventListener('hardwareBackPress', () => {\n this.onBackBtnPress();\n return true;\n });\n this.cleanup.push(() => subscription.remove());\n }\n }\n\n updatePageScrollTopThreshold(event: any):void {\n const { height } = event.nativeEvent.layout;\n // maintaining pageScrollTopThreshold value for sticky header to attach from top position\n if(this.props.hideonscroll){\n this.appConfig.pageScrollTopThreshold = 0; \n }else {\n this.appConfig.pageScrollTopThreshold = Math.ceil(height);\n }\n }\n\n renderContent(props: WmAppNavbarProps) {\n //@ts-ignore\n const badge = props.badgevalue != undefined ? (<Badge style={this.styles.badge} {...this.getTestProps('badge')}>{props.badgevalue}</Badge>): null;\n return (\n <SafeAreaInsetsContext.Consumer>\n {(insets = { top: 0, bottom: 0, left: 0, right: 0 }) => {\n const paddingTopVal = this.styles.root.paddingTop || this.styles.root.padding;\n const statusBarCustomisation = this.appConfig?.preferences?.statusbarStyles;\n const isFullScreenMode = !!statusBarCustomisation?.translucent;\n\n const stylesWithFs = isFullScreenMode ? {height: this.styles.root.height as number + (insets?.top || 0) as number, \n paddingTop: (paddingTopVal || 0) as number + (insets?.top || 0) as number} : {}\n return (\n <View style={[this.styles.root, stylesWithFs]} ref={ref => {this.baseView = ref as View}} onLayout={(event) => {\n this.handleLayout(event);\n this.updatePageScrollTopThreshold(event);\n }}>\n {this._background}\n <View style={this.styles.leftSection}>\n {props.showDrawerButton && (<WmIcon\n id={this.getTestId('leftnavbtn')}\n hint={'menu'}\n styles={this.theme.mergeStyle({}, this.styles.action, this.styles.leftnavIcon)}\n iconclass={props.leftnavpaneliconclass}\n onTap={this.onDrawerBtnPress}\n />)}\n {props.backbutton && (<WmIcon\n id={this.getTestId('backbtn')}\n hint={'back'}\n styles={this.theme.mergeStyle({}, this.styles.action, this.styles.backIcon)}\n iconclass={props.backbuttoniconclass}\n caption={props.backbuttonlabel}\n onTap={this.onBackBtnPress}/>)}\n </View>\n <View style={this.styles.middleSection}>\n {props.imgsrc && (\n <WmPicture\n id={this.getTestId('picture')}\n styles={this.styles.image}\n picturesource={props.imgsrc} />)}\n <Text style={this.styles.content} {...this.getTestPropsForLabel('title')} accessibilityRole='header'>{props.title}</Text>\n {badge}\n </View>\n <View style={this.styles.rightSection}>\n {props.searchbutton && (<WmIcon\n id={this.getTestId('searchbtn')}\n styles={this.theme.mergeStyle({}, this.styles.action, this.styles.leftnavIcon)}\n iconclass={props.searchbuttoniconclass}\n onTap={this.onSearchBtnPress}\n />)}\n {props.children}\n </View>\n </View>\n )}}\n </SafeAreaInsetsContext.Consumer>\n )\n }\n\n renderWidget(props: WmAppNavbarProps){\n if(props.hideonscroll) this.isSticky = true;\n return props.hideonscroll ? \n <StickyView\n theme={this.theme}\n component={this}\n slide={true}\n >\n {this.renderContent(props)}\n </StickyView>\n : this.renderContent(props);\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,WAAW,QAAQ,cAAc;AACtD,SAASC,KAAK,QAAQ,oBAAoB;AAE1C,SAASC,SAAS,EAAEC,gBAAgB,QAAQ,sCAAsC;AAClF,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AACjG,OAAOC,MAAM,MAAM,gEAAgE;AACnF,OAAOC,SAAS,MAAM,sEAAsE;AAE5F,OAAOC,gBAAgB,MAAM,mBAAmB;AAChD,SAASC,aAAa,QAA2B,oBAAoB;AACrE,SAASC,UAAU,QAAQ,2DAA2D;AACtF,SAASC,qBAAqB,QAAQ,gCAAgC;AACtE,OAAOC,QAAQ,MAAM,yCAAyC;AAG9D,OAAO,MAAMC,gBAAgB,SAASR,kBAAkB,CAAmB;AAE3E,eAAe,MAAMS,WAAW,SAASV,aAAa,CAAwD;EAO5GW,WAAWA,CAACC,KAAuB,EAAE;IACnC,KAAK,CAACA,KAAK,EAAEP,aAAa,EAAE,IAAID,gBAAgB,CAAC,CAAC,CAAC;IAACS,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,oBAHlCL,QAAQ,CAACM,GAAG,CAAY,YAAY,CAAC;IAIvD,IAAI,CAACC,gBAAgB,GAAG,CAAC,MAAM,IAAI,CAACC,mBAAmB,CAAC,qBAAqB,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,EAAEC,IAAI,CAAC,IAAI,CAAC;IACxG,IAAI,CAACC,cAAc,GAAG,CAAC,MAAM,IAAI,CAACF,mBAAmB,CAAC,gBAAgB,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,EAAEC,IAAI,CAAC,IAAI,CAAC;IACjG,IAAI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,IAAI,EAAA8C,QAAA;QAACC,KAAK,EAAE,IAAI,CAACC,MAAM,CAAC6C;MAAQ,GAAK,IAAI,CAACC,oBAAoB,CAAC,OAAO,CAAC;QAAEC,iBAAiB,EAAC;MAAQ,IAAE7E,KAAK,CAAC8E,KAAY,CAAC,EACxHtD,KACG,CAAC,eACP3C,KAAA,CAAA8C,aAAA,CAAC5C,IAAI;QAAC8C,KAAK,EAAE,IAAI,CAACC,MAAM,CAACiD;MAAa,GACnC/E,KAAK,CAACgF,YAAY,iBAAKnG,KAAA,CAAA8C,aAAA,CAACrC,MAAM;QAC7BkE,EAAE,EAAE,IAAI,CAACC,SAAS,CAAC,WAAW,CAAE;QAChC3B,MAAM,EAAE,IAAI,CAAC6B,KAAK,CAACC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC9B,MAAM,CAAC+B,MAAM,EAAE,IAAI,CAAC/B,MAAM,CAACgC,WAAW,CAAE;QAC/EC,SAAS,EAAE/D,KAAK,CAACiF,qBAAsB;QACvChB,KAAK,EAAE,IAAI,CAAC1D;MAAiB,CAC5B,CAAE,EACJP,KAAK,CAACkF,QACH,CACF,CAAC;IACN,CAC2B,CAAC;EAErC;EAEAC,YAAYA,CAACnF,KAAuB,EAAC;IACnC,IAAGA,KAAK,CAACkB,YAAY,EAAE,IAAI,CAACkE,QAAQ,GAAG,IAAI;IAC3C,OAAOpF,KAAK,CAACkB,YAAY,gBACvBrC,KAAA,CAAA8C,aAAA,CAACjC,UAAU;MACTiE,KAAK,EAAE,IAAI,CAACA,KAAM;MAClB0B,SAAS,EAAE,IAAK;MAChBC,KAAK,EAAE;IAAK,GAEX,IAAI,CAAC/D,aAAa,CAACvB,KAAK,CACf,CAAC,GACX,IAAI,CAACuB,aAAa,CAACvB,KAAK,CAAC;EAC/B;AACF","ignoreList":[]}
@@ -11,43 +11,31 @@ import { DEFAULT_CLASS } from './page-content.styles';
11
11
  import { ScrollView } from 'react-native-gesture-handler';
12
12
  import WmLottie from '@wavemaker/app-rn-runtime/components/basic/lottie/lottie.component';
13
13
  import { SafeAreaInsetsContext } from 'react-native-safe-area-context';
14
- export class WmPageContentState extends BaseComponentState {
15
- constructor(...args) {
16
- super(...args);
17
- _defineProperty(this, "previousScrollY", 0);
18
- _defineProperty(this, "swipeThreshold", 8);
19
- }
20
- }
14
+ export class WmPageContentState extends BaseComponentState {}
21
15
  export default class WmPageContent extends BaseComponent {
22
16
  constructor(props) {
23
17
  super(props, DEFAULT_CLASS, new WmPageContentProps());
24
18
  _defineProperty(this, "scrollRef", void 0);
19
+ _defineProperty(this, "previousScrollPosition", 0);
25
20
  _defineProperty(this, "handleScroll", event => {
26
- const currentScrollY = event.nativeEvent.contentOffset.y;
27
- const {
28
- previousScrollY,
29
- swipeThreshold
30
- } = this.state;
31
- const delta = currentScrollY - previousScrollY;
32
- if (Math.abs(delta) > swipeThreshold) {
33
- if (delta > 0) {
21
+ const scrollPosition = event.nativeEvent.contentOffset.y;
22
+ if (Math.abs(scrollPosition - this.previousScrollPosition) >= 8 && scrollPosition >= 0) {
23
+ const e = event;
24
+ if (scrollPosition > this.previousScrollPosition) {
25
+ e.scrollDirection = 1;
34
26
  this.invokeEventCallback('onSwipeup', [null, this.proxy]);
27
+ } else if (scrollPosition === this.previousScrollPosition) {
28
+ e.scrollDirection = 0;
35
29
  } else {
30
+ e.scrollDirection = -1;
36
31
  this.invokeEventCallback('onSwipedown', [null, this.proxy]);
37
32
  }
38
- this.setState({
39
- previousScrollY: currentScrollY
40
- });
33
+ this.previousScrollPosition = scrollPosition;
34
+ this.notify('scroll', [e]);
41
35
  }
42
- this.notify('scroll', [event]);
43
36
  });
44
37
  this.hideMode = HideMode.DONOT_ADD_TO_DOM;
45
38
  this.scrollRef = /*#__PURE__*/createRef();
46
- this.state = {
47
- ...this.state,
48
- previousScrollY: 0,
49
- swipeThreshold: 8
50
- };
51
39
  this.subscribe('scrollToPosition', args => {
52
40
  this.scrollTo(args);
53
41
  });
@@ -1 +1 @@
1
- {"version":3,"names":["React","createRef","KeyboardAvoidingView","Platform","View","isWebPreviewMode","HideMode","BaseComponent","BaseComponentState","WmPageContentProps","DEFAULT_CLASS","ScrollView","WmLottie","SafeAreaInsetsContext","WmPageContentState","constructor","args","_defineProperty","WmPageContent","props","event","currentScrollY","nativeEvent","contentOffset","y","previousScrollY","swipeThreshold","state","delta","Math","abs","invokeEventCallback","proxy","setState","notify","hideMode","DONOT_ADD_TO_DOM","scrollRef","subscribe","scrollTo","_this$scrollRef","current","scrollToEnd","position","_this$scrollRef2","x","Animated","renderSkeleton","skeletonanimationresource","createElement","style","width","styles","root","content","skeleton","source","loop","autoplay","speed","skeletonanimationspeed","renderWidget","showScrollbar","scrollbarColor","scrollable","height","backgroundColor","_showSkeleton","_background","Consumer","insets","top","bottom","left","right","keyboardOffset","verticalOffset","OS","keyboardverticaloffset","behavior","undefined","keyboardVerticalOffset","flex","testID","getTestId","ref","contentContainerStyle","showsVerticalScrollIndicator","onScroll","handleScroll","alwaysBounceVertical","alwaysBounceHorizontal","bounces","scrollEventThrottle","children"],"sources":["page-content.component.tsx"],"sourcesContent":["import React, { createRef, RefObject } from 'react';\nimport { KeyboardAvoidingView, Platform, View, NativeSyntheticEvent, NativeScrollEvent } from 'react-native';\nimport { isWebPreviewMode } from '@wavemaker/app-rn-runtime/core/utils';\nimport { HideMode } from '@wavemaker/app-rn-runtime/core/if.component';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\n\nimport WmPageContentProps from './page-content.props';\nimport { DEFAULT_CLASS, WmPageContentStyles } from './page-content.styles';\nimport { ScrollView } from 'react-native-gesture-handler';\nimport WmLottie from '@wavemaker/app-rn-runtime/components/basic/lottie/lottie.component';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\n\nexport class WmPageContentState extends BaseComponentState<WmPageContentProps> {\n previousScrollY: number = 0;\n swipeThreshold: number = 8;\n}\n\nexport default class WmPageContent extends BaseComponent<WmPageContentProps, WmPageContentState, WmPageContentStyles> {\n private scrollRef: RefObject<any>;\n\n constructor(props: WmPageContentProps) {\n super(props, DEFAULT_CLASS, new WmPageContentProps());\n this.hideMode = HideMode.DONOT_ADD_TO_DOM;\n this.scrollRef = createRef();\n \n this.state = {\n ...this.state,\n previousScrollY: 0,\n swipeThreshold: 8\n };\n\n this.subscribe('scrollToPosition', (args: any) => {\n this.scrollTo(args);\n });\n\n this.subscribe('scrollToEnd', () => {\n this.scrollRef?.current.scrollToEnd();\n });\n }\n\n public scrollTo(position: {x: number, y: number}){\n this.scrollRef?.current?.scrollTo({\n x: position.x,\n y: position.y,\n Animated: true\n });\n }\n\n private handleScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {\n const currentScrollY = event.nativeEvent.contentOffset.y;\n const { previousScrollY, swipeThreshold } = this.state;\n \n const delta = currentScrollY - previousScrollY;\n \n if (Math.abs(delta) > swipeThreshold) {\n if (delta > 0) {\n this.invokeEventCallback('onSwipeup', [null, this.proxy]);\n \n } else {\n this.invokeEventCallback('onSwipedown', [null, this.proxy]);\n }\n this.setState({ previousScrollY: currentScrollY });\n }\n this.notify('scroll', [event]);\n };\n\n public renderSkeleton(props: WmPageContentProps): React.ReactNode {\n if(this.props.skeletonanimationresource) {\n return <View style={[{width: '100%'}, this.styles.root]}>\n <WmLottie styles={{ content: {...this.styles.root, ...this.styles.skeleton.root} }} source={this.props.skeletonanimationresource} loop={true} autoplay={true} speed={this.props.skeletonanimationspeed}/>\n </View>\n } \n return null;\n } \n\n renderWidget(props: WmPageContentProps) {\n const showScrollbar = (this.styles.root as any).scrollbarColor != 'transparent';\n \n return (props.scrollable || isWebPreviewMode()) ? (\n <View style={{height: '100%', width: '100%', backgroundColor: this._showSkeleton && this.styles.skeleton.root.backgroundColor ? this.styles.skeleton.root.backgroundColor : this.styles.root.backgroundColor}}>\n {this._background}\n <SafeAreaInsetsContext.Consumer>\n {(insets = { top: 0, bottom: 0, left: 0, right: 0 }) => {\n const keyboardOffset = insets?.bottom || 0;\n const verticalOffset = Platform.OS === 'ios' ? keyboardOffset + props.keyboardverticaloffset : keyboardOffset;\n return (\n <KeyboardAvoidingView\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={verticalOffset}\n style={{ flex: 1 }}>\n <ScrollView \n testID={this.getTestId(\"page_content_scrollview\")}\n ref={this.scrollRef}\n contentContainerStyle={[this.styles.root, {backgroundColor: 'transparent'}]}\n showsVerticalScrollIndicator={showScrollbar}\n onScroll={this.handleScroll}\n alwaysBounceVertical={false}\n alwaysBounceHorizontal={false}\n bounces={false}\n scrollEventThrottle={48}>\n {props.children}\n </ScrollView>\n </KeyboardAvoidingView>\n )}}\n </SafeAreaInsetsContext.Consumer>\n </View> \n ) : (\n <View style={[this.styles.root,\n {backgroundColor: this._showSkeleton ?\n this.styles.skeleton.root.backgroundColor : \n this.styles.root.backgroundColor}]}>\n <SafeAreaInsetsContext.Consumer>\n {(insets = { top: 0, bottom: 0, left: 0, right: 0 }) => {\n const keyboardOffset = insets?.bottom || 0;\n const verticalOffset = Platform.OS === 'ios' ? keyboardOffset + props.keyboardverticaloffset : keyboardOffset;\n return (\n <KeyboardAvoidingView\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={verticalOffset}\n style={{ flex: 1 }}>\n {this._background}\n {props.children}\n </KeyboardAvoidingView>\n )}}\n </SafeAreaInsetsContext.Consumer>\n </View>\n );\n }\n}"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAmB,OAAO;AACnD,SAASC,oBAAoB,EAAEC,QAAQ,EAAEC,IAAI,QAAiD,cAAc;AAC5G,SAASC,gBAAgB,QAAQ,sCAAsC;AACvE,SAASC,QAAQ,QAAQ,6CAA6C;AACtE,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AAEjG,OAAOC,kBAAkB,MAAM,sBAAsB;AACrD,SAASC,aAAa,QAA6B,uBAAuB;AAC1E,SAASC,UAAU,QAAQ,8BAA8B;AAC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,oBACE3E,KAAA,CAAAiD,aAAA,CAAC/C,oBAAoB;QACnB6E,QAAQ,EAAE5E,QAAQ,CAAC0E,EAAE,KAAK,KAAK,GAAG,SAAS,GAAGG,SAAU;QACxDC,sBAAsB,EAAEL,cAAe;QACvC1B,KAAK,EAAE;UAAEgC,IAAI,EAAE;QAAE;MAAE,GAClB,IAAI,CAACd,WAAW,EAChBjD,KAAK,CAAC2E,QACa,CAAC;IACxB,CAC2B,CAC5B,CACP;EACH;AACF","ignoreList":[]}
1
+ {"version":3,"names":["React","createRef","KeyboardAvoidingView","Platform","View","isWebPreviewMode","HideMode","BaseComponent","BaseComponentState","WmPageContentProps","DEFAULT_CLASS","ScrollView","WmLottie","SafeAreaInsetsContext","WmPageContentState","WmPageContent","constructor","props","_defineProperty","event","scrollPosition","nativeEvent","contentOffset","y","Math","abs","previousScrollPosition","e","scrollDirection","invokeEventCallback","proxy","notify","hideMode","DONOT_ADD_TO_DOM","scrollRef","subscribe","args","scrollTo","_this$scrollRef","current","scrollToEnd","position","_this$scrollRef2","x","Animated","renderSkeleton","skeletonanimationresource","createElement","style","width","styles","root","content","skeleton","source","loop","autoplay","speed","skeletonanimationspeed","renderWidget","showScrollbar","scrollbarColor","scrollable","height","backgroundColor","_showSkeleton","_background","Consumer","insets","top","bottom","left","right","keyboardOffset","verticalOffset","OS","keyboardverticaloffset","behavior","undefined","keyboardVerticalOffset","flex","testID","getTestId","ref","contentContainerStyle","showsVerticalScrollIndicator","onScroll","handleScroll","alwaysBounceVertical","alwaysBounceHorizontal","bounces","scrollEventThrottle","children"],"sources":["page-content.component.tsx"],"sourcesContent":["import React, { createRef, RefObject } from 'react';\nimport { KeyboardAvoidingView, Platform, View, NativeSyntheticEvent, NativeScrollEvent } from 'react-native';\nimport { isWebPreviewMode } from '@wavemaker/app-rn-runtime/core/utils';\nimport { HideMode } from '@wavemaker/app-rn-runtime/core/if.component';\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\n\nimport WmPageContentProps from './page-content.props';\nimport { DEFAULT_CLASS, WmPageContentStyles } from './page-content.styles';\nimport { ScrollView } from 'react-native-gesture-handler';\nimport WmLottie from '@wavemaker/app-rn-runtime/components/basic/lottie/lottie.component';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\n\nexport class WmPageContentState extends BaseComponentState<WmPageContentProps> {}\n\nexport interface CustomScrollEvent {\n scrollDirection: number;\n}\n\nexport default class WmPageContent extends BaseComponent<WmPageContentProps, WmPageContentState, WmPageContentStyles> {\n private scrollRef: RefObject<any>;\n private previousScrollPosition: number = 0;\n\n constructor(props: WmPageContentProps) {\n super(props, DEFAULT_CLASS, new WmPageContentProps());\n this.hideMode = HideMode.DONOT_ADD_TO_DOM;\n this.scrollRef = createRef();\n\n this.subscribe('scrollToPosition', (args: any) => {\n this.scrollTo(args);\n });\n\n this.subscribe('scrollToEnd', () => {\n this.scrollRef?.current.scrollToEnd();\n });\n }\n\n public scrollTo(position: {x: number, y: number}){\n this.scrollRef?.current?.scrollTo({\n x: position.x,\n y: position.y,\n Animated: true\n });\n }\n\n private handleScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {\n const scrollPosition = event.nativeEvent.contentOffset.y;\n if(Math.abs(scrollPosition - this.previousScrollPosition) >= 8 && scrollPosition >=0){\n const e = event as unknown as CustomScrollEvent;\n if (scrollPosition > this.previousScrollPosition) {\n e.scrollDirection = 1;\n this.invokeEventCallback('onSwipeup', [null, this.proxy]);\n } else if (scrollPosition === this.previousScrollPosition) {\n e.scrollDirection = 0;\n } else {\n e.scrollDirection = -1;\n this.invokeEventCallback('onSwipedown', [null, this.proxy]);\n }\n this.previousScrollPosition = scrollPosition;\n this.notify('scroll', [e]);\n }\n };\n\n public renderSkeleton(props: WmPageContentProps): React.ReactNode {\n if(this.props.skeletonanimationresource) {\n return <View style={[{width: '100%'}, this.styles.root]}>\n <WmLottie styles={{ content: {...this.styles.root, ...this.styles.skeleton.root} }} source={this.props.skeletonanimationresource} loop={true} autoplay={true} speed={this.props.skeletonanimationspeed}/>\n </View>\n } \n return null;\n } \n\n renderWidget(props: WmPageContentProps) {\n const showScrollbar = (this.styles.root as any).scrollbarColor != 'transparent';\n \n return (props.scrollable || isWebPreviewMode()) ? (\n <View style={{height: '100%', width: '100%', backgroundColor: this._showSkeleton && this.styles.skeleton.root.backgroundColor ? this.styles.skeleton.root.backgroundColor : this.styles.root.backgroundColor}}>\n {this._background}\n <SafeAreaInsetsContext.Consumer>\n {(insets = { top: 0, bottom: 0, left: 0, right: 0 }) => {\n const keyboardOffset = insets?.bottom || 0;\n const verticalOffset = Platform.OS === 'ios' ? keyboardOffset + props.keyboardverticaloffset : keyboardOffset;\n return (\n <KeyboardAvoidingView\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={verticalOffset}\n style={{ flex: 1 }}>\n <ScrollView \n testID={this.getTestId(\"page_content_scrollview\")}\n ref={this.scrollRef}\n contentContainerStyle={[this.styles.root, {backgroundColor: 'transparent'}]}\n showsVerticalScrollIndicator={showScrollbar}\n onScroll={this.handleScroll}\n alwaysBounceVertical={false}\n alwaysBounceHorizontal={false}\n bounces={false}\n scrollEventThrottle={48}>\n {props.children}\n </ScrollView>\n </KeyboardAvoidingView>\n )}}\n </SafeAreaInsetsContext.Consumer>\n </View> \n ) : (\n <View style={[this.styles.root,\n {backgroundColor: this._showSkeleton ?\n this.styles.skeleton.root.backgroundColor : \n this.styles.root.backgroundColor}]}>\n <SafeAreaInsetsContext.Consumer>\n {(insets = { top: 0, bottom: 0, left: 0, right: 0 }) => {\n const keyboardOffset = insets?.bottom || 0;\n const verticalOffset = Platform.OS === 'ios' ? keyboardOffset + props.keyboardverticaloffset : keyboardOffset;\n return (\n <KeyboardAvoidingView\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={verticalOffset}\n style={{ flex: 1 }}>\n {this._background}\n {props.children}\n </KeyboardAvoidingView>\n )}}\n </SafeAreaInsetsContext.Cons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AC;MAAEC,MAAM,EAAE,CAAC;MAAEC,IAAI,EAAE,CAAC;MAAEC,KAAK,EAAE;IAAE,CAAC,KAAK;MACtD,MAAMC,cAAc,GAAG,CAAAL,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEE,MAAM,KAAI,CAAC;MAC1C,MAAMI,cAAc,GAAGvE,QAAQ,CAACwE,EAAE,KAAK,KAAK,GAAGF,cAAc,GAAGxD,KAAK,CAAC2D,sBAAsB,GAAGH,cAAc;MAC7G,oBACEzE,KAAA,CAAA+C,aAAA,CAAC7C,oBAAoB;QACnB2E,QAAQ,EAAE1E,QAAQ,CAACwE,EAAE,KAAK,KAAK,GAAG,SAAS,GAAGG,SAAU;QACxDC,sBAAsB,EAAEL,cAAe;QACvC1B,KAAK,EAAE;UAAEgC,IAAI,EAAE;QAAE;MAAE,GAClB,IAAI,CAACd,WAAW,EAChBjD,KAAK,CAAC2E,QACa,CAAC;IACxB,CAC2B,CAC5B,CACP;EACH;AACF","ignoreList":[]}
@@ -7,6 +7,7 @@ import { PanResponder, ScrollView, View } from 'react-native';
7
7
  import { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';
8
8
  import { DEFAULT_CLASS } from './page.styles';
9
9
  import { SafeAreaInsetsContext } from 'react-native-safe-area-context';
10
+ import { StickyViewContainer } from '@wavemaker/app-rn-runtime/core/sticky-container.component';
10
11
  export class WmPageState extends BaseComponentState {}
11
12
  export default class WmPage extends BaseComponent {
12
13
  constructor(props) {
@@ -19,9 +20,10 @@ export default class WmPage extends BaseComponent {
19
20
  return false;
20
21
  }
21
22
  }));
22
- _defineProperty(this, "onScroll", e => {
23
- const scrollPosition = e.nativeEvent.contentOffset.y;
23
+ _defineProperty(this, "onScroll", event => {
24
+ const scrollPosition = event.nativeEvent.contentOffset.y;
24
25
  if (Math.abs(scrollPosition - this.previousScrollPosition) >= 8 && scrollPosition >= 0) {
26
+ const e = event;
25
27
  if (scrollPosition > this.previousScrollPosition) {
26
28
  e.scrollDirection = 1;
27
29
  } else if (scrollPosition === this.previousScrollPosition) {
@@ -44,7 +46,7 @@ export default class WmPage extends BaseComponent {
44
46
  });
45
47
  }
46
48
  renderWidget(props) {
47
- return /*#__PURE__*/React.createElement(SafeAreaInsetsContext.Consumer, null, (insets = {
49
+ return /*#__PURE__*/React.createElement(StickyViewContainer, null, /*#__PURE__*/React.createElement(SafeAreaInsetsContext.Consumer, null, (insets = {
48
50
  top: 0,
49
51
  bottom: 0,
50
52
  left: 0,
@@ -62,7 +64,7 @@ export default class WmPage extends BaseComponent {
62
64
  }), this._background, props.children) : /*#__PURE__*/React.createElement(View, {
63
65
  style: this.styles.root
64
66
  }, this._background, props.children);
65
- });
67
+ }));
66
68
  }
67
69
  }
68
70
  //# sourceMappingURL=page.component.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","PanResponder","ScrollView","View","BaseComponent","BaseComponentState","DEFAULT_CLASS","SafeAreaInsetsContext","WmPageState","WmPage","constructor","props","_defineProperty","create","onStartShouldSetPanResponderCapture","e","notify","scrollPosition","nativeEvent","contentOffset","y","Math","abs","previousScrollPosition","scrollDirection","scrollRef","createRef","scrollTo","position","_this$scrollRef","current","x","Animated","renderWidget","createElement","Consumer","insets","top","bottom","left","right","scrollable","_extends","ref","panResponder","panHandlers","style","width","height","styles","root","onScroll","scrollEventThrottle","_background","children"],"sources":["page.component.tsx"],"sourcesContent":["import React from 'react';\nimport { PanResponder, ScrollView, View } from 'react-native';\n\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\n\nimport WmPageProps from './page.props';\nimport { DEFAULT_CLASS, WmPageStyles } from './page.styles';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\n\nexport class WmPageState extends BaseComponentState<WmPageProps> {}\n\nexport default class WmPage extends BaseComponent<WmPageProps, WmPageState, WmPageStyles> {\n private scrollRef: React.RefObject<any>;\n private previousScrollPosition: number = 0;\n\n panResponder = PanResponder.create({\n onStartShouldSetPanResponderCapture: (e) => {\n this.notify('globaltouch', [e]);\n return false;\n },\n });\n constructor(props: WmPageProps) {\n super(props, DEFAULT_CLASS, );\n this.scrollRef = React.createRef();\n }\n\n private onScroll = (e: any)=>{\n const scrollPosition = e.nativeEvent.contentOffset.y;\n if(Math.abs(scrollPosition - this.previousScrollPosition) >= 8 && scrollPosition >=0){\n if (scrollPosition > this.previousScrollPosition) {\n e.scrollDirection = 1;\n } else if (scrollPosition === this.previousScrollPosition) {\n e.scrollDirection = 0;\n } else {\n e.scrollDirection = -1;\n }\n this.previousScrollPosition = scrollPosition;\n this.notify('scroll', [e]);\n }\n }\n\n public scrollTo(position: {x: number, y: number}){\n this.scrollRef?.current?.scrollTo({\n x: position.x,\n y: position.y,\n Animated: true\n });\n }\n\n renderWidget(props: WmPageProps) {\n return (\n <SafeAreaInsetsContext.Consumer>\n {(insets = { top: 0, bottom: 0, left: 0, right: 0 }) => {\n return props.scrollable ? \n <ScrollView\n ref={this.scrollRef}\n {...this.panResponder.panHandlers}\n style={[{ width:'100%', height:'100%' }, this.styles.root]}\n onScroll={this.onScroll}\n scrollEventThrottle={16}\n >\n {this._background}\n {props.children}\n </ScrollView> : \n <View style={this.styles.root}> \n {this._background}\n {props.children}\n </View>\n }}\n </SafeAreaInsetsContext.Consumer>\n ); \n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAE7D,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AAGjG,SAASC,aAAa,QAAsB,eAAe;AAC3D,SAASC,qBAAqB,QAAQ,gCAAgC;AAEtE,OAAO,MAAMC,WAAW,SAASH,kBAAkB,CAAc;AAEjE,eAAe,MAAMI,MAAM,SAASL,aAAa,CAAyC;EAUxFM,WAAWA,CAACC,KAAkB,EAAE;IAC9B,KAAK,CAACA,KAAK,EAAEL,aAAe,CAAC;IAACM,eAAA;IAAAA,eAAA,iCATS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AC/B,oBACIX,KAAA,CAAAkC,aAAA,CAAC3B,qBAAqB,CAAC4B,QAAQ,QAC5B,CAACC,MAAM,GAAG;MAAEC,GAAG,EAAE,CAAC;MAAEC,MAAM,EAAE,CAAC;MAAEC,IAAI,EAAE,CAAC;MAAEC,KAAK,EAAE;IAAE,CAAC,KAAK;MACtD,OAAO7B,KAAK,CAAC8B,UAAU,gBACvBzC,KAAA,CAAAkC,aAAA,CAAChC,UAAU,EAAAwC,QAAA;QACTC,GAAG,EAAE,IAAI,CAAClB;MAAU,GAChB,IAAI,CAACmB,YAAY,CAACC,WAAW;QACjCC,KAAK,EAAE,CAAC;UAAEC,KAAK,EAAC,MAAM;UAAEC,MAAM,EAAC;QAAO,CAAC,EAAE,IAAI,CAACC,MAAM,CAACC,IAAI,CAAE;QAC3DC,QAAQ,EAAE,IAAI,CAACA,QAAS;QACxBC,mBAAmB,EAAE;MAAG,IAEvB,IAAI,CAACC,WAAW,EAChB1C,KAAK,CAAC2C,QACG,CAAC,gBACbtD,KAAA,CAAAkC,aAAA,CAAC/B,IAAI;QAAC2C,KAAK,EAAE,IAAI,CAACG,MAAM,CAACC;MAAK,GAC3B,IAAI,CAACG,WAAW,EAChB1C,KAAK,CAAC2C,QACH,CAAC;IACT,CAC8B,CAAC;EAEvC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["React","PanResponder","ScrollView","View","BaseComponent","BaseComponentState","DEFAULT_CLASS","SafeAreaInsetsContext","StickyViewContainer","WmPageState","WmPage","constructor","props","_defineProperty","create","onStartShouldSetPanResponderCapture","e","notify","event","scrollPosition","nativeEvent","contentOffset","y","Math","abs","previousScrollPosition","scrollDirection","scrollRef","createRef","scrollTo","position","_this$scrollRef","current","x","Animated","renderWidget","createElement","Consumer","insets","top","bottom","left","right","scrollable","_extends","ref","panResponder","panHandlers","style","width","height","styles","root","onScroll","scrollEventThrottle","_background","children"],"sources":["page.component.tsx"],"sourcesContent":["import React from 'react';\nimport { PanResponder, ScrollView, View, NativeSyntheticEvent, NativeScrollEvent} from 'react-native';\n\nimport { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';\n\nimport WmPageProps from './page.props';\nimport { DEFAULT_CLASS, WmPageStyles } from './page.styles';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\nimport { StickyViewContainer } from '@wavemaker/app-rn-runtime/core/sticky-container.component';\n\nexport class WmPageState extends BaseComponentState<WmPageProps> {}\n\nexport interface CustomScrollEvent {\n scrollDirection: number;\n}\n\n\nexport default class WmPage extends BaseComponent<WmPageProps, WmPageState, WmPageStyles> {\n private scrollRef: React.RefObject<any>;\n private previousScrollPosition: number = 0;\n\n panResponder = PanResponder.create({\n onStartShouldSetPanResponderCapture: (e) => {\n this.notify('globaltouch', [e]);\n return false;\n },\n });\n constructor(props: WmPageProps) {\n super(props, DEFAULT_CLASS, );\n this.scrollRef = React.createRef();\n }\n\n private onScroll = (event: NativeSyntheticEvent<NativeScrollEvent>)=>{\n const scrollPosition = event.nativeEvent.contentOffset.y;\n if(Math.abs(scrollPosition - this.previousScrollPosition) >= 8 && scrollPosition >=0){\n const e = event as unknown as CustomScrollEvent;\n if (scrollPosition > this.previousScrollPosition) {\n e.scrollDirection = 1;\n } else if (scrollPosition === this.previousScrollPosition) {\n e.scrollDirection = 0;\n } else {\n e.scrollDirection = -1;\n }\n this.previousScrollPosition = scrollPosition;\n this.notify('scroll', [e]);\n }\n }\n\n public scrollTo(position: {x: number, y: number}){\n this.scrollRef?.current?.scrollTo({\n x: position.x,\n y: position.y,\n Animated: true\n });\n }\n\n renderWidget(props: WmPageProps) {\n return (\n <StickyViewContainer>\n <SafeAreaInsetsContext.Consumer>\n {(insets = { top: 0, bottom: 0, left: 0, right: 0 }) => {\n return props.scrollable ? \n <ScrollView\n ref={this.scrollRef}\n {...this.panResponder.panHandlers}\n style={[{ width:'100%', height:'100%' }, this.styles.root]}\n onScroll={this.onScroll}\n scrollEventThrottle={16}\n >\n {this._background}\n {props.children}\n </ScrollView> : \n <View style={this.styles.root}> \n {this._background}\n {props.children}\n </View>\n }}\n </SafeAreaInsetsContext.Consumer>\n </StickyViewContainer>\n ); \n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,EAAEC,UAAU,EAAEC,IAAI,QAAiD,cAAc;AAEtG,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,+CAA+C;AAGjG,SAASC,aAAa,QAAsB,eAAe;AAC3D,SAASC,qBAAqB,QAAQ,gCAAgC;AACtE,SAASC,mBAAmB,QAAQ,2DAA2D;AAE/F,OAAO,MAAMC,WAAW,SAASJ,kBAAkB,CAAc;AAOjE,eAAe,MAAMK,MAAM,SAASN,aAAa,CAAyC;EAUxFO,WAAWA,CAACC,KAAkB,EAAE;IAC9B,KAAK,CAACA,KAAK,EAAEN,aAAe,CAAC;IAACO,eAAA;IAAAA,eAAA,iCATS,CAAC;IAAAA,eAAA,uBAE3BZ,YAAY,CAACa,MAAM,CAAC;MACjCC,mCAAmC,EAAGC,CAAC,IAAK;QAC1C,IAAI,CAACC,MAAM,CAAC,aAAa,EAAE,CAACD,CAAC,CAAC,CAAC;QAC/B,OAAO,KAAK;MACd;IACF,CAAC,CAAC;IAAAH,eAAA,mBAMkBK,KAA8C,IAAG;MACnE,MAAMC,cAAc,GAAGD,KAAK,CAACE,WAAW,CAACC,aAAa,CAACC,CAAC;MACxD,IAAGC,IAAI,CAACC,GAAG,CAACL,cAAc,GAAG,IAAI,CAACM,sBAAsB,CAAC,IAAI,CAAC,IAAIN,cAAc,IAAG,CAAC,EAAC;QACnF,MAAMH,CAAC,GAAGE,KAAqC;QAC/C,IAAIC,cAAc,GAAG,IAAI,CAACM,sBAAsB,EAAE;UAChDT,CAAC,CAACU,eAAe,GAAG,CAAC;QACvB,CAAC,MAAM,IAAIP,cAAc,KAAK,IAAI,CAACM,sBAAsB,EAAE;UACzDT,CAAC,CAACU,eAAe,GAAG,CAAC;QACvB,CAAC,MAAM;UAC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AAW,EAChB3C,KAAK,CAAC4C,QACG,CAAC,gBACbxD,KAAA,CAAAoC,aAAA,CAACjC,IAAI;QAAC6C,KAAK,EAAE,IAAI,CAACG,MAAM,CAACC;MAAK,GAC3B,IAAI,CAACG,WAAW,EAChB3C,KAAK,CAAC4C,QACH,CAAC;IACT,CAC8B,CACd,CAAC;EAEzB;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["AppConfig.ts"],"sourcesContent":["export interface Drawer {\n setContent: (c: React.ReactNode) => void;\n getContent: () => React.ReactNode;\n setAnimation: (animation: string) => void;\n getAnimation: () => string;\n}\n\nexport default interface AppConfig {\n appId: string;\n assets: any;\n appProperties: any;\n appLocale: any;\n url: string;\n leftNavWidth: any;\n loadApp: boolean;\n refresh: (complete?: boolean) => void,\n currentPage?: any;\n pages?: any[];\n landingPage: string;\n partials?: any[];\n drawer: Drawer;\n app: any;\n spinner: any;\n setDrawerContent: any;\n theme: any;\n drawerType: any;\n preferences:any;\n getServiceDefinitions: any;\n loggedInUser: any;\n selectedLocale: string;\n revertLayoutToExpo50: boolean,\n diagnostics: {\n appStartTime: number,\n appReadyTime: number,\n pageStartTime: number,\n pageReadyTime: number\n }\n}"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["AppConfig.ts"],"sourcesContent":["export interface Drawer {\n setContent: (c: React.ReactNode) => void;\n getContent: () => React.ReactNode;\n setAnimation: (animation: string) => void;\n getAnimation: () => string;\n}\n\nexport default interface AppConfig {\n appId: string;\n assets: any;\n appProperties: any;\n appLocale: any;\n url: string;\n leftNavWidth: any;\n loadApp: boolean;\n refresh: (complete?: boolean) => void,\n currentPage?: any;\n pages?: any[];\n landingPage: string;\n partials?: any[];\n drawer: Drawer;\n app: any;\n spinner: any;\n setDrawerContent: any;\n theme: any;\n drawerType: any;\n preferences:any;\n getServiceDefinitions: any;\n loggedInUser: any;\n selectedLocale: string;\n revertLayoutToExpo50: boolean,\n diagnostics: {\n appStartTime: number,\n appReadyTime: number,\n pageStartTime: number,\n pageReadyTime: number\n }, \n pageScrollTopThreshold: number;\n}"],"mappings":"","ignoreList":[]}
@@ -88,8 +88,16 @@ export class BaseComponent extends React.Component {
88
88
  _defineProperty(this, "_showView", true);
89
89
  _defineProperty(this, "closestTappable", void 0);
90
90
  _defineProperty(this, "componentNode", void 0);
91
- _defineProperty(this, "layout", {});
91
+ _defineProperty(this, "layout", {
92
+ x: 0,
93
+ y: 0,
94
+ width: 0,
95
+ height: 0,
96
+ px: 0,
97
+ py: 0
98
+ });
92
99
  _defineProperty(this, "baseView", View);
100
+ _defineProperty(this, "pcScrollTopThreshold", 0);
93
101
  _defineProperty(this, "hideSkeletonInPageContentWhenDisabledInPage", () => {
94
102
  var _this$parent$state;
95
103
  const isPageContentWidget = this.defaultClass && this.defaultClass === 'app-page-content';
@@ -340,22 +348,24 @@ export class BaseComponent extends React.Component {
340
348
  }
341
349
  };
342
350
  setPosition(newLayoutPosition);
343
- const compnentRef = ref !== null ? ref : this.baseView;
351
+ const componentRef = ref !== null ? ref : this.baseView;
344
352
  // Layout values by measure
345
- if (compnentRef !== null && compnentRef !== void 0 && compnentRef.measure) {
346
- InteractionManager.runAfterInteractions(() => {
347
- requestAnimationFrame(() => {
348
- compnentRef.measure((x = 0, y = 0, width = 0, height = 0, px = 0, py = 0) => {
349
- this.layout = {
350
- x,
351
- y,
352
- width,
353
- height,
354
- px,
355
- py
356
- };
357
- });
353
+ if (componentRef !== null && componentRef !== void 0 && componentRef.measure) {
354
+ const updateLayout = () => {
355
+ componentRef.measure((x = 0, y = 0, width = 0, height = 0, px = 0, py = 0) => {
356
+ this.layout = {
357
+ x,
358
+ y,
359
+ width,
360
+ height,
361
+ px,
362
+ py
363
+ };
358
364
  });
365
+ };
366
+ updateLayout();
367
+ InteractionManager.runAfterInteractions(() => {
368
+ requestAnimationFrame(updateLayout);
359
369
  });
360
370
  }
361
371
  }