RN-237 Re-added workaround for pressing enter on Android (#679)

* Stop 'make stop-packager' from erroring when packager isn't running

* RN-237 Re-added workaround for pressing enter on Android
This commit is contained in:
Harrison Healey 2017-06-27 16:27:39 -04:00 committed by enahum
parent 77c701b03a
commit 102a56e7cf
2 changed files with 18 additions and 1 deletions

View file

@ -113,7 +113,9 @@ start-packager:
stop-packager:
@echo Stopping React Native packager server
@kill -9 `cat server.PID` && rm server.PID
@if [ -e "server.PID" ] ; then \
kill -9 `cat server.PID` && rm server.PID; \
fi
check-ios-target:
ifneq ($(ios_target), $(filter $(ios_target), dev beta release))

View file

@ -217,6 +217,20 @@ class PostTextbox extends PureComponent {
});
};
handleSubmit = () => {
// Workaround for android as the multiline is not working
if (Platform.OS === 'android') {
if (this.timeout) {
clearTimeout(this.timeout);
}
this.timeout = setTimeout(() => {
let {value: msg} = this.props;
msg += '\n';
this.handleTextChange(msg);
}, 10);
}
};
attachAutocomplete = (c) => {
this.autocomplete = c;
};
@ -453,6 +467,7 @@ class PostTextbox extends PureComponent {
blurOnSubmit={false}
underlineColorAndroid='transparent'
style={[style.input, {height: textInputHeight}]}
onSubmitEditing={this.handleSubmit}
onLayout={this.handleInputSizeChange}
/>
{this.canSend() &&