-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Closed
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Description
Description
onChange/onContentSizeChange not called after setting text to child in , it only works when sets value to it directly (on IOS only).
Reproduction Steps and Sample Code
Set text props to the component doesn't trigger TextInput to expand.
An example of your code is REQUIRED
export class ExpandingTextInput extends React.Component {
props: Props;
state: State = {
height: this.props.minHeight,
};
onContentSizeChange = (event) => {
const height = event.nativeEvent.contentSize.height;
this.setState({ height });
};
render() {
return (
<TextInput
{...this.props}
multiline
onContentSizeChange={this. onContentSizeChange}
style={[this.props.style, { height: this.state.height }]}
>
{this.props.children}
</TextInput>
)
}
}
and this is how it is being used
<ExpandingTextInput {...this.props}>
<Text>{this.props.text}</Text>
</ExpandingTextInput>
Solution
Still working on one...
Additional Information
- React Native version: [FILL THIS OUT: Be specific, filling out "latest" here is not enough.]
- Platform: [FILL THIS OUT: iOS, Android, or both?]
- Development Operating System: [FILL THIS OUT: Are you developing on MacOS, Linux, or Windows?]
- Dev tools: [FILL THIS OUT: Xcode or Android Studio version, iOS or Android SDK version, if applicable]
npomfret, kyo504, andrew-sygyda, mag1492, rwoody and 1 more
Metadata
Metadata
Assignees
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.