facebook / componentkit

A React-inspired view framework for iOS.
http://www.componentkit.org/
Other
5.76k stars 587 forks source link

ComponentController can't access CKComponent's updateState: method #225

Closed Dafenng closed 9 years ago

Dafenng commented 9 years ago

I see the demo code on this page:http://componentkit.org/docs/components-cant-be-delegates.html

@interface AlertDisplayComponentController : CKComponentController <UIAlertViewDelegate>
@end

@implementation AlertDisplayComponentController
{
  UIAlertView *_alertView;
}

- (void)didTapDisplayAlert
{
  _alertView = [[UIAlertView alloc] initWithTitle:@"Are you sure?"
                                          message:nil
                                         delegate:self ...];
  [_alertView show];
}

- (void)alertView:(UIAlertView *)alert didDismissWithButtonIndex:(NSInteger)buttonIndex
{
  [self.component updateState:...];
}
@end

But CKComponent actually not expose the updateState method, how can ComponentController use it?

By the way, this is not the only case, I also found cases where I should use the not exposed method like this: https://github.com/facebook/componentkit/issues/213

adamjernst commented 9 years ago

Just import the CKComponentSubclass.h header.