zhangchao 4 years ago
parent
commit
8cc93af53b
2 changed files with 4 additions and 4 deletions
  1. 2
    1
      src/RichTextEditor.js
  2. 2
    3
      src/editor.html

+ 2
- 1
src/RichTextEditor.js View File

@@ -81,9 +81,10 @@ export default class RichTextEditor extends Component {
81 81
   setEditorAvailableHeightBasedOnKeyboardHeight(keyboardHeight) {
82 82
     const {top = 0, bottom = 0} = this.props.contentInset;
83 83
     const {marginTop = 0, marginBottom = 0} = this.props.style;
84
+    const {heightToScreenTop = 0} = this.props;
84 85
     const spacing = marginTop + marginBottom + top + bottom;
85 86
 
86
-    const editorAvailableHeight = Dimensions.get('window').height - keyboardHeight - spacing;
87
+    const editorAvailableHeight = Dimensions.get('window').height - keyboardHeight - spacing - heightToScreenTop;
87 88
     this.setEditorHeight(editorAvailableHeight);
88 89
   }
89 90
 

+ 2
- 3
src/editor.html View File

@@ -964,7 +964,6 @@
964 964
 			}
965 965
 
966 966
 			zss_editor.updateOffset = function() {
967
-
968 967
 				if (!zss_editor.updateScrollOffset)
969 968
 					return;
970 969
 
@@ -1048,8 +1047,8 @@
1048 1047
 				var futureEditorHeight = caretYPosition + lineHeight;
1049 1048
 				if (caretYPosition < offsetY) {
1050 1049
 					newPos = caretYPosition;
1051
-				} else if (futureEditorHeight > editorHeight + offsetY) {
1052
-					newPos = futureEditorHeight - editorHeight + halfLineHeight;
1050
+				} else if (futureEditorHeight > parseInt(editorHeight) + offsetY) {
1051
+					newPos = futureEditorHeight - parseInt(editorHeight) + halfLineHeight;
1053 1052
 				}
1054 1053
 
1055 1054
 				if (newPos) {