Skip to content

Instantly share code, notes, and snippets.

@luco
Forked from renso3x/RCTTextFieldManager.m
Created December 1, 2017 13:38
Show Gist options
  • Save luco/56ddb3b47f45602e812f76a643aa0a3c to your computer and use it in GitHub Desktop.
Save luco/56ddb3b47f45602e812f76a643aa0a3c 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