For the TextInput field type you list among other standard options onBlur, onEndEditing, onFocus and onSubmitEditing. Can you give an example of how a callback would be indicated for these options?
var options = {
fields: {
textField: {
onFocus: [ How do I code the callback here? ]
}
}
};
I find this library to be immensely helpful. Thanks for all of your work!
Hi @flyingace,
onFocus will be passed to the native TextInput component as it is
https://github.com/gcanti/tcomb-form-native/blob/master/lib/templates/bootstrap/textbox.js#L44
Basically, you can do this @flyingace
let options = {
fields: {
textField: {
onFocus: () => { console.log('Your code here'); },
// or
onFocus: this._myOnFocusFunction.bind(this),
},
},
}
_myOnFocusFunction () {
// Your code here
}
Thanks to you both! That's very helpful.
Glad to have helped! :wink:
Is there any way to scroll the focussed text component to the top of the page? I believe this should be a natural next step for most forms.
Something like this?
_myOnFocusFunction (componentName) {
if (componentName) {
var component = this.refs.form1.getComponent(componentName)
this.refs._requestScrollView.scrollTo({y: component.height})
}
}
Most helpful comment
Basically, you can do this @flyingace