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.

Revisions

  1. @renso3x renso3x created this gist Nov 22, 2017.
    20 changes: 20 additions & 0 deletions RCTTextFieldManager.m
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@

    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;
    }
    }