(Related to the discussion in #114)
The gist of what I want to do is to call methods on view instances where setting a prop doesn't make sense. A common example of this is focusing/blurring a text field. The current API (this.refs.textInput.focus()) is right on, but the implementation is a bit roundabout going through a static method on the UIManager to look up the view and set the first responder state. It would be much better for module implementors to be able to expose methods on the view instances directly and not have to think about the node handle -> view lookup.
A rough sketch of what this could look like is:
// in RCTTextFieldManager.m
RCT_CUSTOM_VIEW_METHOD(focus, RCTTextField)
{
// "view" is defined w/static type RCTTextField
dispatch_async(dispatch_get_main_queue(), ^{
[view becomeFirstResponder];
});
}
I haven't thought too much about how arguments and return values should be handled though arguments in particular seem important to support.
(Related to the discussion in #114)
The gist of what I want to do is to call methods on view instances where setting a prop doesn't make sense. A common example of this is focusing/blurring a text field. The current API (
this.refs.textInput.focus()) is right on, but the implementation is a bit roundabout going through a static method on the UIManager to look up the view and set the first responder state. It would be much better for module implementors to be able to expose methods on the view instances directly and not have to think about the node handle -> view lookup.A rough sketch of what this could look like is:
I haven't thought too much about how arguments and return values should be handled though arguments in particular seem important to support.