mattermost-mobile/app/components/text_input_with_localized_placeholder.js
enahum 71b2ecd394 Platform dependent search bar and ui fixes (#205)
* Platform dependent search bar and ui fixes

* Set events in default props

* Update NOTICE.txt

* Channel info favorite (#210)

* Enable toggling of favorite channel from channel_info

* Change this binding

* Handle favorite toggle with state

* feedback review

* removed unnecessary view
2017-02-01 11:38:32 -03:00

40 lines
1 KiB
JavaScript

// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import {injectIntl, intlShape} from 'react-intl';
import {TextInput} from 'react-native';
class TextInputWithLocalizedPlaceholder extends React.PureComponent {
static propTypes = {
...TextInput.propTypes,
placeholder: React.PropTypes.object.isRequired,
intl: intlShape.isRequired
};
blur = () => {
this.refs.input.blur();
};
focus = () => {
this.refs.input.focus();
};
render() {
const {intl, placeholder, ...otherProps} = this.props;
let placeholderString = '';
if (placeholder.id) {
placeholderString = intl.formatMessage(placeholder);
}
return (
<TextInput
ref='input'
{...otherProps}
placeholder={placeholderString}
/>
);
}
}
export default injectIntl(TextInputWithLocalizedPlaceholder, {withRef: true});