+ [ios] update input number type; change nsassert to nslog to avoid crash in debug
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/a06d378c Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/a06d378c Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/a06d378c Branch: refs/heads/0.16-dev Commit: a06d378c166334948dd7e31a0e4584afc06672f2 Parents: 10a074f Author: é½å±± <sunjjb...@163.com> Authored: Wed Jul 19 14:52:16 2017 +0800 Committer: é½å±± <sunjjb...@163.com> Committed: Wed Jul 19 14:52:16 2017 +0800 ---------------------------------------------------------------------- examples/vue/components/input.vue | 7 +++++++ ios/sdk/WeexSDK/Sources/Bridge/WXBridgeMethod.m | 16 ++++++++++++---- ios/sdk/WeexSDK/Sources/Component/WXEditComponent.m | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a06d378c/examples/vue/components/input.vue ---------------------------------------------------------------------- diff --git a/examples/vue/components/input.vue b/examples/vue/components/input.vue index 9cf4c37..4c3ea37 100644 --- a/examples/vue/components/input.vue +++ b/examples/vue/components/input.vue @@ -50,6 +50,13 @@ <div> <div style="background-color: #286090"> + <text class="title" style="height: 80 ;padding: 20;color: #FFFFFF">input type = number</text> + </div> + <input type="number" placeholder="Input number" class="input" @change="onchange" @input="oninput"/> + </div> + + <div> + <div style="background-color: #286090"> <text class="title" style="height: 80 ;padding: 20;color: #FFFFFF">input type = date</text> </div> <input type="date" placeholder="Input Date" class="input" @change="onchange" @input="oninput" max="2017-12-12" min="2015-01-01"/> http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a06d378c/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeMethod.m ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeMethod.m b/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeMethod.m index bf401a1..a349849 100644 --- a/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeMethod.m +++ b/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeMethod.m @@ -55,27 +55,35 @@ { #ifdef DEBUG check = [obj isKindOfClass:[NSNumber class]]; - WXAssert(check,@"<%@: %p; instance = %@; method = %@; arguments= %@; the number %d parameter type is not right,it should be float or double>",NSStringFromClass([self class]), self, _instance.instanceId, _methodName, _arguments,order); + if(!check){ + NSLog(@"<%@: %p; instance = %@; method = %@; arguments= %@; the number %d parameter type is not right,it should be float or double>",NSStringFromClass([self class]), self, _instance.instanceId, _methodName, _arguments,order); + } #endif CGFloat value = [WXConvert CGFloat:obj]; return [NSNumber numberWithDouble:value]; } else if (strcmp(parameterType,@encode(int))==0) { #ifdef DEBUG check = [obj isKindOfClass:[NSNumber class]]; - WXAssert(check,@"<%@: %p; instance = %@; method = %@; arguments= %@; the number %d parameter type is not right,it should be int>",NSStringFromClass([self class]), self, _instance.instanceId, _methodName, _arguments,order); + if(!check){ + NSLog(@"<%@: %p; instance = %@; method = %@; arguments= %@; the number %d parameter type is not right,it should be int>",NSStringFromClass([self class]), self, _instance.instanceId, _methodName, _arguments,order); + } #endif NSInteger value = [WXConvert NSInteger:obj]; return [NSNumber numberWithInteger:value]; } else if(strcmp(parameterType,@encode(id))==0) { #ifdef DEBUG check = [obj isKindOfClass:[NSArray class]] || [obj isKindOfClass:[NSDictionary class]] ||[obj isKindOfClass:[NSString class]]; - WXAssert(check,@"<%@: %p; instance = %@; method = %@; arguments= %@ ;the number %d parameter type is not right,it should be array ,map or string>",NSStringFromClass([self class]), self, _instance.instanceId, _methodName, _arguments,order); + if(!check){ + NSLog(@"<%@: %p; instance = %@; method = %@; arguments= %@ ;the number %d parameter type is not right,it should be array ,map or string>",NSStringFromClass([self class]), self, _instance.instanceId, _methodName, _arguments,order); + } #endif return obj; } else if(strcmp(parameterType,@encode(typeof(^{})))==0) { #ifdef DEBUG check = [obj isKindOfClass:[NSString class]]; // jsfm pass string if parameter type is block - WXAssert(check,@"<%@: %p; instance = %@; method = %@; arguments= %@; the number %d parameter type is not right,it should be block>",NSStringFromClass([self class]), self, _instance.instanceId, _methodName, _arguments,order); + if(!check){ + NSLog(@"<%@: %p; instance = %@; method = %@; arguments= %@; the number %d parameter type is not right,it should be block>",NSStringFromClass([self class]), self, _instance.instanceId, _methodName, _arguments,order); + } #endif return obj; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a06d378c/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 f474719..c9a4cee 100644 --- a/ios/sdk/WeexSDK/Sources/Component/WXEditComponent.m +++ b/ios/sdk/WeexSDK/Sources/Component/WXEditComponent.m @@ -705,7 +705,7 @@ WX_EXPORT_METHOD(@selector(getSelectionRange:)) }else if ([_inputType isEqualToString:@"url"]) { [self setKeyboardType:UIKeyboardTypeURL]; }else if ([_inputType isEqualToString:@"number"]) { - [self setKeyboardType:UIKeyboardTypeNumbersAndPunctuation]; + [self setKeyboardType:UIKeyboardTypeDecimalPad]; }else if ([self isDateType]) { if (!_datePickerManager) { _datePickerManager = [[WXDatePickerManager alloc] init];