RN-151 tap on unread post above (#591)

This commit is contained in:
enahum 2017-05-31 12:02:47 -04:00 committed by Harrison Healey
parent 2309c91f88
commit 8669d5bb58
2 changed files with 15 additions and 6 deletions

View file

@ -408,6 +408,7 @@ class ChannelDrawerList extends Component {
above = (
<UnreadIndicator
style={[styles.above, {width: (this.width - 40)}]}
onPress={() => this.refs.list.scrollToOffset({x: 0, y: 0, animated: true})}
text={(
<FormattedText
style={styles.indicatorText}

View file

@ -6,6 +6,7 @@ import PropTypes from 'prop-types';
import {
StyleSheet,
Text,
TouchableWithoutFeedback,
View,
ViewPropTypes
} from 'react-native';
@ -14,16 +15,23 @@ export default class UnreadIndicator extends PureComponent {
static propTypes = {
style: ViewPropTypes.style,
textStyle: Text.propTypes.style,
text: PropTypes.node.isRequired
text: PropTypes.node.isRequired,
onPress: PropTypes.func
};
static defaultProps = {
onPress: () => true
};
render() {
return (
<View
style={[Styles.container, this.props.style]}
>
{this.props.text}
</View>
<TouchableWithoutFeedback onPress={this.props.onPress}>
<View
style={[Styles.container, this.props.style]}
>
{this.props.text}
</View>
</TouchableWithoutFeedback>
);
}
}