Skip to content

Disable overshootClamping for small bottom sheets to avoid Reanimated issue #2387

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

sharifhh
Copy link

@sharifhh sharifhh commented Jul 29, 2025

Hi!

Reanimated v4 introduced a bug in withSpring
software-mansion/react-native-reanimated#7947
software-mansion/react-native-reanimated#7803

this is a temp solution to make this library work for small bottom sheets

@matiaswastaken
Copy link

matiaswastaken commented Jul 30, 2025

With this fix it partially works, but the starting animation is gone meaning when you open the sheet you arent getting the smooth animation (basically same as animateOnMount=false)

@sharifhh
Copy link
Author

actually my whole fix is not needed, the issue is in the new react-native-reanimated withSpring, try to play with the animation configuration and you will see that it works

@matiaswastaken
Copy link

@sharifhh oh hmm, can you share what steps i have to do get this working?

@sharifhh
Copy link
Author

these are the default configs

const ANIMATION_EASING: Animated.EasingFunction = Easing.out(Easing.exp);
const ANIMATION_DURATION = 250;

const ANIMATION_CONFIGS_IOS = {
  damping: 500,
  stiffness: 1000,
  mass: 3,
  overshootClamping: true,
  restDisplacementThreshold: 10,
  restSpeedThreshold: 10,
};

const ANIMATION_CONFIGS_ANDROID = {
  duration: ANIMATION_DURATION,
  easing: ANIMATION_EASING,
};

const ANIMATION_CONFIGS =
  Platform.OS === 'ios' ? ANIMATION_CONFIGS_IOS : ANIMATION_CONFIGS_ANDROID;

now

  restDisplacementThreshold: 10,
restSpeedThreshold: 10,

are removed from withSpring so ignore them, and just set overshootClamping as false and it will be resolved.

I found the issue in reanimated and starting a thread there, will keep you posted and link it here

@sharifhh
Copy link
Author

@sharifhh sharifhh closed this Jul 30, 2025
@sharifhh sharifhh reopened this Jul 30, 2025
@sharifhh sharifhh changed the title Fix race condition Disable overshootClamping for small bottom sheets to avoid Reanimated issue Jul 30, 2025
@matiaswastaken
Copy link

matiaswastaken commented Jul 30, 2025

Thanks for the effort. Is there any quickfix patch that can be applied while we wait, I would need this to be fixed ASAP.

EDIT: Ah just set overshootClamping: false and it seems to work fine. Thanks.

@sharifhh
Copy link
Author

@Willham12
Copy link

Perfect, thanks mate. fix #2272

@justynpollard1
Copy link

Thanks, setting overshootClamping: false in animation config fixed this for me as well. Before my sheets would blink quickly and not appear or just not appear at all.

@KatChaotic
Copy link

Thanks, I apply this changes locally with patch and now modals start working on iOS after migration to new versions

@Yurii-Lutsyk
Copy link

Thanks you!!!

@Splanis
Copy link

Splanis commented Aug 7, 2025

OMG thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants