Skip to content

Usage of defaultProps #4418

Closed
Closed
@foxysolutions

Description

@foxysolutions

Current behaviour

When loading TextInput, a warning is shown: "Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead. at TextInput.icon"

Full exception/stacktrace at the bottom.

Expected behaviour

Everything continues to work as before

Your Environment

Usage of Expo SDK 51.0.8
"expo": "~51.0.8",
"expo-application": "~5.9.1",
"react": "18.2.0",
"react-native": "0.74.1",
"react-native-paper": "^5.12.3",
"react-native-paper-select": "^1.1.1",

Already tried

  • Upgrading from 5.7.0 to latest 5.12.3 version

Hope someone can help to detect what's causing this and whether we can (easily) resolve this.
Thanks in advance!

Implementation

import { Headline, TextInput, Checkbox, Button } from 'react-native-paper';

<View>
<TextInput 
	label                   = { transl.t( 'addform_field_coords' ) } 
	value                   = { ( this.state.newCoords ) ? this.state.newCoords.latitude + ', ' + this.state.newCoords.longitude : '' }
	mode                    = 'outlined'
	disabled                = {true}
	/>

<TextInput 
	ref                     = { cmp => this.spotTitle = cmp }
	label                   = { transl.t( 'addform_field_title' ) }
	placeholder             = { transl.t( 'addform_field_title_placeholder' ) }
	value                   = { this.state.title } 
	onChangeText            = { t => this.setState( { title: t } ) } 
	onSubmitEditing         = { () => { this.spotDescription.focus() } }
	mode                    = 'outlined'
	/>
<TextInput 
	ref                     = { cmp => this.spotDescription = cmp }
	label                   = { transl.t( 'addform_field_description' ) }
	placeholder             = { transl.t( 'addform_field_description_placeholder' ) }
	value                   = { this.state.description }
	onChangeText            = { d => this.setState( { description: d } ) }
	onSubmitEditing         = { () => { this.userName.focus() } }
	mode                    = 'outlined'
	/>
<TextInput
	ref                     = { cmp => this.userName = cmp }
	label                   = { transl.t( 'contactform_field_name' ) }
	placeholder             = { transl.t( 'contactform_field_name_placeholder' ) }
	value                   = { this.state.name }
	onChangeText            = { n => this.setState( { name: n } ) }
	onSubmitEditing         = { () => { this.userEmail.focus() } }
	mode                    = 'outlined'
	textContentType         = 'name'
	autoCompleteType        = 'name'
	returnKeyType           = 'next'
	blurOnSubmit            = {false}
	/>

<TextInput
	ref                     = { cmp => this.userEmail = cmp }
	label                   = { transl.t( 'contactform_field_email' ) }
	placeholder             = { transl.t( 'contactform_field_email_placeholder' ) }
	value                   = { this.state.email }
	onChangeText            = { e => this.setState( { email: e } ) }
	mode                    = 'outlined'
	textContentType         = 'emailAddress'
	keyboardType            = 'email-address'
	autoCompleteType        = 'email'
	returnKeyType           = 'send'
	blurOnSubmit            = {true}
	/>

<Button 
	icon                    = 'checkbox-marked-circle-plus-outline'
	mode                    = 'contained'
	onPress                 = { () => this.submitForm() }
	style                   = { styles.button }
	disabled                = { this.state.buttonDisabled }
	>                        
	{ transl.t( 'button_send' ) }
</Button>
</View>

Full Stack trace/exception log

Warning: TextInput.Icon: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.
in TextInput.Icon (created by PaperSelect)
in IconAdornment (created by TextInputAdornment)
in TextInputAdornment (created by TextInputOutlined)
in RCTView (created by View)
in View (created by TextInputOutlined)
in RCTView (created by View)
in View (created by TextInputOutlined)
in TextInputOutlined
in Unknown (created by PaperSelect)
in RCTView (created by View)
in View (created by PaperSelect)
in PaperSelect (created by AddScreen)
in RCTView (created by View)
in View (created by View)
in View (created by AddScreen)
in RCTScrollContentView (created by ScrollView)
in RCTScrollView (created by ScrollView)
in ScrollView (created by ScrollView)
in ScrollView (created by ScrollView)
in ScrollView (created by AddScreen)
in RCTView (created by View)
in View (created by KeyboardAvoidingView)
in KeyboardAvoidingView (created by KeyboardAvoidingView)
in KeyboardAvoidingView (created by AddScreen)
in RCTView (created by View)
in View (created by View)
in View (created by AddScreen)
in AddScreen (created by SceneView)
in StaticContainer
in EnsureSingleNavigator (created by SceneView)
in SceneView (created by BottomTabView)
in RCTView (created by View)
in View (created by SceneContent)
in SceneContent (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 ResourceSavingScene)
in ResourceSavingScene (created by BottomTabView)
in RNSScreenContainer (created by ScreenContainer)
in ScreenContainer (created by BottomTabView)
in SafeAreaProviderCompat (created by BottomTabView)
in BottomTabView (created by BottomTabNavigator)
in BottomTabNavigator (created by App)
in EnsureSingleNavigator
in BaseNavigationContainer
in ThemeProvider
in NavigationContainer (created by App)
in ThemeProvider (created by Provider)
in RCTView (created by View)
in View (created by Portal.Host)
in Portal.Host (created by Provider)
in RNCSafeAreaProvider (created by SafeAreaProvider)
in SafeAreaProvider (created by SafeAreaInsetsContext)
in SafeAreaProviderCompat (created by Provider)
in Provider (created by App)
in RegionProvider (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)
transform[stderr]: Missing transform.routerRoot option in Metro bundling request, falling back to app as routes directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions