diff --git a/src/components/html-text-input-ui/html-text-input-ui-common.scss b/src/components/html-text-input-ui/html-text-input-ui-common.scss index 265e94e4c6..7405af8d36 100644 --- a/src/components/html-text-input-ui/html-text-input-ui-common.scss +++ b/src/components/html-text-input-ui/html-text-input-ui-common.scss @@ -4,10 +4,14 @@ $padding: 8; $backgroundColor: white; $htmlFont: $default-monospace-font; -.container { +.keyboardAvoidingView { position: absolute; top: 0; right: 0; left: 0; bottom: 0; } + +.container { + flex: 1; +} diff --git a/src/components/html-text-input-ui/html-text-input-ui.android.js b/src/components/html-text-input-ui/html-text-input-ui.android.js index 102315c1c7..888ffcf89f 100644 --- a/src/components/html-text-input-ui/html-text-input-ui.android.js +++ b/src/components/html-text-input-ui/html-text-input-ui.android.js @@ -6,8 +6,8 @@ /** * External dependencies */ -import React from 'react'; -import { TextInput, ScrollView } from 'react-native'; +import * as React from 'react'; +import { ScrollView } from 'react-native'; /** * Internal dependencies @@ -16,60 +16,27 @@ import styles from './html-text-input-ui.scss'; import KeyboardAvoidingView from '../keyboard-avoiding-view'; type PropsType = { - setTitleAction: string => void, - value: string, - title: string, - parentHeight: number, - onChangeHTMLText: string => mixed, - onBlurHTMLText: () => mixed, - titlePlaceholder: string, - htmlPlaceholder: string, + parentHeight: number, + children: React.Node, }; type StateType = { - contentHeight: number, }; -export default class HTMLInputViewUI extends React.Component { - constructor() { - super( ...arguments ); - - this.state = { - contentHeight: 0, - }; - } +class HTMLInputContainer extends React.Component { + static scrollEnabled: boolean; render() { return ( - - - - { - this.setState( { contentHeight: event.nativeEvent.contentSize.height } ); - } } - /> + + + { this.props.children } ); } } + +HTMLInputContainer.scrollEnabled = false; + +export default HTMLInputContainer; diff --git a/src/components/html-text-input-ui/html-text-input-ui.android.scss b/src/components/html-text-input-ui/html-text-input-ui.android.scss index b6b3aa2923..93560154af 100644 --- a/src/components/html-text-input-ui/html-text-input-ui.android.scss +++ b/src/components/html-text-input-ui/html-text-input-ui.android.scss @@ -8,7 +8,7 @@ padding-left: $padding; padding-right: $padding; padding-top: $padding; - padding-bottom: $padding; + padding-bottom: $padding + 16; } .htmlViewTitle { @@ -19,3 +19,7 @@ padding-top: $padding; padding-bottom: $padding; } + +.scrollView { + flex: 1; +} diff --git a/src/components/html-text-input-ui/html-text-input-ui.ios.js b/src/components/html-text-input-ui/html-text-input-ui.ios.js index 640ae0b8a3..93da41f74f 100644 --- a/src/components/html-text-input-ui/html-text-input-ui.ios.js +++ b/src/components/html-text-input-ui/html-text-input-ui.ios.js @@ -6,8 +6,8 @@ /** * External dependencies */ -import React from 'react'; -import { TextInput, UIManager, PanResponder } from 'react-native'; +import * as React from 'react'; +import { UIManager, PanResponder } from 'react-native'; /** * Internal dependencies @@ -16,20 +16,15 @@ import styles from './html-text-input-ui.scss'; import KeyboardAvoidingView from '../keyboard-avoiding-view'; type PropsType = { - setTitleAction: string => void, - value: string, - title: string, - parentHeight: number, - onChangeHTMLText: string => mixed, - onBlurHTMLText: () => mixed, - titlePlaceholder: string, - htmlPlaceholder: string, + parentHeight: number, + children: React.Node, }; type StateType = { }; -export default class HTMLInputViewUI extends React.Component { +class HTMLInputContainer extends React.Component { + static scrollEnabled: boolean; panResponder: PanResponder; constructor() { @@ -40,7 +35,7 @@ export default class HTMLInputViewUI extends React.Component { if ( gestureState.dy > 100 && gestureState.dy < 110 ) { - //Keyboard.dismiss() and this.textInput.blur() is not working here + //Keyboard.dismiss() and this.textInput.blur() are not working here //They require to know the currentlyFocusedID under the hood but //during this gesture there's no currentlyFocusedID UIManager.blur( e.target ); @@ -52,29 +47,16 @@ export default class HTMLInputViewUI extends React.Component - - + parentHeight={ this.props.parentHeight } + > + { this.props.children } ); } } + +HTMLInputContainer.scrollEnabled = true; + +export default HTMLInputContainer; diff --git a/src/components/html-text-input-ui/html-text-input-ui.ios.scss b/src/components/html-text-input-ui/html-text-input-ui.ios.scss index 4fccba7d30..cca0cef89b 100644 --- a/src/components/html-text-input-ui/html-text-input-ui.ios.scss +++ b/src/components/html-text-input-ui/html-text-input-ui.ios.scss @@ -20,5 +20,4 @@ $title-height: 32; padding-top: $padding; padding-bottom: $padding; height: $title-height; - -} \ No newline at end of file +} diff --git a/src/components/html-text-input.js b/src/components/html-text-input.js index 4a38794e06..bf18e52c4a 100644 --- a/src/components/html-text-input.js +++ b/src/components/html-text-input.js @@ -14,11 +14,13 @@ import { withInstanceId, compose } from '@wordpress/compose'; * External dependencies */ import React from 'react'; +import { TextInput } from 'react-native'; /** * Internal dependencies */ -import HTMLInputViewUI from './html-text-input-ui/html-text-input-ui'; +import HTMLInputContainer from './html-text-input-ui/html-text-input-ui'; +import styles from './html-text-input-ui/html-text-input-ui.scss'; type PropsType = { onChange: string => mixed, @@ -80,16 +82,28 @@ export class HTMLInputView extends React.Component { render() { return ( - + + + + ); } }