TextView disable multi-line scrolling in iOS


#1

I’m wondering whether it’s possible to disable the scrolling within a UI TextView in iOS.

I’m using a TextView to allow users to enter multi-line text in a view. However, I’ve noticed that when content is entered which causes the TextView to flow the content to a new line, the TextView scrolls so that all the text moves up a line.

Does that make sense?

It looks pretty bad.

There don’t seem to be any attributes or methods available on TextView to control this behaviour.

Not an issue in Android.

Has anyone encountered this same behaviour, and if so, have you found a workable solution to make the TextView look better?


#2

I had the same problem but found further info and a temporary hack that works from this post - https://github.com/NativeScript/NativeScript/issues/3916

Essentially I have a textChange handler that updates the height. The setTimeout is necessary and unfortunately it creates a slight flash but better than without the hack.


view.on(observableModule.Observable.propertyChangeEvent, function(propertyChangeData) {
    if (propertyChangeData.propertyName == 'notes') {
        if (application.ios) {
            setTimeout(() => {
                let notesView = page.getViewById("notes");
                notesView.height = notesView.ios.contentSize.height;
            }, 100);
        }
    }
});