OnContentSizeChange for TextInput doesn't update width #19696
Labels
Component: TextInput
Related to the TextInput component.
Stale
There has been a lack of activity on this issue and it may be closed soon.
react-native info
in your terminal and paste its contents under "Environment"share an app that reproduces the issue using https://snack.expo.io/
Environment
Description
I'm trying to create a laterally expanding text field - I have tried simply not setting the width of the TextInput component and let it auto expand, but it visually clips the text.
When using onContentSizeChange property of the TextInput component, the event.nativeEvent.contentSize.width does not update correctly. In fact, it only fires twice after input of first two characters then doesn't fire again.
This issue has been raised before, though only with height. Solutions on StackOverflow say to instead use onChange instead, but the event has no contentSize property that I can use.
Steps to Reproduce
Expected Behavior
With the addition of every character, the onContentSizeChange handler should be called and the event passed as an argument to the callback and the e.nativeEvent.contentSize.width should update and represent the width of the TextInput's text (value).
Actual Behavior
Callback fires only twice and returns a width of 524296, presumably because it's never correctly initialized
The text was updated successfully, but these errors were encountered: