Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: Avatar: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead. #2498

Open
Casper321 opened this issue May 8, 2024 · 3 comments

Comments

@Casper321
Copy link

Issue Description

Warning: Avatar: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.

Warning: Avatar: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.
    in Avatar (created by Message)
    in RCTView (created by View)
    in View (created by Message)
    in RCTView (created by View)
    in View (created by Message)
    in Message (created by CellRenderer)
    in RCTView (created by View)
    in View (created by CellRenderer)
    in VirtualizedListCellContextProvider (created by CellRenderer)
    in CellRenderer (created by VirtualizedList)
    in RCTScrollContentView (created by ScrollView)
    in RCTScrollView (created by ScrollView)
    in ScrollView (created by ScrollView)
    in ScrollView (created by VirtualizedList)
    in VirtualizedListContextProvider (created by VirtualizedList)
    in VirtualizedList (created by FlatList)
    in FlatList (created by MessageContainer)
    in RCTView (created by View)
    in View (created by MessageContainer)
    in MessageContainer (created by GiftedChat)
    in RCTView (created by View)
    in View (created by GiftedChat)
    in RCTView (created by View)
    in View (created by KeyboardAvoidingView)
    in KeyboardAvoidingView (created by GiftedChat)
    in RCTView (created by View)
    in View (created by GiftedChat)
    in RCTView (created by View)
    in View (created by ActionSheet)
    in ActionSheet
    in ActionSheetProvider (created by GiftedChat)
    in RCTView (created by View)
    in View (created by GiftedChat)
    in GiftedChat (created by Chat)
    in RCTView (created by View)
    in View (created by emotion(View))
    in emotion(View) (created by Chat)
    in RCTView (created by View)
    in View (created by Chat)
    in Chat (created by SceneView)
    in StaticContainer
    in EnsureSingleNavigator (created by SceneView)
    in SceneView (created by BottomTabView)
    in RCTView (created by View)
    in View (created by Screen)
    in RCTView (created by View)
    in View (created by Background)
    in Background (created by Screen)
    in Screen (created by BottomTabView)
    in RNSScreen (created by Animated(Anonymous))
    in Animated(Anonymous) (created by InnerScreen)
    in Suspender (created by Freeze)
    in Suspense (created by Freeze)
    in Freeze (created by DelayedFreeze)
    in DelayedFreeze (created by InnerScreen)
    in InnerScreen (created by Screen)
    in Screen (created by MaybeScreen)
    in MaybeScreen (created by BottomTabView)
    in RNSScreenNavigationContainer (created by ScreenContainer)
    in ScreenContainer (created by MaybeScreenContainer)
    in MaybeScreenContainer (created by BottomTabView)
    in RNCSafeAreaProvider (created by SafeAreaProvider)
    in SafeAreaProvider (created by SafeAreaProviderCompat)
    in SafeAreaProviderCompat (created by BottomTabView)
    in BottomTabView (created by BottomTabNavigator)
    in PreventRemoveProvider (created by NavigationContent)
    in NavigationContent
    in Unknown (created by BottomTabNavigator)
    in BottomTabNavigator (created by App)
    in EnsureSingleNavigator
    in BaseNavigationContainer
    in ThemeProvider
    in NavigationContainerInner (created by App)
    in ConversationProvider (created by App)
    in QueryClientProvider (created by App)
    in App (created by withDevTools(App))
    in withDevTools(App)
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in main(RootComponent)

Steps to Reproduce / Code Snippets

"dependencies": {
    "@emotion/native": "^11.11.0",
    "@emotion/react": "^11.11.4",
    "@expo/vector-icons": "^14.0.1",
    "expo": "^51.0.0",
    "expo-auth-session": "^5.5.2",
    "expo-status-bar": "^1.12.1",
    "react": "18.2.0",
    "react-native": "^0.74.1",
    "react-native-gesture-handler": "^2.16.2",
    "react-native-gifted-chat": "^2.4.0",
    "react-native-safe-area-context": "^4.10.1",
    "react-native-screens": "^3.31.1",
    "react-native-toast-message": "^2.2.0",
    "ts-node": "^10.9.2",
     ...
  },

Expected Results

No warning

Additional Information

  • Nodejs version: v20.10.0
  • React version: 18.2.0
  • React Native version: 0.74.1
  • react-native-gifted-chat version: 2.4.0
  • Platform(s) (iOS, Android, or both?): iOS (not sure about Android)
  • TypeScript version: 5.1.3

Happy to help implementing the fix if you agree and point me in the right direction.

@cool3rain
Copy link

temporary solution

const error = console.error; console.error = (...args) => { if (/defaultProps/.test(args[0])) return; error(...args); };

@jonathan200934
Copy link

Same error here after upgrading to expo sdk 51

@jkronk
Copy link

jkronk commented May 14, 2024

Also getting this one in expo sdk 51. @cool3rain fix works when put in the root _layout.tsx. Just keeping a log going of all the suppressed warnings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants