fixed tags width bug

This commit is contained in:
ue 2018-10-31 15:29:15 +03:00
parent 049468dc52
commit 31edb864d6
7 changed files with 10 additions and 233 deletions

View File

@ -6,7 +6,6 @@ import { View } from 'react-native';
// Components
import { FilterBar } from '../../filterBar';
import { Comments } from '../../comments';
import { NoPost } from '../../basicUIElements';
// Styles
// import styles from './commentsDisplayStyles';
@ -36,7 +35,7 @@ class CommentsDisplayView extends Component {
return (
<Fragment>
{commentCount > 0 ? (
{commentCount > 0 && (
<Fragment>
<FilterBar
dropdownIconName="md-arrow-dropdown"
@ -48,8 +47,6 @@ class CommentsDisplayView extends Component {
<Comments currentUser={currentUser} author={author} permlink={permlink} />
</View>
</Fragment>
) : (
<NoPost defaultText="No comment anything yet!" />
)}
</Fragment>
);

View File

@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { View } from 'react-native';
import { View, FlatList } from 'react-native';
// Components
import { Tag } from '../../../basicUIElements';
@ -23,9 +23,13 @@ class TagsView extends Component {
return (
<View style={styles.container}>
{tags.map((chip, i) => (
<Tag key={i} value={chip} isPin={i === 0} onPress={handleOnTagPress} />
))}
<FlatList
data={tags}
horizontal
renderItem={({ item, index }) => (
<Tag key={index} value={item} isPin={index === 0} onPress={handleOnTagPress} />
)}
/>
</View>
);
}

View File

@ -23,7 +23,7 @@ export default EStyleSheet.create({
footer: {
flexDirection: 'column',
marginTop: 19,
marginBottom: 12,
marginBottom: 50,
},
footerText: {
fontSize: 10,

View File

@ -1,17 +0,0 @@
import React, { Component } from 'react';
// Components
import { SinglePostScreen } from '..';
class SinglePostContainer extends Component {
constructor(props) {
super(props);
this.state = {};
}
render() {
return <SinglePostScreen {...this.props} />;
}
}
export default SinglePostContainer;

View File

@ -1,5 +0,0 @@
import SinglePost from './container/singlePostContainer';
import SinglePostScreen from './screen/singlePostScreen';
export { SinglePost, SinglePostScreen };
export default SinglePost;

View File

@ -1,189 +0,0 @@
/* eslint-disable no-console */
/* eslint-disable no-unused-vars */
import React from 'react';
import {
Dimensions,
ActivityIndicator,
StatusBar,
FlatList,
BackHandler,
ScrollView,
TextInput,
Image,
View,
} from 'react-native';
import {
Card, Button, Icon, Text, Title,
} from 'native-base';
import HTML from 'react-native-html-renderer';
import { Navigation } from 'react-native-navigation';
import styles from './singlePostStyles';
/* eslint-enable no-unused-vars */
class SinglePostScreen extends React.Component {
static get options() {
return {
_statusBar: {
visible: true,
drawBehind: false,
},
topBar: {
animate: true,
hideOnScroll: false,
drawBehind: false,
leftButtons: {
id: 'back',
},
},
layout: {
backgroundColor: '#f5fcff',
},
bottomTabs: {
visible: false,
drawBehind: true,
},
};
}
constructor(props) {
super(props);
Navigation.events().bindComponent(this);
this.state = {
comments: [],
comment: '',
isLoading: false,
};
}
componentDidMount() {
BackHandler.addEventListener('hardwareBackPress', () => {
Navigation.pop(this.props.componentId);
return true;
});
}
componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress');
}
onLinkPress(evt, href, attribs) {}
alterNode(node) {
if (node.name == 'img') {
node.attribs.style = `max-width: ${Dimensions.get('window').width
+ 10}px; left: -10px; width: 100% !important`;
} else if (node.name == 'iframe') {
node.attribs.style = `max-width: ${
Dimensions.get('window').width
}px; left: -10px`;
node.attribs.height = 200;
}
}
navigationButtonPressed({ buttonId }) {
// will be called when "buttonOne" is clicked
if (buttonId === 'back') {
Navigation.pop(this.props.componentId);
}
}
render() {
return (
<View style={{ flex: 1 }}>
<ScrollView style={{ flex: 1 }}>
<View style={{ flexDirection: 'row' }}>
<View style={{ flex: 0.2 }}>
<Image
style={{
height: 40,
width: 40,
borderWidth: 1,
borderColor: 'lightgray',
}}
source={{
uri: this.props.content.avatar,
}}
/>
</View>
<View style={{ flex: 0.4 }}>
<Text>{this.props.content.author}</Text>
<Text note>
#
{this.props.content.category}
</Text>
</View>
<View style={{ flex: 0.4, alignItems: 'flex-end' }}>
<Text note>{this.props.content.created}</Text>
</View>
</View>
<View>
<Text style={{ fontWeight: 'bold' }}>
{this.props.content.title}
</Text>
</View>
<HTML
html={this.props.content.body}
onLinkPress={(evt, href, hrefatr) => this.onLinkPress(evt, href, hrefatr)
}
containerStyle={{ padding: 10 }}
textSelectable
tagsStyles={styles}
ignoredTags={['script']}
debug={false}
alterNode={(node) => {
this.alterNode(node);
}}
imagesMaxWidth={Dimensions.get('window').width}
/>
<View style={{ padding: 10 }}>
<TextInput
style={{
borderWidth: 1,
borderColor: 'lightgray',
borderRadius: 5,
padding: 10,
minHeight: 100,
}}
multiline
numberOfLines={4}
placeholder="What do you think about this story?"
onChangeText={comment => this.setState({ comment })}
value={this.state.comment}
/>
<View style={{ flexDirection: 'row-reverse' }}>
<Button
onPress={this.postComment}
style={{
alignSelf: 'flex-end',
marginTop: 10,
borderRadius: 20,
}}
>
{this.state.isLoading ? (
<ActivityIndicator
style={{ marginHorizontal: 50 }}
/>
) : (
<Text>Post a Comment</Text>
)}
</Button>
<Button
style={{
alignSelf: 'flex-end',
marginRight: 10,
borderRadius: 50,
}}
>
<Icon name="images" />
</Button>
</View>
</View>
</ScrollView>
</View>
);
}
}
export default SinglePostScreen;

View File

@ -1,13 +0,0 @@
import EStyleSheet from 'react-native-extended-stylesheet';
export default EStyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
comments: {
flex: 1,
backgroundColor: 'white',
},
});