necolas/react-native-web

TextInput: onContentSizeChange

gut4 opened this issue · 6 comments

gut4 commented

Looks like it's not implemented.

Is there a workaround for this? Can't access via onChange={(e) => console.log(e.nativeEvent.contentSize)} either.

You could implement it in a PR

PR?

Pull request. A patch

Had a look at doing this. One way is to use canvas although this isn't very 'cross-platform-ie'. In the interim do you recommend any techniques? Thanks

rxb commented

I might be able to put together a PR for this, but in the meantime for anyone else looking for a way to handle this:

onChange={(event)=>{
const height = event.nativeEvent.srcElement.scrollHeight;
const width = event.nativeEvent.srcElement.scrollWidth;
console.log(`width: ${width} / height: ${height}`);
}}