Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[iOS] Fix on iOS9, text cannot be deleted when exceeds maxLength. (#1487
Browse files Browse the repository at this point in the history
)
  • Loading branch information
wqyfavor authored and cxfeng1 committed Aug 30, 2018
1 parent 400bfcd commit a9e0e19
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ios/sdk/WeexSDK/Sources/Component/WXEditComponent.mm
Expand Up @@ -598,6 +598,10 @@ - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRang
NSUInteger rangeLength = range.length;

NSUInteger newLength = oldLength - rangeLength + replacementLength;
if (newLength <= oldLength) {
// deleting, we should allow delete
return YES;
}

return newLength <= [_maxLength integerValue] ;
}
Expand Down

0 comments on commit a9e0e19

Please sign in to comment.