Zss1990 opened a new issue #2913: [iOS] input标签当type="tel"或者type = 
"numuber"时候,无法进行剪切(只有选择一个字符时候是可以剪切)
URL: https://github.com/apache/incubator-weex/issues/2913
 
 
   [iOS] input标签当type="tel"或者type = "numuber"时候,无法进行剪切(只有选择一个字符时候是可以剪切)
   发现了这段代码
   ```
   - (BOOL)textField:(UITextField *)textField 
shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString 
*)string
   {
       if (!string.length) {
           ((WXTextInputView*)textField).deleteWords = YES;
           ((WXTextInputView*)textField).editWords = [textField.text 
substringWithRange:range];
       } else {
           ((WXTextInputView*)textField).deleteWords = FALSE;
           ((WXTextInputView*)textField).editWords = string;
       }
     
       if ([_inputType isEqualToString:@"tel"] || [_inputType 
isEqualToString:@"number"] ) {
           if (![self isPureInt:string]) {
               if ([string isEqualToString:@"+"]||[string 
isEqualToString:@"."]||[string isEqualToString:@"*"]||[string 
isEqualToString:@"#"]||(string.length == 0 && range.length == 1))
               {
                   return YES;
               }
               return NO;
           }
       }
       return YES;
   }
   ```
   其中`(string.length == 0 && range.length == 1)` 才允许剪切,是否是一个bug?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to