Various Updates and fixes (#559)

* Update to latest mattermost-redux

* Update View.propTypes to ViewPropTypes

* use an empty object if the draft is undefined
This commit is contained in:
enahum
2017-05-22 14:17:30 -04:00
committed by GitHub
parent 7aa4fbd4a5
commit 26c365a00b
10 changed files with 112 additions and 86 deletions

View File

@@ -8,7 +8,8 @@ import {
StyleSheet,
Text,
TouchableWithoutFeedback,
View
View,
ViewPropTypes
} from 'react-native';
export default class Badge extends PureComponent {
@@ -21,7 +22,7 @@ export default class Badge extends PureComponent {
static propTypes = {
count: PropTypes.number.isRequired,
extraPaddingHorizontal: PropTypes.number,
style: View.propTypes.style,
style: ViewPropTypes.style,
countStyle: Text.propTypes.style,
minHeight: PropTypes.number,
minWidth: PropTypes.number,

View File

@@ -3,23 +3,16 @@
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {StyleSheet, Text, View} from 'react-native';
const Styles = StyleSheet.create({
container: {
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'row',
position: 'absolute',
borderRadius: 15,
marginHorizontal: 15,
height: 25
}
});
import {
StyleSheet,
Text,
View,
ViewPropTypes
} from 'react-native';
export default class UnreadIndicator extends PureComponent {
static propTypes = {
style: View.propTypes.style,
style: ViewPropTypes.style,
textStyle: Text.propTypes.style,
text: PropTypes.node.isRequired
};
@@ -34,3 +27,15 @@ export default class UnreadIndicator extends PureComponent {
);
}
}
const Styles = StyleSheet.create({
container: {
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'row',
position: 'absolute',
borderRadius: 15,
marginHorizontal: 15,
height: 25
}
});

View File

@@ -4,25 +4,18 @@
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {ActivityIndicator, StyleSheet, View} from 'react-native';
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
},
loading: {
marginLeft: 3
}
});
import {
ActivityIndicator,
StyleSheet,
View,
ViewPropTypes
} from 'react-native';
export default class Loading extends PureComponent {
static propTypes = {
size: PropTypes.string,
color: PropTypes.string,
style: View.propTypes.style
style: ViewPropTypes.style
};
static defaultProps = {
@@ -44,3 +37,15 @@ export default class Loading extends PureComponent {
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
},
loading: {
marginLeft: 3
}
});

View File

@@ -11,7 +11,8 @@ import {
Text,
TouchableHighlight,
TouchableOpacity,
View
View,
ViewPropTypes
} from 'react-native';
import {injectIntl, intlShape} from 'react-intl';
import Icon from 'react-native-vector-icons/Ionicons';
@@ -45,7 +46,7 @@ class Post extends PureComponent {
commentCount: PropTypes.number.isRequired,
currentUserId: PropTypes.string.isRequired,
intl: intlShape.isRequired,
style: View.propTypes.style,
style: ViewPropTypes.style,
post: PropTypes.object.isRequired,
user: PropTypes.object,
displayName: PropTypes.string,

View File

@@ -3,35 +3,15 @@
import React from 'react';
import PropTypes from 'prop-types';
import {StyleSheet, View} from 'react-native';
import {
StyleSheet,
View,
ViewPropTypes
} from 'react-native';
import FormattedDate from 'app/components/formatted_date';
import {makeStyleSheetFromTheme} from 'app/utils/theme';
const getStyleSheet = makeStyleSheetFromTheme((theme) => {
return StyleSheet.create({
container: {
alignItems: 'center',
flexDirection: 'row',
height: 28
},
dateContainer: {
marginHorizontal: 15
},
line: {
flex: 1,
height: StyleSheet.hairlineWidth,
backgroundColor: theme.centerChannelColor,
opacity: 0.2
},
date: {
color: theme.centerChannelColor,
fontSize: 14,
fontWeight: '600'
}
});
});
function DateHeader(props) {
const style = getStyleSheet(props.theme);
@@ -56,7 +36,31 @@ function DateHeader(props) {
DateHeader.propTypes = {
date: PropTypes.object.isRequired,
theme: PropTypes.object.isRequired,
style: View.propTypes.style
style: ViewPropTypes.style
};
const getStyleSheet = makeStyleSheetFromTheme((theme) => {
return StyleSheet.create({
container: {
alignItems: 'center',
flexDirection: 'row',
height: 28
},
dateContainer: {
marginHorizontal: 15
},
line: {
flex: 1,
height: StyleSheet.hairlineWidth,
backgroundColor: theme.centerChannelColor,
opacity: 0.2
},
date: {
color: theme.centerChannelColor,
fontSize: 14,
fontWeight: '600'
}
});
});
export default DateHeader;

View File

@@ -4,9 +4,10 @@
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
View,
StyleSheet,
TouchableOpacity
TouchableOpacity,
View,
ViewPropTypes
} from 'react-native';
import {makeStyleSheetFromTheme} from 'app/utils/theme';
@@ -18,7 +19,7 @@ export default class LoadMorePosts extends PureComponent {
loading: PropTypes.bool.isRequired,
loadMore: PropTypes.func,
theme: PropTypes.object.isRequired,
style: View.propTypes.style
style: ViewPropTypes.style
};
loadMore = () => {

View File

@@ -2,10 +2,34 @@
// See License.txt for license information.
import React from 'react';
import {StyleSheet, View} from 'react-native';
import {
StyleSheet,
View,
ViewPropTypes
} from 'react-native';
import FormattedText from 'app/components/formatted_text';
function NewMessagesDivider(props) {
return (
<View style={[style.container, props.style]}>
<View style={style.line}/>
<View style={style.textContainer}>
<FormattedText
id='post_list.newMsg'
defaultMessage='New Messages'
style={style.text}
/>
</View>
<View style={style.line}/>
</View>
);
}
NewMessagesDivider.propTypes = {
style: ViewPropTypes.style
};
const style = StyleSheet.create({
container: {
alignItems: 'center',
@@ -27,24 +51,4 @@ const style = StyleSheet.create({
}
});
function NewMessagesDivider(props) {
return (
<View style={[style.container, props.style]}>
<View style={style.line}/>
<View style={style.textContainer}>
<FormattedText
id='post_list.newMsg'
defaultMessage='New Messages'
style={style.text}
/>
</View>
<View style={style.line}/>
</View>
);
}
NewMessagesDivider.propTypes = {
style: View.propTypes.style
};
export default NewMessagesDivider;

View File

@@ -59,9 +59,14 @@ export default class PostList extends Component {
componentWillReceiveProps(nextProps) {
if (nextProps.posts !== this.props.posts) {
this.props.actions.setChannelRefreshing(false);
const posts = this.getPostsWithDates(nextProps);
this.setState({posts});
this.setState({posts}, () => {
if (nextProps.refreshing) {
this.props.actions.setChannelRefreshing(false);
}
});
} else if (nextProps.refreshing) {
this.props.actions.setChannelRefreshing(false);
}
}

View File

@@ -174,7 +174,7 @@ class Channel extends PureComponent {
);
}
const channelDraft = this.props.drafts[currentChannel.id];
const channelDraft = this.props.drafts[currentChannel.id] || {};
const style = getStyleFromTheme(theme);
return (

View File

@@ -3526,7 +3526,7 @@ makeerror@1.0.x:
mattermost-redux@mattermost/mattermost-redux#master:
version "0.0.1"
resolved "https://codeload.github.com/mattermost/mattermost-redux/tar.gz/95a1a719b9b0b692f27ed93235751647777cbddd"
resolved "https://codeload.github.com/mattermost/mattermost-redux/tar.gz/dad1a74263edb36271bf422cef977a06ac56815c"
dependencies:
deep-equal "1.0.1"
harmony-reflect "1.5.1"