1

I just ran into issues with reanimated 2 (2.7.0) while trying to build react native for ios with the following errors:

 ERROR  TypeError: Cannot add new property '__reanimatedHostObjectRef'

This error is located at:

in AnimatedComponent(View) (at createAnimatedComponent.tsx:693)
in Unknown
in StyledNativeComponent (created by Styled(Component))
in Styled(Component) (at sheet.tsx:13)
in PanGestureHandler (at sheet.tsx:12)
in SheetContainer (at staff.tsx:59)
in StaffSheet (at App.tsx:45)
in RCTView (at View.js:32)
in View (at App.tsx:40)
in ApolloProvider (at App.tsx:39)
in App (at renderApplication.js:48)
in RCTView (at View.js:32)
in View (at AppContainer.js:106)
in RCTView (at View.js:32)
in View (at AppContainer.js:133)
in AppContainer (at renderApplication.js:41)
in mobile(RootComponent) (at renderApplication.js:57), js engine: hermes

Any idea on how to resolve this?

yaxx
  • 529
  • 1
  • 6
  • 22

1 Answers1

0

Related issue here: https://github.com/software-mansion/react-native-reanimated/issues/1517

Did you try to deep copy the object/array of objects using JSON.parse(JSON.stringify(items)) as mentioned in the thread?

Obsidianlab
  • 667
  • 1
  • 4
  • 24
  • Thanks Obsidianlab for the reply but I don't have any deep copy as describe above – yaxx Apr 20 '22 at 18:28
  • You need to share more of your code where this error is happening. The point in my answer is that having a deep copy fixes the issue. At least it did in the case mentioned above. Please read the answer in the GitHub issue very well at the bottom. – Obsidianlab Apr 20 '22 at 19:53
  • Thanks once again. that was quit helpful, I thought the problem was coming from the reanimated 2 package when it actually from my code as you suggested – yaxx Apr 21 '22 at 14:28