Fix some react natives warning messages (#4653)

Этот коммит содержится в:
enahum
2016-11-28 12:38:33 -03:00
коммит произвёл Harrison Healey
родитель 8d9768dad3
Коммит 7315d69474
9 изменённых файлов: 38 добавлений и 29 удалений

Просмотреть файл

@@ -53,11 +53,17 @@ export default class AutosizeTextarea extends React.Component {
} }
render() { render() {
const props = {...this.props};
Reflect.deleteProperty(props, 'onHeightChange');
Reflect.deleteProperty(props, 'providers');
Reflect.deleteProperty(props, 'channelId');
const { const {
value, value,
placeholder, placeholder,
...otherProps ...otherProps
} = this.props; } = props;
const heightProps = {}; const heightProps = {};
if (this.height <= 0) { if (this.height <= 0) {
@@ -72,7 +78,7 @@ export default class AutosizeTextarea extends React.Component {
<textarea <textarea
ref='textarea' ref='textarea'
{...heightProps} {...heightProps}
{...this.props} {...props}
/> />
<div style={{height: 0, overflow: 'hidden'}}> <div style={{height: 0, overflow: 'hidden'}}>
<textarea <textarea
@@ -86,4 +92,4 @@ export default class AutosizeTextarea extends React.Component {
</div> </div>
); );
} }
} }

Просмотреть файл

@@ -227,6 +227,6 @@ ChangeUrlModal.propTypes = {
currentURL: React.PropTypes.string, currentURL: React.PropTypes.string,
serverError: React.PropTypes.node, serverError: React.PropTypes.node,
onModalSubmit: React.PropTypes.func.isRequired, onModalSubmit: React.PropTypes.func.isRequired,
onModalExited: React.PropTypes.func.optional, onModalExited: React.PropTypes.func,
onModalDismissed: React.PropTypes.func.isRequired onModalDismissed: React.PropTypes.func.isRequired
}; };

Просмотреть файл

@@ -448,7 +448,10 @@ export default class ChannelHeader extends React.Component {
); );
dropdownContents.push( dropdownContents.push(
<li className='divider'/> <li
key='divider-1'
className='divider'
/>
); );
if (!ChannelStore.isDefault(channel)) { if (!ChannelStore.isDefault(channel)) {
@@ -511,7 +514,10 @@ export default class ChannelHeader extends React.Component {
} }
dropdownContents.push( dropdownContents.push(
<li className='divider'/> <li
key='divider-2'
className='divider'
/>
); );
const deleteOption = ( const deleteOption = (
@@ -607,7 +613,10 @@ export default class ChannelHeader extends React.Component {
} }
dropdownContents.push( dropdownContents.push(
<li className='divider'/> <li
key='divider-3'
className='divider'
/>
); );
const canLeave = channel.type === Constants.PRIVATE_CHANNEL ? this.state.userCount > 1 : true; const canLeave = channel.type === Constants.PRIVATE_CHANNEL ? this.state.userCount > 1 : true;

Просмотреть файл

@@ -12,20 +12,13 @@ import UserStore from 'stores/user_store.jsx';
import TeamStore from 'stores/team_store.jsx'; import TeamStore from 'stores/team_store.jsx';
import PreferenceStore from 'stores/preference_store.jsx'; import PreferenceStore from 'stores/preference_store.jsx';
import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import {Modal} from 'react-bootstrap'; import {Modal} from 'react-bootstrap';
const holders = defineMessages({
nameEx: {
id: 'channel_modal.nameEx',
defaultMessage: 'E.g.: "Bugs", "Marketing", "客户支持"'
}
});
import React from 'react'; import React from 'react';
class NewChannelModal extends React.Component { export default class NewChannelModal extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@@ -242,7 +235,7 @@ class NewChannelModal extends React.Component {
type='text' type='text'
ref='display_name' ref='display_name'
className='form-control' className='form-control'
placeholder={this.props.intl.formatMessage(holders.nameEx)} placeholder={Utils.localizeMessage('channel_modal.nameEx', 'E.g.: "Bugs", "Marketing", "客户支持"')}
maxLength='22' maxLength='22'
value={this.props.channelData.displayName} value={this.props.channelData.displayName}
autoFocus={true} autoFocus={true}
@@ -284,7 +277,7 @@ class NewChannelModal extends React.Component {
className='form-control no-resize' className='form-control no-resize'
ref='channel_purpose' ref='channel_purpose'
rows='4' rows='4'
placeholder={this.props.intl.formatMessage({id: 'channel_modal.purpose'})} placeholder={Utils.localizeMessage('channel_modal.purpose', 'Purpose')}
maxLength='250' maxLength='250'
value={this.props.channelData.purpose} value={this.props.channelData.purpose}
onChange={this.handleChange} onChange={this.handleChange}
@@ -321,7 +314,7 @@ class NewChannelModal extends React.Component {
className='form-control no-resize' className='form-control no-resize'
ref='channel_header' ref='channel_header'
rows='4' rows='4'
placeholder={this.props.intl.formatMessage({id: 'channel_modal.header'})} placeholder={Utils.localizeMessage('channel_modal.header', 'Header')}
maxLength='128' maxLength='128'
value={this.props.channelData.header} value={this.props.channelData.header}
onChange={this.handleChange} onChange={this.handleChange}
@@ -377,17 +370,15 @@ NewChannelModal.defaultProps = {
serverError: null serverError: null
}; };
NewChannelModal.propTypes = { NewChannelModal.propTypes = {
intl: intlShape.isRequired,
show: React.PropTypes.bool.isRequired, show: React.PropTypes.bool.isRequired,
channelType: React.PropTypes.string.isRequired, channelType: React.PropTypes.string.isRequired,
channelData: React.PropTypes.object.isRequired, channelData: React.PropTypes.object.isRequired,
serverError: React.PropTypes.node, serverError: React.PropTypes.node,
onSubmitChannel: React.PropTypes.func.isRequired, onSubmitChannel: React.PropTypes.func.isRequired,
onModalDismissed: React.PropTypes.func.isRequired, onModalDismissed: React.PropTypes.func.isRequired,
onModalExited: React.PropTypes.func.optional, onModalExited: React.PropTypes.func,
onTypeSwitched: React.PropTypes.func.isRequired, onTypeSwitched: React.PropTypes.func.isRequired,
onChangeURLPressed: React.PropTypes.func.isRequired, onChangeURLPressed: React.PropTypes.func.isRequired,
onDataChanged: React.PropTypes.func.isRequired onDataChanged: React.PropTypes.func.isRequired
}; };
export default injectIntl(NewChannelModal);

Просмотреть файл

@@ -211,7 +211,7 @@ export default class PostBody extends React.Component {
PostBody.propTypes = { PostBody.propTypes = {
post: React.PropTypes.object.isRequired, post: React.PropTypes.object.isRequired,
parentPost: React.PropTypes.object, parentPost: React.PropTypes.object,
retryPost: React.PropTypes.func.isRequired, retryPost: React.PropTypes.func,
handleCommentClick: React.PropTypes.func.isRequired, handleCommentClick: React.PropTypes.func.isRequired,
compactDisplay: React.PropTypes.bool, compactDisplay: React.PropTypes.bool,
previewCollapsed: React.PropTypes.string, previewCollapsed: React.PropTypes.string,

Просмотреть файл

@@ -456,7 +456,8 @@ export default class SidebarHeaderDropdown extends React.Component {
return ( return (
<Dropdown <Dropdown
open={this.state.showDropdown} id='sidebar-header-dropdown'
defaultOpen={this.state.showDropdown}
onClose={this.toggleDropdown} onClose={this.toggleDropdown}
className='sidebar-header-dropdown' className='sidebar-header-dropdown'
pullRight={true} pullRight={true}

Просмотреть файл

@@ -33,5 +33,5 @@ export default class StatusIcon extends React.Component {
} }
StatusIcon.propTypes = { StatusIcon.propTypes = {
status: React.PropTypes.string.isRequired status: React.PropTypes.string
}; };

Просмотреть файл

@@ -180,11 +180,13 @@ export default class SuggestionBox extends React.Component {
/> />
); );
} else if (type === 'search') { } else if (type === 'search') {
const newProps = {...props};
Reflect.deleteProperty(newProps, 'providers');
textbox = ( textbox = (
<input <input
ref='textbox' ref='textbox'
type='search' type='search'
{...props} {...newProps}
onInput={this.handleChange} onInput={this.handleChange}
onKeyDown={this.handleKeyDown} onKeyDown={this.handleKeyDown}
/> />

Просмотреть файл

@@ -96,7 +96,6 @@ class UserSettingsGeneralTab extends React.Component {
this.updateSection = this.updateSection.bind(this); this.updateSection = this.updateSection.bind(this);
this.state = this.setupInitialState(props); this.state = this.setupInitialState(props);
this.setState({maxFileSize: global.window.mm_config.MaxFileSize});
} }
submitUsername(e) { submitUsername(e) {
@@ -307,7 +306,8 @@ class UserSettingsGeneralTab extends React.Component {
confirmEmail: '', confirmEmail: '',
picture: null, picture: null,
loadingPicture: false, loadingPicture: false,
emailChangeInProgress: false emailChangeInProgress: false,
maxFileSize: global.window.mm_config.MaxFileSize
}; };
} }