react-navigation-shared-element icon indicating copy to clipboard operation
react-navigation-shared-element copied to clipboard

TypeError: undefined is not an object (evaluating 'getPrototypeOf(sourceComponent)')

Open LuuNguyen0811 opened this issue 3 years ago • 7 comments

TypeError: undefined is not an object (evaluating 'getPrototypeOf(sourceComponent)')

I get these errors when i use a render callback for the screen instead of specifying a component prop with createSharedElementStackNavigator. But when I use createStackNavigator it works.

How to fix it. Thanks

<Stack.Screen name="Home">
  {props => <HomeScreen {...props} extraData={someData} />}
</Stack.Screen>

Simulator Screen Shot - iPhone 11 - 2022-04-23 at 16 41 03

LuuNguyen0811 avatar Apr 23 '22 09:04 LuuNguyen0811

Same problem

foterio avatar Aug 01 '22 17:08 foterio

Same issue with

<Stack.Navigator> <Stack.Screen name="Learn" component={LearnScreen} /> <Stack.Screen name="LearnDetails" component={LearnDetailsScreen} /> </Stack.Navigator>

csumrell avatar Aug 09 '22 21:08 csumrell

Same problem

adibkadir avatar Sep 21 '22 01:09 adibkadir

Did anybody solve this?

adibkadir avatar Sep 21 '22 01:09 adibkadir

Ok... adding import { Animated } from 'react-native' solved the problem for me. Not sure why.

adibkadir avatar Sep 21 '22 01:09 adibkadir

Encountered the same issue. I have to use this method so that I can pass some parameters from the navigator to the screen. But it does not work. Is there any other ways to pass the parameters?

RichardBrowning avatar Jan 18 '23 21:01 RichardBrowning

did you guys manage to fix it since? @RichardBrowning @foterio @csumrell sorry to ping you years later, time traveling here :D

pierroo avatar Mar 01 '24 17:03 pierroo