react-native-reanimated: Exception thrown while executing UI block: *** Collection <__NSSetM: 0x600000ff5820> was mutated while being enumerated.
Description
Hey
I’m experiencing the weirdest error ever => I’m using Modal component from “react-native” and my app didn’t have any issues. I started to use Layout transitions exiting
and entering
yesterday. Since then, everytime I’m dismissing a modal, I’m having this error and I can’t find out what it is :
It’s driving me crazy and I can’t have any more debugs logs to help me out. I really hope you can find a solution because my app is in production and I’m completely stuck
And last but not least => It’s happening randomly 🗡️, sometimes the modal will dismiss properly like 25 times in a row and at some point => error
Expected behavior
Nothing should happen
Actual behavior & steps to reproduce
An error is thrown.
Snack or minimal code example
Init a project with expo SDK 45 Install react native reanimated 2.8.0 Implement a simple Modal :
<View style={{flex: 1}} style={[styles.backdrop, modalVisible ? StyleSheet.absoluteFill : null]}>
<Modal animationType="slide" transparent visible={modalVisible} onRequestClose={onCloseClick} >
<Button onPress={onCloseClick} />
</View>
–>
Package versions
| name | version | | react-native-reanimated | 2.8.0 | | expo | 45 |
Affected platforms
- Android
- [ X] iOS
- Web
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 9
- Comments: 15 (2 by maintainers)
Hey, I know the layout animations are being rewritten atm. But do you have any approximative ETA to give us ? It’s quite huge since I can’t use layout animations anywhere in my apps.
I had the same issue on iOS device, didn’t try on android, unfortunately, I don’t have time to make a repro right now, but here is a description of my setup, if that’s helpful:
The weird thing was:
modal2Callback1
works if not inside thecallbackWithAlert
🤷modal2Callback2
always workmodal2CallbackWithAlert
works if usingmodal2Callback2
, but always crash if usingmodal2Callback1
there is rewriting on the way: #3332
dunno when this will be merged
This issue doesn’t seem to occur after the recent Layout Animations rewrite that’s merged into the newer Reanimated 3 release candidates. If you can’t wait for the release of version 3, you may have some luck patching in the fix in #3298