Repository: react-native
Issue: TypeError: Object is not defined 
Labels: Stale,Needs: Author Feedback,Needs: Repro

### Description

I upgraded my react native version to 0.75.4 and so react navigations versions also to latest one, but got stuck in the loop saying object is not a function in react. Main page shown for some seconds and then got the below error.

Currently i am using these versions
| @react-navigation/native               | 7.0.14
| @react-navigation/bottom-tabs          | 7.2.0
| @react-navigation/drawer               | 7.1.1
| @react-navigation/stack                | 7.1.1
| @react-navigation/native-stack         | 7.2.0
| react-native-tab-view                  | 4.0.5
| react-native-screens                   | 4.0.0
| react-native-safe-area-context         | 3.3.2
| react-native-gesture-handler           | 2.21.2
| react-native-reanimated                | 3.0.2
| react-native-pager-view                | 6.4.1
| node                                   | 20.0.0
| react                                   | 18.3.1
| react-native                                   | 0.75.4


### Steps to reproduce

yarn install and then run react-native run-android

### React Native Version

0.75.4

### Affected Platforms

Runtime - Android, Runtime - iOS

### Output of `npx react-native info`

```text
info Fetching system and libraries information...
System:
  OS: macOS 15.1
  CPU: (12) arm64 Apple M2 Pro
  Memory: 127.02 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.11.1
    path: /usr/local/bin/node
  Yarn:
    version: 3.6.4
    path: ~/Documents/QCInternalApps/qatarcharity_redesign/node_modules/.bin/yarn
  npm:
    version: 9.6.6
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.01.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK:
    API Levels:
      - "23"
      - "27"
      - "28"
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 28.0.3
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 32.0.0
      - 33.0.0
      - 33.0.1
      - 33.0.2
      - 34.0.0
      - 35.0.0
    System Images:
      - android-30 | Android TV Intel x86 Atom
      - android-33 | Google TV ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
      - android-34 | Google TV ARM 64 v8a
      - android-35 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2022.2 AI-222.4459.24.2221.9971841
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.7
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.75.4
    wanted: 0.75.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: false
  newArchEnabled: false

info React Native v0.76.5 is now available (your project is running on v0.75.4).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.76.5
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.75.4&to=0.76.5
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".
```


### Stacktrace or Logs

```text
E  TypeError: Object is not a function
                                                                                                    
                                                                                                    This error is located at:
                                                                                                        in Main
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in SharedElementSceneView
                                                                                                        in StaticContainer
                                                                                                        in EnsureSingleNavigator
                                                                                                        in SceneView
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in CardSheet
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in Unknown
                                                                                                        in PanGestureHandler
                                                                                                        in PanGestureHandler
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in Unknown
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in Card
                                                                                                        in CardContainer
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in Unknown
                                                                                                        in InnerScreen
                                                                                                        in Unknown
                                                                                                        in MaybeScreen
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in ScreenContainer
                                                                                                        in MaybeScreenContainer
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in Background
                                                                                                        in CardStack
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in SafeAreaProviderCompat
                                                                                                        in RNGestureHandlerRootView
                                                                                                        in GestureHandlerRootView
                                                                                                        in StackView
                                                                                                        in PreventRemoveProvider
                                                                                                        in NavigationContent
                                                                                                        in Unknown
                                                                                                        in SharedElementStackNavigator
                                                                                                        in WrapNavigator
                                                                                                        in StackCampaign
                                                                                                        in StaticContainer
                                                                                                        in EnsureSingleNavigator
                                                                                                        in SceneView
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in Background
                                                                                                        in Screen
                                                                                                        in RNSScreen
                                                                                                        in Unknown
                                                                                                        in Suspender
                                                                                                        in Suspense
                                                                                                        in Freeze
                                                                                                        in DelayedFreeze
                                                                                                        in InnerScreen
                                                                                                        in Unknown
                                                                                                        in MaybeScreen
                                                                                                        in RNSScreenContainer
                                                                                                        in ScreenContainer
                                                                                                        in MaybeScreenContainer
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in SafeAreaProviderCompat
                                                                                                        in BottomTabView
                                                                                                        in PreventRemoveProvider
                                                                                                        in NavigationContent
                                                                                                        in Unknown
                                                                                                        in BottomTabNavigator
                                                                                                        in MyTabs
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in SharedElementSceneView
                                                                                                        in StaticContainer
                                                                                                        in EnsureSingleNavigator
                                                                                                        in SceneView
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in CardSheet
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in Unknown
                                                                                                        in PanGestureHandler
                                                                                                        in PanGestureHandler
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in Unknown
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in Card
                                                                                                        in CardContainer
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in Unknown
                                                                                                        in InnerScreen
                                                                                                        in Unknown
                                                                                                        in MaybeScreen
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in ScreenContainer
                                                                                                        in MaybeScreenContainer
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in Background
                                                                                                        in CardStack
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in SafeAreaProviderCompat
                                                                                                        in RNGestureHandlerRootView
                                                                                                        in GestureHandlerRootView
                                                                                                        in StackView
                                                                                                        in PreventRemoveProvider
                                                                                                        in NavigationContent
                                                                                                        in Unknown
                                                                                                        in SharedElementStackNavigator
                                                                                                        in WrapNavigator
                                                                                                        in Drawer
                                                                                                        in EnsureSingleNavigator
                                                                                                        in BaseNavigationContainer
                                                                                                        in ThemeProvider
                                                                                                        in NavigationContainerInner
                                                                                                        in RNCSafeAreaProvider
                                                                                                        in SafeAreaProvider
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in MenuProvider
                                                                                                        in Unknown
                                                                                                        in Unknown
                                                                                                        in ThemeProvider
                                                                                                        in ToastProvider
                                                                                                        in DesignProvider
                                                                                                        in ForceUiUpdateProvider
                                                                                                        in PersistGate
                                                                                                        in Provider
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in ActionSheet
                                                                                                        in ActionSheetProvider
                                                                                                        in App
                                                                                                        in RNGestureHandlerRootView
                                                                                                        in GestureHandlerRootView
                                                                                                        in gestureHandlerRootHOC(App)
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in RootSiblingsWrapper
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in AppContainer, js engine: hermes, stack:
                                                                                                    safelyCallDestroy@1:432375
                                                                                                    commitHookEffectListUnmount@1:432922
                                                                                                    commitPassiveUnmountEffectsInsideOfDeletedTree_begin@1:442971
                                                                                                    recursivelyTraversePassiveUnmountEffects@1:442283
                                                                                                    commitPassiveUnmountOnFiber@1:442429
                                                                                                    flushPassiveEffects@1:449161
                                                                                                    flushSyncWorkAcrossRoots_impl@1:399218
                                                                                                    scheduleUpdateOnFiber@1:443634
                                                                                                    enqueueForceUpdate@1:458983
                                                                                                    anonymous@1:322037
                                                                                                    anonymous@1:3256778
                                                                                                    anonymous@1:517734
                                                                                                    __debouncedOnEnd@1:499965
                                                                                                    anonymous@1:500387
                                                                                                    __invokeCallback@1:113513
                                                                                                    anonymous@1:111660
                                                                                                    __guard@1:112536
                                                                                                    invokeCallbackAndReturnFlushedQueue@1:111622
```


### Reproducer

https://react.dev/

### Screenshots and Videos

<img width="687" alt="image" src="https://github.com/user-attachments/assets/247dc8fd-2925-4243-9eae-defe3420c0d5" />