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

Usage of defaultProps #4418

Closed
foxysolutions opened this issue May 25, 2024 · 2 comments
Closed

Usage of defaultProps #4418

foxysolutions opened this issue May 25, 2024 · 2 comments
Labels

Comments

@foxysolutions
Copy link

foxysolutions commented May 25, 2024

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.

@mike-rbrts
Copy link

Refer to: #4385 (comment)

@foxysolutions
Copy link
Author

Missed the open PR #4385, can close this issue, assuming it'll be released soon.

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

No branches or pull requests

2 participants