We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to add a dropdown arrow next to each section header? Something like below...
The text was updated successfully, but these errors were encountered:
I was able to achieve this with the following code. You can adjust the rotateZ amount according to your design.
rotateZ
export const CollapsibleSection = (props: CollapsibleSectionProps) => { const styles = useStyles() const [isCollapsed, setIsCollapsed] = useState(props.collapsedByDefault ?? false) const open = useSharedValue(isCollapsed) const progress = useDerivedValue(() => (open.value ? withTiming(1) : withTiming(0))) const onToggleCollapse = () => { setIsCollapsed(!isCollapsed) open.value = !open.value } return ( <View> <RaisedBox style={styles.header} onPress={onToggleCollapse}> <Label color="$textMuted">{props.title}</Label> <Chevron progress={progress} /> </RaisedBox> <Collapsible collapsed={isCollapsed}> {props.children} </Collapsible> </View> ) } export interface ChevronProps { progress: Animated.SharedValue<number> } export const Chevron = ({ progress }: ChevronProps) => { const animatedStyle = useAnimatedStyle<AnimatedStyleProp<ViewStyle>>(() => { const value = Math.PI - progress.value * Math.PI return { transform: [{ rotateZ: `${value}rad` }], } }) return ( <Animated.View style={animatedStyle}> <Icon id="chevron-up" stroke="gray" /> </Animated.View> ) }
Sorry, something went wrong.
No branches or pull requests
Is there a way to add a dropdown arrow next to each section header? Something like below...
The text was updated successfully, but these errors were encountered: