Skip to content

Commit

Permalink
test(accordion-native): restore callapsible view
Browse files Browse the repository at this point in the history
  • Loading branch information
Andries-Smit committed Nov 27, 2023
1 parent e6d27f6 commit 5f9cfee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { View, Pressable, Text } from "react-native";
import { DynamicValue, NativeIcon } from "mendix";

import { GroupIcon } from "./GroupIcon";
import { AnimatedCollapsibleView } from "./CollapsibleView";
import { GroupsType, IconEnum } from "../../typings/AccordionProps";
import { AccordionGroupStyle } from "../ui/Styles";

Expand Down Expand Up @@ -53,9 +54,9 @@ export function AccordionGroup({
/>
) : null}
</Pressable>
<View style={{ overflow: "hidden" }}>
{isExpanded && <View style={style.content}>{group.content}</View>}
</View>
<AnimatedCollapsibleView isExpanded={isExpanded} style={style.content}>
{group.content}
</AnimatedCollapsibleView>
</View>
) : null;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { createElement, ReactElement, ReactNode } from "react";
import { View, ViewStyle } from "react-native";

interface CollapsibleViewProps {
isExpanded: boolean;
style: ViewStyle;
children: ReactNode;
}

export function AnimatedCollapsibleView({ isExpanded, style, children }: CollapsibleViewProps): ReactElement {
return <View style={{ overflow: "hidden" }}>{isExpanded && <View style={style}>{children}</View>}</View>;
}

0 comments on commit 5f9cfee

Please sign in to comment.