Fix edit post (#2379)

* Fix edit post

* Fix other references to TextInputWithLocalizedPlaceholder
This commit is contained in:
Elias Nahum 2018-11-26 20:27:48 -03:00 committed by GitHub
parent 4925970b86
commit c2b0b3255e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 12 deletions

View file

@ -55,18 +55,18 @@ export default class EditChannelInfo extends PureComponent {
blur = () => {
if (this.nameInput) {
this.nameInput.refs.wrappedInstance.blur();
this.nameInput.blur();
}
// TODO: uncomment below once the channel URL field is added
// if (this.urlInput) {
// this.urlInput.refs.wrappedInstance.blur();
// this.urlInput.blur();
// }
if (this.purposeInput) {
this.purposeInput.refs.wrappedInstance.blur();
this.purposeInput.blur();
}
if (this.headerInput) {
this.headerInput.refs.wrappedInstance.blur();
this.headerInput.blur();
}
if (this.scroll) {
this.scroll.scrollToPosition(0, 0, true);

View file

@ -3,13 +3,16 @@
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {injectIntl, intlShape} from 'react-intl';
import {intlShape} from 'react-intl';
import {TextInput} from 'react-native';
class TextInputWithLocalizedPlaceholder extends PureComponent {
export default class TextInputWithLocalizedPlaceholder extends PureComponent {
static propTypes = {
...TextInput.propTypes,
placeholder: PropTypes.object.isRequired,
};
static contextTypes = {
intl: intlShape.isRequired,
};
@ -22,10 +25,11 @@ class TextInputWithLocalizedPlaceholder extends PureComponent {
};
render() {
const {intl, placeholder, ...otherProps} = this.props;
const {formatMessage} = this.context.intl;
const {placeholder, ...otherProps} = this.props;
let placeholderString = '';
if (placeholder.id) {
placeholderString = intl.formatMessage(placeholder);
placeholderString = formatMessage(placeholder);
}
return (
@ -38,5 +42,3 @@ class TextInputWithLocalizedPlaceholder extends PureComponent {
);
}
}
export default injectIntl(TextInputWithLocalizedPlaceholder, {withRef: true});

View file

@ -108,7 +108,7 @@ export default class EditPost extends PureComponent {
};
focus = () => {
this.messageInput.refs.wrappedInstance.focus();
this.messageInput.focus();
};
messageRef = (ref) => {

View file

@ -81,7 +81,7 @@ export default class Mfa extends PureComponent {
};
blur = () => {
this.textInput.refs.wrappedInstance.blur();
this.textInput.blur();
};
submit = preventDoubleTap(() => {