Update RN to 0.44.0 and project dependencies (#546)

This commit is contained in:
enahum 2017-05-16 21:13:44 -04:00 committed by GitHub
parent 90dc6ecb25
commit 844c654fda
103 changed files with 588 additions and 570 deletions

View file

@ -209,7 +209,7 @@
"react/jsx-no-target-blank": 2,
"react/jsx-no-undef": 2,
"react/jsx-pascal-case": 2,
"react/jsx-space-before-closing": [2, "never"],
"react/jsx-tag-spacing": [2, {"closingSlash": "never", "beforeSelfClosing": "never", "afterOpening": "never"}],
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/jsx-no-comment-textnodes": 2,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {Text} from 'react-native';
import CustomPropTypes from 'app/constants/custom_prop_types';

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {Component, PropTypes} from 'react';
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {
ListView,
StyleSheet,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {Component, PropTypes} from 'react';
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {
ListView,
StyleSheet,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, Component} from 'react';
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
View

View file

@ -1,7 +1,8 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
PanResponder,
StyleSheet,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {ActivityIndicator, StyleSheet, TouchableHighlight, View} from 'react-native';
@ -18,18 +19,18 @@ const styles = StyleSheet.create({
}
});
export default class Button extends React.Component {
export default class Button extends PureComponent {
static propTypes = {
children: React.PropTypes.node,
loading: React.PropTypes.bool,
onPress: React.PropTypes.func.isRequired
}
children: PropTypes.node,
loading: PropTypes.bool,
onPress: PropTypes.func.isRequired
};
onPress = () => {
if (!this.props.loading) {
this.props.onPress();
}
}
};
render() {
let loading = null;

View file

@ -1,8 +1,9 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import {BackAndroid, InteractionManager, Keyboard} from 'react-native';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {BackHandler, InteractionManager, Keyboard} from 'react-native';
import Drawer from 'app/components/drawer';
import ChannelDrawerList from 'app/components/channel_drawer_list';
@ -39,13 +40,13 @@ export default class ChannelDrawer extends PureComponent {
componentDidMount() {
EventEmitter.on('open_channel_drawer', this.openChannelDrawer);
EventEmitter.on('close_channel_drawer', this.closeChannelDrawer);
BackAndroid.addEventListener('hardwareBackPress', this.handleAndroidBack);
BackHandler.addEventListener('hardwareBackPress', this.handleAndroidBack);
}
componentWillUnmount() {
EventEmitter.off('open_channel_drawer', this.openChannelDrawer);
EventEmitter.off('close_channel_drawer', this.closeChannelDrawer);
BackAndroid.removeEventListener('hardwareBackPress', this.handleAndroidBack);
BackHandler.removeEventListener('hardwareBackPress', this.handleAndroidBack);
}
handleAndroidBack = () => {

View file

@ -1,7 +1,8 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
TouchableHighlight,

View file

@ -2,7 +2,8 @@
// See License.txt for license information.
import deepEqual from 'deep-equal';
import React, {PropTypes, Component} from 'react';
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {
ListView,
Platform,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {StyleSheet, Text, View} from 'react-native';
const Styles = StyleSheet.create({

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes} from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
Text,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
Text,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes} from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
View

View file

@ -1,16 +1,15 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import Svg, {
Path
} from 'react-native-svg';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import Svg, {Path} from 'react-native-svg';
export default class CheckMark extends React.Component {
export default class CheckMark extends PureComponent {
static propTypes = {
width: React.PropTypes.number.isRequired,
height: React.PropTypes.number.isRequired,
color: React.PropTypes.string.isRequired
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
color: PropTypes.string.isRequired
};
render() {

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes} from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
Text,

View file

@ -1,6 +1,7 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {ListView, Platform, StyleSheet, Text, View} from 'react-native';
import FormattedText from 'app/components/formatted_text';
import {makeStyleSheetFromTheme, changeOpacity} from 'app/utils/theme';

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes} from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
Text,

View file

@ -1,14 +1,14 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import PropTypes from 'prop-types';
import BaseDrawer from 'react-native-drawer';
// Extends react-native-drawer to allow better control over the open/closed state from the parent
export default class Drawer extends BaseDrawer {
static propTypes = {
...BaseDrawer.propTypes,
onRequestClose: React.PropTypes.func.isRequired
onRequestClose: PropTypes.func.isRequired
};
processTapGestures = () => {

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
Dimensions,
StyleSheet,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes} from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
View,

View file

@ -2,7 +2,8 @@
// See License.txt for license information.
import {connect} from 'react-redux';
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {StyleSheet, Text} from 'react-native';
import FormattedText from 'app/components/formatted_text';

View file

@ -1,11 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {
PropTypes,
PureComponent
} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
Text,
TouchableOpacity,

View file

@ -1,11 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {
Component,
PropTypes
} from 'react';
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {
View,
Image,

View file

@ -1,10 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {
PropTypes,
PureComponent
} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
ActivityIndicator,
Animated,

View file

@ -1,11 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {
Component,
PropTypes
} from 'react';
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {
View,
TouchableOpacity

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
Dimensions,
Platform,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {Component, PropTypes} from 'react';
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {injectIntl, intlShape} from 'react-intl';
import {Text} from 'react-native';

View file

@ -1,10 +1,9 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {Component, PropTypes} from 'react';
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {Text} from 'react-native';
import {injectIntl, intlShape} from 'react-intl';
class FormattedText extends Component {

View file

@ -1,16 +1,17 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {injectIntl, intlShape} from 'react-intl';
import {Text} from 'react-native';
class FormattedTime extends React.Component {
class FormattedTime extends Component {
static propTypes = {
intl: intlShape.isRequired,
value: React.PropTypes.any.isRequired,
format: React.PropTypes.string,
children: React.PropTypes.func
value: PropTypes.any.isRequired,
format: PropTypes.string,
children: PropTypes.func
};
render() {

View file

@ -1,14 +1,15 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {KeyboardAvoidingView, Platform, View} from 'react-native';
export default class KeyboardLayout extends React.Component {
export default class KeyboardLayout extends Component {
static propTypes = {
behaviour: React.PropTypes.string,
children: React.PropTypes.node,
keyboardVerticalOffset: React.PropTypes.number
behaviour: PropTypes.string,
children: PropTypes.node,
keyboardVerticalOffset: PropTypes.number
};
render() {

View file

@ -1,7 +1,8 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {ActivityIndicator, StyleSheet, View} from 'react-native';

View file

@ -3,7 +3,8 @@
import {Parser} from 'commonmark';
import Renderer from 'commonmark-react-renderer';
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
Text,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {Image} from 'react-native';
export default class MarkdownLink extends PureComponent {

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {Linking, Text} from 'react-native';
import CustomPropTypes from 'app/constants/custom_prop_types';

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {View} from 'react-native';
export default class MarkdownList extends PureComponent {

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
Text,

View file

@ -1,17 +1,18 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import Svg, {
G,
Path
} from 'react-native-svg';
export default class AwayStatus extends React.Component {
export default class AwayStatus extends PureComponent {
static propTypes = {
width: React.PropTypes.number.isRequired,
height: React.PropTypes.number.isRequired,
color: React.PropTypes.string.isRequired
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
color: PropTypes.string.isRequired
};
render() {

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
ActivityIndicator,
Animated,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import {PropTypes, PureComponent} from 'react';
import {PureComponent} from 'react';
import PropTypes from 'prop-types';
import RNBottomSheet from 'react-native-bottom-sheet';
export default class OptionsContext extends PureComponent {

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import ToolTip from 'react-native-tooltip';
export default class OptionsContext extends PureComponent {

View file

@ -1,16 +1,15 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import Svg, {
Path
} from 'react-native-svg';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import Svg, {Path} from 'react-native-svg';
export default class PaperPlane extends React.Component {
export default class PaperPlane extends PureComponent {
static propTypes = {
width: React.PropTypes.number.isRequired,
height: React.PropTypes.number.isRequired,
color: React.PropTypes.string.isRequired
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
color: PropTypes.string.isRequired
};
render() {

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
Alert,
Image,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes} from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import {StyleSheet, View} from 'react-native';
import FormattedDate from 'app/components/formatted_date';

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PureComponent, PropTypes} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
View,
StyleSheet,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {Component, PropTypes} from 'react';
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {
ListView,
StyleSheet,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
Platform,
StyleSheet,

View file

@ -1,14 +1,15 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Svg, {G, Path} from 'react-native-svg';
export default class PaperClipIcon extends React.Component {
export default class PaperClipIcon extends Component {
static propTypes = {
width: React.PropTypes.number.isRequired,
height: React.PropTypes.number.isRequired,
color: React.PropTypes.string.isRequired
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
color: PropTypes.string.isRequired
};
setNativeProps = (nativeProps) => {

View file

@ -1,17 +1,18 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
Alert,
BackAndroid,
BackHandler,
Keyboard,
Platform,
StyleSheet,
TouchableOpacity,
View,
Text,
TextInput
TextInput,
TouchableOpacity,
View
} from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import ImagePicker from 'react-native-image-picker';
@ -70,7 +71,7 @@ class PostTextbox extends PureComponent {
componentDidMount() {
if (Platform.OS === 'android') {
Keyboard.addListener('keyboardDidHide', this.handleAndroidKeyboard);
BackAndroid.addEventListener('hardwareBackPress', this.handleAndroidBack);
BackHandler.addEventListener('hardwareBackPress', this.handleAndroidBack);
}
}
@ -107,7 +108,7 @@ class PostTextbox extends PureComponent {
componentWillUnmount() {
if (Platform.OS === 'android') {
Keyboard.removeListener('keyboardDidHide', this.handleAndroidKeyboard);
BackAndroid.removeEventListener('hardwareBackPress', this.handleAndroidBack);
BackHandler.removeEventListener('hardwareBackPress', this.handleAndroidBack);
}
}
@ -116,8 +117,12 @@ class PostTextbox extends PureComponent {
};
handleContentSizeChange = (e) => {
let height = e.nativeEvent.contentSize.height;
if (height < INITIAL_HEIGHT) {
height = INITIAL_HEIGHT;
}
this.setState({
contentHeight: e.nativeEvent.contentSize.height
contentHeight: height
});
};
@ -334,7 +339,7 @@ class PostTextbox extends PureComponent {
};
render() {
const {channelIsLoading, theme, value, intl} = this.props;
const {channelIsLoading, intl, theme, value} = this.props;
const style = getStyleSheet(theme);
const textInputHeight = Math.min(this.state.contentHeight, MAX_CONTENT_HEIGHT);
@ -436,7 +441,7 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => {
paddingBottom: 8,
paddingLeft: 12,
paddingRight: 12,
paddingTop: 6,
paddingTop: 8,
textAlignVertical: 'top'
},
inputContainer: {

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {Image, Platform, StyleSheet, View} from 'react-native';
import Icon from 'react-native-vector-icons/FontAwesome';
@ -21,17 +22,17 @@ const STATUS_BUFFER = Platform.select({
android: 2
});
export default class ProfilePicture extends React.PureComponent {
export default class ProfilePicture extends PureComponent {
static propTypes = {
size: React.PropTypes.number,
statusBorderWidth: React.PropTypes.number,
statusSize: React.PropTypes.number,
statusIconSize: React.PropTypes.number,
user: React.PropTypes.object,
status: React.PropTypes.string,
theme: React.PropTypes.object.isRequired,
actions: React.PropTypes.shape({
getStatusForId: React.PropTypes.func.isRequired
size: PropTypes.number,
statusBorderWidth: PropTypes.number,
statusSize: PropTypes.number,
statusIconSize: PropTypes.number,
user: PropTypes.object,
status: PropTypes.string,
theme: PropTypes.object.isRequired,
actions: PropTypes.shape({
getStatusForId: PropTypes.func.isRequired
})
};

View file

@ -1,36 +0,0 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {goToNotification, queueNotification} from 'app/actions/views/root';
import {setDeviceToken} from 'mattermost-redux/actions/general';
import {getUnreads} from 'mattermost-redux/selectors/entities/channels';
import PushNotification from './push_notification';
function mapStateToProps(state, ownProps) {
const {currentTeamId, teams} = state.entities.teams;
const {currentChannelId} = state.entities.channels;
return {
...ownProps,
currentTeamId,
currentChannelId,
teams,
...getUnreads(state)
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
goToNotification,
queueNotification,
setDeviceToken
}, dispatch)
};
}
export default connect(mapStateToProps, mapDispatchToProps)(PushNotification);

View file

@ -1,133 +0,0 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import {Platform} from 'react-native';
import DeviceNotification from 'react-native-push-notification';
import {MessageBar, MessageBarManager} from 'react-native-message-bar';
import {changeOpacity} from 'app/utils/theme';
import icon from 'assets/images/icon.png';
import {GooglePlaySenderId} from 'assets/config.json';
import {General} from 'mattermost-redux/constants';
export default class PushNotification extends PureComponent {
static propTypes = {
actions: PropTypes.shape({
goToNotification: PropTypes.func.isRequired,
queueNotification: PropTypes.func.isRequired,
setDeviceToken: PropTypes.func.isRequired
}).isRequired,
currentTeamId: PropTypes.string,
currentChannelId: PropTypes.string,
mentionCount: PropTypes.number,
teams: PropTypes.object
};
static defaultProps: {
mentionCount: 0,
teams: {}
};
constructor(props) {
super(props);
this.isConfigured = false;
}
componentDidMount() {
MessageBarManager.registerMessageBar(this.refs.notification);
this.configurePushNotifications();
}
componentWillUnmount() {
MessageBarManager.unregisterMessageBar();
DeviceNotification.unregister();
}
componentWillReceiveProps(props) {
if (this.isConfigured) {
DeviceNotification.setApplicationIconBadgeNumber(props.mentionCount);
}
}
configurePushNotifications = () => {
DeviceNotification.configure({
onRegister: this.onRegisterDevice,
onNotification: this.onPushNotification,
senderID: GooglePlaySenderId,
popInitialNotification: true,
requestPermissions: true
});
};
onRegisterDevice = (data) => {
const prefix = Platform.OS === 'ios' ? General.PUSH_NOTIFY_APPLE_REACT_NATIVE : General.PUSH_NOTIFY_ANDROID_REACT_NATIVE;
this.props.actions.setDeviceToken(`${prefix}:${data.token}`);
this.isConfigured = true;
};
onPushNotification = (deviceNotification) => {
const {foreground, userInteraction, data, message} = deviceNotification;
let notification;
if (Platform.OS === 'android') {
notification = {
data: {
channel_id: deviceNotification.channel_id,
team_id: deviceNotification.team_id
},
message
};
} else {
notification = {
data,
message
};
}
if (foreground) {
this.handleInAppNotification(notification);
} else if (userInteraction) {
this.onNotificationTapped(notification);
}
};
onNotificationTapped = (notification) => {
const {currentTeamId, currentChannelId, teams} = this.props;
if (currentTeamId && currentChannelId && Object.keys(teams).length) {
// this means that the store has the necessary data
this.props.actions.goToNotification(notification);
} else {
this.props.actions.queueNotification(notification);
}
};
handleInAppNotification = (notification) => {
const {data, message} = notification;
const {currentChannelId} = this.props;
if (data.channel_id !== currentChannelId) {
MessageBarManager.showAlert({
alertType: 'extra',
avatar: icon,
avatarStyle: {borderRadius: 10, width: 20, height: 20},
message,
stylesheetExtra: {backgroundColor: changeOpacity('#000', 0.9)},
messageStyle: {color: 'white', fontSize: 13},
viewTopInset: 15,
viewBottomInset: 15,
duration: 5000,
onTapped: () => this.onNotificationTapped(notification)
});
}
};
render() {
return (
<MessageBar ref='notification'/>
);
}
}

View file

@ -1,16 +1,17 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import Svg, {
Path
} from 'react-native-svg';
export default class ReplyIcon extends React.Component {
export default class ReplyIcon extends PureComponent {
static propTypes = {
width: React.PropTypes.number.isRequired,
height: React.PropTypes.number.isRequired,
color: React.PropTypes.string.isRequired
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
color: PropTypes.string.isRequired
};
render() {

View file

@ -5,6 +5,7 @@ import {connect} from 'react-redux';
import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels';
import {getTheme} from 'app/selectors/preferences';
import Config from 'assets/config.json';
import Root from './root';
@ -20,6 +21,7 @@ function mapStateToProps(state, ownProps) {
return {
...ownProps,
theme: getTheme(state),
currentChannelId: getCurrentChannelId(state),
locale
};

View file

@ -1,7 +1,8 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {IntlProvider} from 'react-intl';
import EventEmitter from 'mattermost-redux/utils/event_emitter';
@ -14,15 +15,18 @@ export default class Root extends PureComponent {
children: PropTypes.node,
navigator: PropTypes.object,
currentChannelId: PropTypes.string,
locale: PropTypes.string.isRequired
locale: PropTypes.string.isRequired,
theme: PropTypes.object.isRequired
};
componentWillMount() {
EventEmitter.on(ViewTypes.NOTIFICATION_IN_APP, this.handleInAppNotification);
EventEmitter.on(ViewTypes.NOTIFICATION_TAPPED, this.handleNotificationTapped);
}
componentWillUnmount() {
EventEmitter.off(ViewTypes.NOTIFICATION_IN_APP, this.handleInAppNotification);
EventEmitter.off(ViewTypes.NOTIFICATION_TAPPED, this.handleNotificationTapped);
}
handleInAppNotification = (notification) => {
@ -42,6 +46,21 @@ export default class Root extends PureComponent {
}
};
handleNotificationTapped = () => {
const {navigator, theme} = this.props;
navigator.resetTo({
screen: 'Channel',
animated: true,
navigatorStyle: {
navBarHidden: true,
statusBarHidden: false,
statusBarHideWithNavBar: false,
screenBackgroundColor: theme.centerChannelBg
}
});
};
render() {
const locale = this.props.locale;

View file

@ -1,6 +1,7 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
Keyboard,
TextInput,

View file

@ -1,6 +1,7 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import SearchBar from 'react-native-search-bar';
export default class SearchBarIos extends PureComponent {

View file

@ -1,7 +1,8 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {View} from 'react-native';
import Svg, {
Ellipse,
@ -9,11 +10,11 @@ import Svg, {
Path
} from 'react-native-svg';
export default class AwayStatus extends React.Component {
export default class AwayStatus extends PureComponent {
static propTypes = {
width: React.PropTypes.number.isRequired,
height: React.PropTypes.number.isRequired,
color: React.PropTypes.string.isRequired
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
color: PropTypes.string.isRequired
};
render() {

View file

@ -1,7 +1,8 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {View} from 'react-native';
import Svg, {
Ellipse,
@ -9,11 +10,11 @@ import Svg, {
Path
} from 'react-native-svg';
export default class OfflineStatus extends React.Component {
export default class OfflineStatus extends PureComponent {
static propTypes = {
width: React.PropTypes.number.isRequired,
height: React.PropTypes.number.isRequired,
color: React.PropTypes.string.isRequired
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
color: PropTypes.string.isRequired
};
render() {

View file

@ -1,7 +1,8 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {View} from 'react-native';
import Svg, {
Ellipse,
@ -9,11 +10,11 @@ import Svg, {
Path
} from 'react-native-svg';
export default class OnlineStatus extends React.Component {
export default class OnlineStatus extends PureComponent {
static propTypes = {
width: React.PropTypes.number.isRequired,
height: React.PropTypes.number.isRequired,
color: React.PropTypes.string.isRequired
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
color: PropTypes.string.isRequired
};
render() {

View file

@ -1,14 +1,15 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {injectIntl, intlShape} from 'react-intl';
import {TextInput} from 'react-native';
class TextInputWithLocalizedPlaceholder extends React.PureComponent {
class TextInputWithLocalizedPlaceholder extends PureComponent {
static propTypes = {
...TextInput.propTypes,
placeholder: React.PropTypes.object.isRequired,
placeholder: PropTypes.object.isRequired,
intl: intlShape.isRequired
};

View file

@ -1,7 +1,7 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import {PropTypes} from 'react';
import PropTypes from 'prop-types';
export const Children = PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf([PropTypes.node])]);

View file

@ -16,6 +16,7 @@ const ViewTypes = keyMirror({
NOTIFICATION_CHANGED: null,
NOTIFICATION_IN_APP: null,
NOTIFICATION_TAPPED: null,
CONNECTION_CHANGED: null,

View file

@ -144,6 +144,7 @@ export default class Mattermost {
if (!state.views.root.appInitializing) {
// go to notification if the app is initialized
goToNotification(notification)(dispatch, getState);
EventEmitter.emit(ViewTypes.NOTIFICATION_TAPPED);
} else if (state.entities.general.credentials.token) {
// queue notification if app is not initialized but we are logged in
queueNotification(notification)(dispatch, getState);

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
Linking,
ScrollView,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {injectIntl, intlShape} from 'react-intl';
import {
Keyboard,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes} from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
View

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes} from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
Switch,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {injectIntl, intlShape} from 'react-intl';
import {
StyleSheet,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {injectIntl, intlShape} from 'react-intl';
import {
Dimensions,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import {
PanResponder,
@ -58,9 +59,7 @@ class ChannelDrawerButton extends PureComponent {
}
componentWillReceiveProps(nextProps) {
if (nextProps.mentionCount !== this.props.mentionCount) {
DeviceNotification.setApplicationIconBadgeNumber(nextProps.mentionCount);
}
DeviceNotification.setApplicationIconBadgeNumber(nextProps.mentionCount);
}
componentWillUnmount() {

View file

@ -1,7 +1,8 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {injectIntl, intlShape} from 'react-intl';
import {
Animated,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes} from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import {
Text,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {injectIntl, intlShape} from 'react-intl';
import {
Alert,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {injectIntl, intlShape} from 'react-intl';
import {
Alert,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes} from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
Text,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes} from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
Switch,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
Alert,
Keyboard,

View file

@ -1,6 +1,7 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {injectIntl, intlShape} from 'react-intl';
import {
Dimensions,

View file

@ -1,6 +1,7 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {injectIntl, intlShape} from 'react-intl';
import {
Dimensions,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
Animated,
Dimensions,

View file

@ -2,7 +2,8 @@
// http://stackoverflow.com/users/219449/leonti
// http://stackoverflow.com/questions/36368919/scrollable-image-with-pinch-to-zoom
import React, {Component, PropTypes} from 'react';
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {
View,
PanResponder

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {StatusBar, View} from 'react-native';
import {RequestStatus} from 'mattermost-redux/constants';

View file

@ -1,7 +1,8 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PureComponent, PropTypes} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {injectIntl, intlShape} from 'react-intl';
import {
ActivityIndicator,
@ -31,12 +32,12 @@ class Login extends PureComponent {
intl: intlShape.isRequired,
navigator: PropTypes.object,
theme: PropTypes.object,
actions: React.PropTypes.shape({
handleLoginIdChanged: React.PropTypes.func.isRequired,
handlePasswordChanged: React.PropTypes.func.isRequired,
handleSuccessfulLogin: React.PropTypes.func.isRequired,
checkMfa: React.PropTypes.func.isRequired,
login: React.PropTypes.func.isRequired
actions: PropTypes.shape({
handleLoginIdChanged: PropTypes.func.isRequired,
handlePasswordChanged: PropTypes.func.isRequired,
handleSuccessfulLogin: PropTypes.func.isRequired,
checkMfa: PropTypes.func.isRequired,
login: PropTypes.func.isRequired
}).isRequired,
config: PropTypes.object.isRequired,
license: PropTypes.object.isRequired,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {injectIntl, intlShape} from 'react-intl';
import {
Image,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
ActivityIndicator,
Image,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {injectIntl, intlShape} from 'react-intl';
import {
Keyboard,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {injectIntl, intlShape} from 'react-intl';
import {
Keyboard,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
Dimensions,
Image,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
Animated,
Dimensions,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
Text,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
Text,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {Client, Client4} from 'mattermost-redux/client';
import {RequestStatus} from 'mattermost-redux/constants';

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
InteractionManager,
StatusBar,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {injectIntl, intlShape} from 'react-intl';
import {
ActivityIndicator,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
Image,
InteractionManager,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {injectIntl, intlShape} from 'react-intl';
import {
InteractionManager,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {StyleSheet, TouchableOpacity, View} from 'react-native';
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
import IonIcon from 'react-native-vector-icons/Ionicons';

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {StatusBar, StyleSheet} from 'react-native';
import KeyboardLayout from 'app/components/layout/keyboard_layout';
@ -11,7 +12,7 @@ import {makeStyleSheetFromTheme} from 'app/utils/theme';
export default class Thread extends PureComponent {
static propTypes = {
actions: React.PropTypes.shape({
actions: PropTypes.shape({
handleCommentDraftChanged: PropTypes.func.isRequired,
selectPost: PropTypes.func.isRequired
}).isRequired,

View file

@ -1,7 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PropTypes, PureComponent} from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
ScrollView,
StyleSheet,

Some files were not shown because too many files have changed in this diff Show more