react-native-calendar-kit icon indicating copy to clipboard operation
react-native-calendar-kit copied to clipboard

Reanimated warning on set state

Open rithik-raja opened this issue 11 months ago • 9 comments

I get the following warning whenever I setState in the component that the CalendarContainer is being rendered (anything that triggers a rerender):

[Reanimated] Reading from valueduring component render. Please ensure that you do not access thevalueproperty or useget method of a shared value while React is rendering a component.

rithik-raja avatar Jan 15 '25 20:01 rithik-raja

I'm getting this too.

  "dependencies": {
    "@howljs/calendar-kit": "2.2.1",
    "react": "18.3.1",
    "react-native": "0.76.5",
    "react-native-gesture-handler": "2.21.2",
    "react-native-reanimated": "3.16.3",

  ...

  },
Image

ArindamRayMukherjee avatar Jan 16 '25 15:01 ArindamRayMukherjee

I am getting this too

ameenmattar avatar Jan 21 '25 17:01 ameenmattar

@howljs may we know if this will be addressed?

rithik-raja avatar Jan 21 '25 18:01 rithik-raja

The current solution: set strict to false (https://docs.swmansion.com/react-native-reanimated/docs/debugging/logger-configuration)

import {
  configureReanimatedLogger,
  ReanimatedLogLevel,
} from 'react-native-reanimated';

configureReanimatedLogger({
  level: ReanimatedLogLevel.warn,
  strict: false,
});

howljs avatar Jan 21 '25 19:01 howljs

@howljs I am aware of this and I appreciate the response, but that's more so covering up the problem than solving it. Do you have any idea what may be causing the warning, and whether you foresee a fix soon?

rithik-raja avatar Jan 21 '25 19:01 rithik-raja

@howljs Agree with @rithik-raja that simply turning off the configuration will be duck-taping over a potentially insidious bug. Any application that uses react-native-reanimated will be using it for more than one UI control, for example we use it for all our TouchableOpacity controls. Causing race conditions(what the above looks like) might affect any other parts of the app that uses react-native-reanimated might be affected too.

ArindamRayMukherjee avatar Jan 22 '25 07:01 ArindamRayMukherjee

@ArindamRayMukherjee since you're mentioning race-conditions: I'm getting this error after upgrading to the latest kalendar-kit. Related?

ERROR  Your app just crashed. See the error below.
java.util.ConcurrentModificationException
  java.util.ArrayList$Itr.next(ArrayList.java:860)
  com.swmansion.gesturehandler.core.GestureHandlerOrchestrator.onHandlerStateChange(GestureHandlerOrchestrator.kt:105)

This happens when swiping to tomorrow on any android emulator I spin up. I am also geting the aforementioned warning from reanimated.

tedvangageldonk avatar Feb 03 '25 14:02 tedvangageldonk

@tedvangageldonk Possibly related but can't say for sure. I use the ios simulator and then test for Android on a real device. The crash is probably the simulator not being able to handle the race condition. Maybe it doesn't crash on a real Android device?

ArindamRayMukherjee avatar Feb 03 '25 15:02 ArindamRayMukherjee

hi, would you mind if I ask what your react-native-screen version? @ArindamRayMukherjee I am getting a crash when I try to swipe right with these dependencies.

"dependencies": {
    "@howljs/calendar-kit": "2.2.1",
    "react": "18.3.1",
    "react-native": "0.76.6",
     "react-native-gesture-handler": "^2.23.1",
    "react-native-reanimated": "^3.16.7",
    "react-native-screens": "^4.8.0",
}

basaksilasanli avatar Feb 21 '25 12:02 basaksilasanli

@basaksilasanli I'm at 4.3.0

ArindamRayMukherjee avatar Mar 10 '25 15:03 ArindamRayMukherjee

Also facing this issue; Any update on this @howljs ? Do you need contributors?

Pckool avatar Jun 10 '25 20:06 Pckool