Skip to content

Commit

Permalink
[TIMOB-19725] iOS: Toggled action buttons display over keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelkPetkov committed Nov 25, 2015
1 parent 612dc6d commit 10d82c9
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion apidoc/Titanium/UI/TextArea.yml
Expand Up @@ -309,7 +309,7 @@ properties:
since: 2.1.2

- name: showUndoRedoActions
summary: Determinates if the undo and redo buttons on the left side of the keyboard should be displayed or not. Only valid on iOS9 and above.
summary: Determinates if the undo and redo buttons on the left side of the keyboard should be displayed or not. Only valid on iOS9 and above. This property can only be set upon creation.
type: Boolean
default: true
platforms: [ipad]
Expand Down
2 changes: 2 additions & 0 deletions iphone/Classes/TiUITextArea.h
Expand Up @@ -24,6 +24,8 @@
NSRange lastSelectedRange;
}

-(void)setShowUndoRedoActions:(id)value;

@end

#endif
22 changes: 14 additions & 8 deletions iphone/Classes/TiUITextArea.m
Expand Up @@ -123,19 +123,25 @@ -(void)adjustOffsetIfRequired:(UITextView*)tv

#pragma mark Public APIs

-(void)setShowUndoRedoActions_:(id)value
-(void)setShowUndoRedoActions:(id)value
{
if(![TiUtils isIOS9OrGreater]){
return;
}

#if IS_XCODE_7
if([TiUtils boolValue:value] == YES) {
textWidgetView.inputAssistantItem.leadingBarButtonGroups = self.inputAssistantItem.leadingBarButtonGroups;
textWidgetView.inputAssistantItem.trailingBarButtonGroups = self.inputAssistantItem.trailingBarButtonGroups;
} else {
textWidgetView.inputAssistantItem.leadingBarButtonGroups = @[];
textWidgetView.inputAssistantItem.trailingBarButtonGroups = @[];
}

UITextView *tv = (UITextView *)[self textWidgetView];
if([TiUtils boolValue:value] == YES) {

tv.inputAssistantItem.leadingBarButtonGroups = self.inputAssistantItem.leadingBarButtonGroups;
tv.inputAssistantItem.trailingBarButtonGroups = self.inputAssistantItem.trailingBarButtonGroups;

} else {

tv.inputAssistantItem.leadingBarButtonGroups = @[];
tv.inputAssistantItem.trailingBarButtonGroups = @[];
}
#endif
}

Expand Down
12 changes: 12 additions & 0 deletions iphone/Classes/TiUITextAreaProxy.m
Expand Up @@ -22,6 +22,18 @@ -(NSString*)apiName
return @"Ti.UI.TextArea";
}

-(void)_initWithProperties:(NSDictionary*)props
{
if ([props valueForKey:@"showUndoRedoActions"])
{
TiUITextArea* textArea = (TiUITextArea*)[self view];
[textArea setShowUndoRedoActions: [props valueForKey:@"showUndoRedoActions"]];
}

[super _initWithProperties:props];
}


@end

#endif

0 comments on commit 10d82c9

Please sign in to comment.