You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by mo...@apache.org on 2019/08/19 06:19:12 UTC

[incubator-weex] branch master updated: [iOS] fix the offset error of textarea

This is an automated email from the ASF dual-hosted git repository.

moshen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git


The following commit(s) were added to refs/heads/master by this push:
     new a7d6d3a  [iOS] fix the offset error of textarea
     new fc20444  Merge pull request #2835 from jianhan-he/master
a7d6d3a is described below

commit a7d6d3a0d9c104ce4457d48943a8c1c35c19be7c
Author: linghe.lh <li...@alibaba-inc.com>
AuthorDate: Mon Aug 19 11:33:43 2019 +0800

    [iOS] fix the offset error of textarea
---
 ios/sdk/WeexSDK/Sources/Component/WXEditComponent.mm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ios/sdk/WeexSDK/Sources/Component/WXEditComponent.mm b/ios/sdk/WeexSDK/Sources/Component/WXEditComponent.mm
index 8015194..56c5ef3 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXEditComponent.mm
+++ b/ios/sdk/WeexSDK/Sources/Component/WXEditComponent.mm
@@ -714,7 +714,8 @@ WX_EXPORT_METHOD(@selector(setTextFormatter:))
     CGRect rootViewFrame = rootView.frame;
     CGRect inputFrame = [self.view.superview convertRect:self.view.frame toView:rootView];
     if (movedUp) {
-        CGFloat offset = inputFrame.origin.y-(rootViewFrame.size.height-_keyboardSize.height-inputFrame.size.height) + _upriseOffset;
+        CGFloat inputOffset = inputFrame.size.height - (rootViewFrame.size.height - inputFrame.origin.y);
+        CGFloat offset = inputFrame.origin.y-(rootViewFrame.size.height-_keyboardSize.height- (inputOffset > 0 ? inputFrame.size.height - inputOffset : inputFrame.size.height)) + _upriseOffset;
         if (offset > 0) {
             rect = (CGRect){
                 .origin.x = 0.f,