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

Support for defaultProps will be removed. Use JS default parameters instead. #271

Closed
MadhavKanna opened this issue May 17, 2024 · 8 comments

Comments

@MadhavKanna
Copy link

MadhavKanna commented May 17, 2024

ERROR Warning: TextInputComponent: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.
in TextInputComponent
in RCTView (created by View)
in View
in TouchableWithoutFeedback
in RCTView (created by View)
in View
in RCTView (created by View)
in View
in RCTView (created by View)
in View
in TouchableWithoutFeedback
in RCTView (created by View)
in View (created by AppContainer)
in RCTView (created by View)
in View (created by AppContainer)
in AppContainer (created by Modal)
in RCTView (created by View)
in View (created by Modal)
in VirtualizedListContextResetter (created by Modal)
in RCTModalHostView (created by Modal)
in Modal
in RCTView (created by View)
in View
in Unknown (created by DropDownForm)
in RCTView (created by View)
in View (created by DropDownForm)
in DropDownForm (created by ChooseLocationBusiness)
in RCTView (created by View)
in View (created by ChooseLocationBusiness)
in ChooseLocationBusiness
in Unknown (created by Route(index))
in Suspense (created by Route(index))
in Route (created by Route(index))
in Route(index) (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 RNSScreenContainer (created by ScreenContainer)
in ScreenContainer (created by MaybeScreenContainer)
in MaybeScreenContainer (created by BottomTabView)
in RCTView (created by View)
in View (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
in Unknown (created by TabLayout)
in TabLayout
in Unknown (created by Route((tabs)))
in Suspense (created by Route((tabs)))
in Route (created by Route((tabs)))
in Route((tabs)) (created by SceneView)
in StaticContainer
in EnsureSingleNavigator (created by SceneView)
in SceneView (created by SceneView)
in RCTView (created by View)
in View (created by DebugContainer)
in DebugContainer (created by MaybeNestedStack)
in MaybeNestedStack (created by SceneView)
in RCTView (created by View)
in View (created by SceneView)
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 SceneView)
in SceneView (created by NativeStackViewInner)
in Suspender (created by Freeze)
in Suspense (created by Freeze)
in Freeze (created by DelayedFreeze)
in DelayedFreeze (created by ScreenStack)
in RNSScreenStack (created by ScreenStack)
in ScreenStack (created by NativeStackViewInner)
in NativeStackViewInner (created by NativeStackView)
in RCTView (created by View)
in View (created by SafeAreaProviderCompat)
in SafeAreaProviderCompat (created by NativeStackView)
in NativeStackView (created by NativeStackNavigator)
in PreventRemoveProvider (created by NavigationContent)
in NavigationContent
in Unknown (created by NativeStackNavigator)
in NativeStackNavigator
in Unknown (created by AppLayout)
in AppLayout
in Unknown (created by Route(accessed))
in Suspense (created by Route(accessed))
in Route (created by Route(accessed))
in Route(accessed) (created by SceneView)
in StaticContainer
in EnsureSingleNavigator (created by SceneView)
in SceneView (created by QualifiedSlot)
in QualifiedSlot (created by DefaultNavigator)
in PreventRemoveProvider (created by NavigationContent)
in NavigationContent
in Unknown (created by QualifiedNavigator)
in QualifiedNavigator (created by Navigator)
in Navigator (created by DefaultNavigator)
in RNCSafeAreaView
in Unknown (created by DefaultNavigator)
in DefaultNavigator
in Unknown (created by Route())
in Suspense (created by Route())
in Route (created by Route())
in Route() (created by ContextNavigator)
in RNCSafeAreaProvider (created by SafeAreaProvider)
in SafeAreaProvider (created by wrapper)
in wrapper (created by ContextNavigator)
in EnsureSingleNavigator
in BaseNavigationContainer
in ThemeProvider
in NavigationContainerInner (created by ContextNavigator)
in ContextNavigator (created by ExpoRoot)
in ExpoRoot (created by App)
in App (created by ErrorOverlay)
in ErrorToastContainer (created by ErrorOverlay)
in ErrorOverlay (created by withDevTools(ErrorOverlay))
in withDevTools(ErrorOverlay)
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)

This is the error I get when I try to use this component with Expo Go and Typescript.
Suppose fixed this in a pull request, does the author accept pull requests?

@gabrielroodriz
Copy link

This also happened to me after I updated to the. Expo 51 and React Native to the latest one

@AndreiTimofte96
Copy link

same to me. I tried to disable the warning by using logbox, but with no luck.

@zkteco-home
Copy link

same

@aravind3566
Copy link

aravind3566 commented May 31, 2024

use custom props

  renderInputSearch={() => (
              <TextInput
                style={{
                  borderWidth: 0.5,
                  borderColor: '#DDDDDD',
                  paddingHorizontal: 8,
                  marginBottom: 5,
                  margin: 6,
                  height: 45,
                  borderRadius: 5,
                }}
                value={searchText}
                onChangeText={e => {
                  setSearchText(e);
                }}
                placeholder="Search..."
                placeholderTextColor="rgba(0,0,0,.5)"
              />
            )}

@alexandreperron
Copy link

Are there updates for this issue? Thank you.

@MadhavKanna
Copy link
Author

The fix is really simple If I'm not wrong - just replace all defaultProps with default parameters(there literally can't be more low hanging fruit if you want to contribute to open source). I'll definitely have the fix by mid July at most. My work project right now has greater priorities, but I'll def have to address this before launch.

@MadhavKanna
Copy link
Author

Seems like issue has been resolved. I no longer get this warning.

@AndreiTimofte96
Copy link

I can confirm that the issue is gone after upgrading to version 2.12.1.

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

6 participants