Und eine andere Lösung, Arbeits mit RN 0.2, anstatt den Inhalt zu zerquetschen, scrollt es.
inputFocused: function(ref) {
this._scroll(ref, 75);
},
inputBlurred: function(ref) {
this._scroll(ref, 0);
},
_scroll: function(ref, offset) {
setTimeout(() => {
var scrollResponder = this.refs.myScrollView.getScrollResponder();
scrollResponder.scrollResponderScrollNativeHandleToKeyboard(
React.findNodeHandle(this.refs[ref]),
offset,
true
);
});
},
...
render: function() {
return <View style={{flex: 1}}>
<ScrollView ref="myScrollView" keyboardDismissMode='interactive' contentContainerStyle={{flex: 1}}>
<TextInput
ref="myInput"
onFocus={this.inputFocused.bind(this, 'myInput')}
onBlur={this.inputBlurred.bind(this, 'myInput')} />
</ScrollView>
</View>
}
Wir brauchen mehr Kontext/Code hier. –
mögliches Duplikat von [Wie schiebe ich das Fenster automatisch von der Tastatur weg, wenn TextInput den Fokus hat?] (Http://stackoverflow.com/questions/29313244/how-to-auto-slide-the-window-out-from -behind-keyboard-when-textinput-has-focus) – Sherlock
Vielleicht möchten Sie thick [this] (https://github.com/facebook/react-native/issues/3195#issuecomment-146568644) Github-Problem. Wir besprechen, wie wir das hier erreichen können. – amb