Skip to content

Commit 8be0367

Browse files
authored
Merge branch 'main' into create-native-pipeline
2 parents e15c63e + a2ff25b commit 8be0367

12 files changed

Lines changed: 41 additions & 75 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"setup-android": "node ./detox/scripts/setup-android.js",
3535
"setup-ios": "node ./detox/scripts/setup-ios.js",
3636
"patch-package": "./scripts/patch/patch-package.sh",
37-
"build:widgets": "node ./scripts/buildWidgets.js"
37+
"build:widgets": "node ./scripts/widget/buildWidgets.js"
3838
},
3939
"workspaces": {
4040
"packages": [

packages/pluggableWidgets/accordion-native/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- Fixed a bug where the accordion state was not updating correctly when the "Collapsed" attribute was selected.
12+
13+
- Resolved an issue where the accordion's dynamic content was not updating its height after the initial render.
14+
915
## [2.2.0] - 2022-04-07
1016

1117
### Added

packages/pluggableWidgets/accordion-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "accordion-native",
33
"widgetName": "Accordion",
4-
"version": "2.2.0",
4+
"version": "2.2.1",
55
"license": "Apache-2.0",
66
"repository": {
77
"type": "git",

packages/pluggableWidgets/accordion-native/src/Accordion.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createElement, ReactElement, useState, useCallback, useEffect } from "react";
2-
import { View } from "react-native";
2+
import { View, LayoutAnimation, Platform, UIManager } from "react-native";
33
import { flattenStyles } from "@mendix/piw-native-utils-internal";
44
import { executeAction } from "@mendix/piw-utils-internal";
55
import { ValueStatus } from "mendix";
@@ -10,6 +10,10 @@ import { AccordionGroup } from "./components/AccordionGroup";
1010

1111
export type Props = AccordionProps<AccordionStyle>;
1212

13+
if (Platform.OS === "android" && UIManager.setLayoutAnimationEnabledExperimental) {
14+
UIManager.setLayoutAnimationEnabledExperimental(true);
15+
}
16+
1317
export function Accordion(props: Props): ReactElement | null {
1418
const styles = flattenStyles(defaultAccordionStyle, props.style);
1519
const [expandedGroups, setExpandedGroups] = useState<number[]>(
@@ -41,15 +45,20 @@ export function Accordion(props: Props): ReactElement | null {
4145

4246
const onPressGroupHeader = useCallback(
4347
(group: GroupsType, index: number): void => {
48+
LayoutAnimation.easeInEaseOut();
4449
const expanded = expandedGroups.includes(index);
50+
let newExpandedGroup: number[] = []; // use new expanded group, as we need to state before we call execute action.
4551
if (expanded) {
52+
newExpandedGroup = expandedGroups.filter(i => i !== index);
4653
collapseGroup(index);
4754
} else {
55+
newExpandedGroup = props.collapseBehavior === "singleExpanded" ? [index] : [...expandedGroups, index];
4856
expandGroup(index);
4957
}
58+
props.groups.forEach((g, i) => g.groupCollapsedAttribute?.setValue(!newExpandedGroup.includes(i)));
5059
executeAction(group.groupOnChange);
5160
},
52-
[expandedGroups, expandGroup, collapseGroup]
61+
[expandedGroups, props.groups, props.collapseBehavior, collapseGroup, expandGroup]
5362
);
5463

5564
const checkPropertyValues = (group: GroupsType, i: number): void => {

packages/pluggableWidgets/accordion-native/src/__tests__/__snapshots__/Accordion.spec.tsx.snap

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -101,29 +101,12 @@ exports[`Accordion in collapsible & single expanded group mode renders correctly
101101
</View>
102102
</View>
103103
<View
104-
collapsable={false}
105-
onLayout={[Function]}
106104
style={
107105
{
108-
"height": undefined,
109-
"overflow": undefined,
106+
"overflow": "hidden",
110107
}
111108
}
112-
>
113-
<View
114-
style={
115-
{
116-
"paddingBottom": 24,
117-
"paddingHorizontal": 16,
118-
"paddingTop": 8,
119-
}
120-
}
121-
>
122-
<Text>
123-
Content
124-
</Text>
125-
</View>
126-
</View>
109+
/>
127110
</View>
128111
<View
129112
style={
@@ -209,12 +192,9 @@ exports[`Accordion in collapsible & single expanded group mode renders correctly
209192
</View>
210193
</View>
211194
<View
212-
collapsable={false}
213-
onLayout={[Function]}
214195
style={
215196
{
216-
"height": undefined,
217-
"overflow": undefined,
197+
"overflow": "hidden",
218198
}
219199
}
220200
>
Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { createElement, ReactElement, useState, useRef, useEffect, useCallback, ReactNode } from "react";
2-
import { Animated, Easing, View, ViewStyle, LayoutChangeEvent } from "react-native";
1+
import { createElement, ReactElement, ReactNode } from "react";
2+
import { View, ViewStyle } from "react-native";
33

44
interface CollapsibleViewProps {
55
isExpanded: boolean;
@@ -8,39 +8,5 @@ interface CollapsibleViewProps {
88
}
99

1010
export function AnimatedCollapsibleView({ isExpanded, style, children }: CollapsibleViewProps): ReactElement {
11-
const startingHeight = 0;
12-
const animatedHeight = useRef(new Animated.Value(startingHeight)).current;
13-
const [fullHeight, setFullHeight] = useState(startingHeight);
14-
const isFullHeightCalculated = useRef(false);
15-
16-
useEffect(() => {
17-
Animated.timing(animatedHeight, {
18-
toValue: isExpanded ? fullHeight : startingHeight,
19-
duration: 200,
20-
easing: Easing.ease,
21-
useNativeDriver: false
22-
}).start();
23-
}, [isExpanded, fullHeight, animatedHeight]);
24-
25-
const onLayout = useCallback(
26-
(e: LayoutChangeEvent) => {
27-
if (!isFullHeightCalculated.current) {
28-
isFullHeightCalculated.current = true;
29-
setFullHeight(e.nativeEvent.layout.height);
30-
}
31-
},
32-
[isFullHeightCalculated.current]
33-
);
34-
35-
return (
36-
<Animated.View
37-
style={{
38-
height: isFullHeightCalculated.current ? animatedHeight : undefined,
39-
overflow: isFullHeightCalculated.current ? "hidden" : undefined
40-
}}
41-
onLayout={onLayout}
42-
>
43-
<View style={style}>{children}</View>
44-
</Animated.View>
45-
);
11+
return <View style={{ overflow: "hidden" }}>{isExpanded && <View style={style}>{children}</View>}</View>;
4612
}

packages/pluggableWidgets/accordion-native/src/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<package xmlns="http://www.mendix.com/package/1.0/">
3-
<clientModule name="Accordion" version="2.2.0" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="Accordion" version="2.2.1" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="Accordion.xml" />
66
</widgetFiles>

packages/pluggableWidgets/gallery-native/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- We've resolved an issue where the loading indicator was triggered when pulling down the list, even in the absence of a pull-down event.
12+
913
## [1.0.2] - 2023-5-24
1014

1115
### Fixed

packages/pluggableWidgets/gallery-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "gallery-native",
33
"widgetName": "Gallery",
4-
"version": "1.0.2",
4+
"version": "1.0.3",
55
"description": "A flexible gallery widget that renders columns, rows and layouts.",
66
"copyright": "© Mendix Technology BV 2022. All rights reserved.",
77
"license": "Apache-2.0",

packages/pluggableWidgets/gallery-native/src/Gallery.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export const Gallery = (props: GalleryProps<GalleryStyle>): ReactElement => {
115115
pagination={props.pagination}
116116
loadMoreButtonCaption={props.loadMoreButtonCaption}
117117
phoneColumns={props.phoneColumns}
118-
pullDown={pullDown}
118+
pullDown={props.pullDown && pullDown}
119119
pullDownIsExecuting={props.pullDown?.isExecuting ?? false}
120120
scrollDirection={props.scrollDirection}
121121
style={styles}

0 commit comments

Comments
 (0)