adjust code style and add default case
This commit is contained in:
parent
497bd0ac45
commit
4a788eb4bb
@ -136,6 +136,9 @@ public class InputNode extends ViewNode<EditText> implements TextWatcher, View.O
|
|||||||
case 4:
|
case 4:
|
||||||
mView.setInputType(InputType.TYPE_CLASS_PHONE);
|
mView.setInputType(InputType.TYPE_CLASS_PHONE);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
mView.setInputType(InputType.TYPE_CLASS_TEXT);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#import "DoricPromise.h"
|
#import "DoricPromise.h"
|
||||||
|
|
||||||
typedef void (^onTextChangeBlock)(NSString *text, DoricInputNode *node);
|
typedef void (^onTextChangeBlock)(NSString *text, DoricInputNode *node);
|
||||||
|
|
||||||
typedef void (^onFocusChangeBlock)(BOOL focused, DoricInputNode *node);
|
typedef void (^onFocusChangeBlock)(BOOL focused, DoricInputNode *node);
|
||||||
|
|
||||||
@implementation DoricInputView
|
@implementation DoricInputView
|
||||||
@ -132,11 +133,10 @@ - (void)blendView:(DoricInputView *)view forPropName:(NSString *)name propValue:
|
|||||||
|
|
||||||
} else if ([name isEqualToString:@"maxLength"]) {
|
} else if ([name isEqualToString:@"maxLength"]) {
|
||||||
self.maxLength = prop;
|
self.maxLength = prop;
|
||||||
}
|
} else if ([name isEqualToString:@"inputType"]) {
|
||||||
else if([name isEqualToString:@"inputType"]){
|
|
||||||
switch ([prop integerValue]) {
|
switch ([prop integerValue]) {
|
||||||
case 1: {
|
case 1: {
|
||||||
// [self.view setKeyboardType: UIKeyboardTypeNumberPad ];
|
[self.view setKeyboardType:UIKeyboardTypeNumberPad];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
@ -152,11 +152,11 @@ - (void)blendView:(DoricInputView *)view forPropName:(NSString *)name propValue:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
[self.view setKeyboardType:UIKeyboardTypeDefault];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
[super blendView:view forPropName:name propValue:prop];
|
[super blendView:view forPropName:name propValue:prop];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -164,6 +164,7 @@ - (void)blendView:(DoricInputView *)view forPropName:(NSString *)name propValue:
|
|||||||
- (void)blend:(NSDictionary *)props {
|
- (void)blend:(NSDictionary *)props {
|
||||||
[super blend:props];
|
[super blend:props];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)afterBlended:(NSDictionary *)props {
|
- (void)afterBlended:(NSDictionary *)props {
|
||||||
[super afterBlended:props];
|
[super afterBlended:props];
|
||||||
if (self.view.doricLayout.paddingTop != self.view.textContainerInset.top
|
if (self.view.doricLayout.paddingTop != self.view.textContainerInset.top
|
||||||
@ -182,6 +183,7 @@ - (void)requestLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Doric-JS api
|
#pragma mark - Doric-JS api
|
||||||
|
|
||||||
- (NSString *)getText {
|
- (NSString *)getText {
|
||||||
return self.view.text;
|
return self.view.text;
|
||||||
}
|
}
|
||||||
@ -207,12 +209,14 @@ - (void)releaseFocus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - UITextViewDelegate
|
#pragma mark - UITextViewDelegate
|
||||||
|
|
||||||
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView {
|
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView {
|
||||||
if (self.onFocusShange) {
|
if (self.onFocusShange) {
|
||||||
self.onFocusShange(YES, self);
|
self.onFocusShange(YES, self);
|
||||||
}
|
}
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)textViewShouldEndEditing:(UITextView *)textView {
|
- (BOOL)textViewShouldEndEditing:(UITextView *)textView {
|
||||||
if (self.onFocusShange) {
|
if (self.onFocusShange) {
|
||||||
self.onFocusShange(NO, self);
|
self.onFocusShange(NO, self);
|
||||||
|
@ -79,7 +79,7 @@ export enum InputType{
|
|||||||
|
|
||||||
Number = 1,
|
Number = 1,
|
||||||
|
|
||||||
NumberSigned = 2,
|
Decimal = 2,
|
||||||
|
|
||||||
Alphabet = 3,
|
Alphabet = 3,
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user