oblador / react-native-collapsible

Animated collapsible component for React Native, good for accordions, toggles etc
MIT License
2.46k stars 452 forks source link

Initial state handling seems broken in 1.6.2, re-switched to 1.6.1 and it's working fine #481

Open ReactiveFilos opened 1 month ago

ReactiveFilos commented 1 month ago

I'm in Expo React Native. Initial state: const [isCollapsed, setIsCollapsed] = useState<boolean>(false);

Simply using <Collapsible collapsed={isCollapsed}> with a toggle in a <PressableScale onPress={() => setIsCollapsed((prev) => !prev)}>

Problem is the component just starts closed not caring of initail state passed as prop. useEffect on mount setting isCollapsed STILL to false triggers a re-rendering making it to open.

Switching back to 1.6.1 worked fine.

IndrakumarR commented 1 month ago

I'm in Expo React Native. Initial state: const [isCollapsed, setIsCollapsed] = useState<boolean>(false);

Simply using <Collapsible collapsed={isCollapsed}> with a toggle in a <PressableScale onPress={() => setIsCollapsed((prev) => !prev)}>

Problem is the component just starts closed not caring of initail state passed as prop. useEffect on mount setting isCollapsed STILL to false triggers a re-rendering making it to open.

Switching back to 1.6.1 worked fine.

👍

malikzype commented 1 month ago

Facing Same issue. Works fine on 1.6.1

colbymchenry commented 1 month ago

I'm getting the issue as well.

C0rren commented 2 weeks ago

Same issue, reverted to 1.6.1