-
Notifications
You must be signed in to change notification settings - Fork 89
Slide animation won't work when component is controlled with selectedIndex #302
New issue
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
Comments
Actually, the problem is the version of I hope they will resolve the animation problem. |
|
Any updates on this issue? |
Problem still present :( import SegmentedControld from '@react-native-segmented-control/segmented-control/js/SegmentedControl.js'; |
One workaround is to set a timeout before state change: const [selectedIndex, setSelectedIndex] = useState(0);
return (
<SegmentedControl
values={[0, 1]}
selectedIndex={selectedIndex}
onChange={(event) => {
const index = event.nativeEvent.selectedSegmentIndex;
setTimeout(() => {
setSelectedIndex(index);
}, 200);
}}
/>
) |
It seems this library is not actively maintained anymore. I made a segmented control with pure javascript. It does not require any native linking. https://github.com/WrathChaos/react-native-segmented-control-2 |
Hi there! Thanks for the great library :)
When I'm controlling the component by changing the
selectedIndex
dynamically, the sliding animation doesn't work:You can see the actual code I've been using here, and the video below for the result.
Simulator.Screen.Recording.-.iPhone.11.-.2021-06-11.at.13.42.54.mp4
The text was updated successfully, but these errors were encountered: