Skip to content

Instantly share code, notes, and snippets.

@renso3x
Created November 22, 2017 03:24
Show Gist options
  • Save renso3x/2939df594d8571ccfe23aa9bd70e96d7 to your computer and use it in GitHub Desktop.
Save renso3x/2939df594d8571ccfe23aa9bd70e96d7 to your computer and use it in GitHub Desktop.
add this function showNextButton
RCT_CUSTOM_VIEW_PROPERTY(showNextButton, BOOL, RCTTextField)
{
if (json && ([RCTConvert BOOL:json])) {
UIToolbar* toolbar = [[UIToolbar alloc] init];
[toolbar sizeToFit];
UIBarButtonItem* flex = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
target:nil action:nil];
UIBarButtonItem* doneButton = [[UIBarButtonItem alloc]
initWithTitle:@"Next" style:(UIBarButtonItemStylePlain)
target:view action:@selector(endEditing:)];
toolbar.items = @[flex, doneButton];
view.inputAccessoryView = toolbar;
} else {
view.inputAccessoryView = nil;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment