You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ac...@apache.org on 2017/12/11 06:53:07 UTC
incubator-weex git commit: [WEEX-164][iOS] add hideDoneButton
attribute to input component to hide the done button of input keyboard
Repository: incubator-weex
Updated Branches:
refs/heads/master 84b41b710 -> 00836b15a
[WEEX-164][iOS] add hideDoneButton attribute to input component to hide the done button of input keyboard
close #935
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/00836b15
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/00836b15
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/00836b15
Branch: refs/heads/master
Commit: 00836b15a79ef82508d5736d3ce20edf46b5dcfe
Parents: 84b41b7
Author: 弈启 <wi...@alibaba-inc.com>
Authored: Thu Dec 7 23:29:49 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Mon Dec 11 14:51:43 2017 +0800
----------------------------------------------------------------------
.../WeexSDK/Sources/Component/WXEditComponent.m | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/00836b15/ios/sdk/WeexSDK/Sources/Component/WXEditComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXEditComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXEditComponent.m
index c22e5cb..a0fc92b 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXEditComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXEditComponent.m
@@ -40,6 +40,7 @@
@property (nonatomic) BOOL disabled;
@property (nonatomic, copy) NSString *inputType;
@property (nonatomic) NSUInteger rows;
+@property (nonatomic) BOOL hideDoneButton;
//style
@property (nonatomic) WXPixelType fontSize;
@@ -105,6 +106,10 @@ WX_EXPORT_METHOD(@selector(getSelectionRange:))
_rows = 2;
}
+ if (attributes[@"hideDoneButton"]) {
+ _hideDoneButton = [attributes[@"hideDoneButton"] boolValue];
+ }
+
// handle styles
if (styles[@"color"]) {
_colorForStyle = [WXConvert UIColor:styles[@"color"]];
@@ -159,12 +164,15 @@ WX_EXPORT_METHOD(@selector(getSelectionRange:))
[self setReturnKeyType:_returnKeyType];
[self updatePattern];
- UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(closeKeyboard)];
- UIBarButtonItem *space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
- UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 0, 44)];
- toolbar.items = [NSArray arrayWithObjects:space, barButton, nil];
-
- self.inputAccessoryView = toolbar;
+ if (!self.hideDoneButton) {
+ UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(closeKeyboard)];
+ UIBarButtonItem *space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
+ UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 0, 44)];
+ toolbar.items = [NSArray arrayWithObjects:space, barButton, nil];
+
+ self.inputAccessoryView = toolbar;
+ }
+
[self handlePseudoClass];
}