mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-23 05:13:04 +03:00
seperated styles && refactored a bit && created container comp
This commit is contained in:
parent
0983149796
commit
243fa96bf9
@ -1,6 +1,6 @@
|
||||
import Logo from "./logo/logo";
|
||||
import Comment from "./comment/comment";
|
||||
import PostCard from "./post-card/postCard";
|
||||
import PostCard from "./postCard";
|
||||
import Reply from "./reply/reply";
|
||||
import Search from "./search/search";
|
||||
import { FormInput } from "./formInput";
|
||||
|
@ -1,653 +0,0 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import React from "react";
|
||||
import {
|
||||
StyleSheet,
|
||||
Image,
|
||||
TouchableOpacity,
|
||||
Dimensions,
|
||||
FlatList,
|
||||
ActivityIndicator,
|
||||
} from "react-native";
|
||||
import {
|
||||
Card,
|
||||
CardItem,
|
||||
Left,
|
||||
Right,
|
||||
Thumbnail,
|
||||
View,
|
||||
Icon,
|
||||
Body,
|
||||
Text,
|
||||
} from "native-base";
|
||||
import { Navigation } from "react-native-navigation";
|
||||
|
||||
import Modal from "react-native-modal";
|
||||
import { Popover, PopoverController } from "react-native-modal-popover";
|
||||
import Slider from "react-native-slider";
|
||||
|
||||
// STEEM
|
||||
import { upvote, upvoteAmount } from "../../providers/steem/dsteem";
|
||||
import { decryptKey } from "../../utils/crypto";
|
||||
import { getUserData } from "../../realm/realm";
|
||||
/* eslint-enable no-unused-vars */
|
||||
|
||||
class PostCard extends React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.upvoteContent = this.upvoteContent.bind(this);
|
||||
this.calculateEstimatedAmount = this.calculateEstimatedAmount.bind(
|
||||
this
|
||||
);
|
||||
|
||||
this.state = {
|
||||
value: 0.0,
|
||||
isVoting: false,
|
||||
isVoted: this.props.content.isVoted,
|
||||
amount: "0.00",
|
||||
isModalVisible: false,
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (this.props.isLoggedIn == true) {
|
||||
this.calculateEstimatedAmount();
|
||||
}
|
||||
}
|
||||
|
||||
calculateEstimatedAmount = async () => {
|
||||
// Calculate total vesting shares
|
||||
let total_vests =
|
||||
parseFloat(this.props.user.vesting_shares) +
|
||||
parseFloat(this.props.user.received_vesting_shares) -
|
||||
parseFloat(this.props.user.delegated_vesting_shares);
|
||||
|
||||
let final_vest = total_vests * 1e6;
|
||||
|
||||
let power =
|
||||
(this.props.user.voting_power * (this.state.value * 10000)) /
|
||||
10000 /
|
||||
50;
|
||||
|
||||
let rshares = (power * final_vest) / 10000;
|
||||
|
||||
let estimated = await upvoteAmount(rshares);
|
||||
|
||||
this.setState({
|
||||
amount: estimated.toFixed(3),
|
||||
});
|
||||
};
|
||||
|
||||
upvoteContent = async () => {
|
||||
let postingKey;
|
||||
let userData;
|
||||
|
||||
if (this.props.isLoggedIn) {
|
||||
await this.setState({
|
||||
isVoting: true,
|
||||
});
|
||||
|
||||
await getUserData().then(result => {
|
||||
userData = Array.from(result);
|
||||
postingKey = decryptKey(userData[0].postingKey, "pinCode");
|
||||
});
|
||||
upvote(
|
||||
{
|
||||
voter: this.props.user.name,
|
||||
author: this.props.content.author,
|
||||
permlink: this.props.content.permlink,
|
||||
weight: (this.state.value * 100).toFixed(0) * 100,
|
||||
},
|
||||
postingKey
|
||||
)
|
||||
.then(res => {
|
||||
console.log(res);
|
||||
this.setState({
|
||||
isVoted: true,
|
||||
isVoting: false,
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
this.setState({
|
||||
isVoted: false,
|
||||
isVoting: false,
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
toggleModal = () => {
|
||||
this.setState({
|
||||
isModalVisible: !this.state.isModalVisible,
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Card style={styles.post}>
|
||||
<CardItem style={styles.header}>
|
||||
<Left>
|
||||
<TouchableOpacity
|
||||
onPress={() =>
|
||||
Navigation.push("tab1Stack", {
|
||||
component: {
|
||||
name: "navigation.eSteem.Author",
|
||||
passProps: {
|
||||
author: this.props.content.author,
|
||||
isLoggedIn: this.props.isLoggedIn,
|
||||
user: this.props.user,
|
||||
},
|
||||
options: {
|
||||
topBar: {},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
>
|
||||
<Thumbnail
|
||||
style={styles.avatar}
|
||||
source={{ uri: this.props.content.avatar }}
|
||||
/>
|
||||
</TouchableOpacity>
|
||||
<Body style={styles.body}>
|
||||
<View style={styles.author}>
|
||||
<Text style={styles.authorName}>
|
||||
{this.props.content.author}
|
||||
</Text>
|
||||
</View>
|
||||
<View style={styles.badge}>
|
||||
<Text style={styles.text}>
|
||||
{this.props.content.author_reputation}
|
||||
</Text>
|
||||
</View>
|
||||
<View style={styles.category}>
|
||||
<Text style={styles.categoryText}>
|
||||
{this.props.content.category}
|
||||
</Text>
|
||||
</View>
|
||||
<Text style={styles.timeAgo} note>
|
||||
{" "}
|
||||
{this.props.content.created}{" "}
|
||||
</Text>
|
||||
</Body>
|
||||
</Left>
|
||||
<Right>
|
||||
<Icon name="md-more" />
|
||||
</Right>
|
||||
</CardItem>
|
||||
<Image
|
||||
source={{ uri: this.props.content.image }}
|
||||
defaultSource={require("../../assets/no_image.png")}
|
||||
style={styles.image}
|
||||
/>
|
||||
<TouchableOpacity
|
||||
onPress={() =>
|
||||
Navigation.push("tab1Stack", {
|
||||
component: {
|
||||
name: "navigation.eSteem.Post",
|
||||
passProps: {
|
||||
content: this.props.content,
|
||||
isLoggedIn: this.props.isLoggedIn,
|
||||
user: this.props.user,
|
||||
},
|
||||
options: {
|
||||
topBar: {},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
>
|
||||
<CardItem>
|
||||
<Body>
|
||||
<Text style={styles.title}>
|
||||
{this.props.content.title}
|
||||
</Text>
|
||||
<Text style={styles.summary}>
|
||||
{this.props.content.summary}
|
||||
</Text>
|
||||
</Body>
|
||||
</CardItem>
|
||||
</TouchableOpacity>
|
||||
<CardItem>
|
||||
<Left>
|
||||
<PopoverController>
|
||||
{({
|
||||
openPopover,
|
||||
closePopover,
|
||||
popoverVisible,
|
||||
setPopoverAnchor,
|
||||
popoverAnchorRect,
|
||||
}) => (
|
||||
<React.Fragment>
|
||||
<TouchableOpacity
|
||||
start
|
||||
ref={setPopoverAnchor}
|
||||
onPress={openPopover}
|
||||
style={styles.upvoteButton}
|
||||
>
|
||||
{this.state.isVoting ? (
|
||||
<ActivityIndicator />
|
||||
) : (
|
||||
<View>
|
||||
{this.state.isVoted ? (
|
||||
<Icon
|
||||
style={{
|
||||
color: "#007ee5",
|
||||
}}
|
||||
style={
|
||||
styles.upvoteIcon
|
||||
}
|
||||
active
|
||||
name="ios-arrow-dropup-circle"
|
||||
/>
|
||||
) : (
|
||||
<Icon
|
||||
style={{
|
||||
color: "#007ee5",
|
||||
}}
|
||||
style={
|
||||
styles.upvoteIcon
|
||||
}
|
||||
active
|
||||
name="ios-arrow-dropup-outline"
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
<Popover
|
||||
contentStyle={styles.popover}
|
||||
arrowStyle={styles.arrow}
|
||||
backgroundStyle={styles.background}
|
||||
visible={popoverVisible}
|
||||
onClose={closePopover}
|
||||
fromRect={popoverAnchorRect}
|
||||
placement={"top"}
|
||||
supportedOrientations={[
|
||||
"portrait",
|
||||
"landscape",
|
||||
]}
|
||||
>
|
||||
<Text>${this.state.amount}</Text>
|
||||
<View
|
||||
style={{
|
||||
flex: 1,
|
||||
flexDirection: "row",
|
||||
}}
|
||||
>
|
||||
<TouchableOpacity
|
||||
onPress={() => {
|
||||
closePopover();
|
||||
this.upvoteContent();
|
||||
}}
|
||||
style={{
|
||||
flex: 0.1,
|
||||
alignSelf: "center",
|
||||
}}
|
||||
>
|
||||
<Icon
|
||||
style={{ color: "#007ee5" }}
|
||||
active
|
||||
name="ios-arrow-dropup-outline"
|
||||
/>
|
||||
</TouchableOpacity>
|
||||
<Slider
|
||||
style={{ flex: 0.75 }}
|
||||
minimumTrackTintColor="#13a9d6"
|
||||
trackStyle={styles.track}
|
||||
thumbStyle={styles.thumb}
|
||||
thumbTintColor="#007ee5"
|
||||
value={this.state.value}
|
||||
onValueChange={value => {
|
||||
this.setState(
|
||||
{ value },
|
||||
() => {
|
||||
this.calculateEstimatedAmount();
|
||||
}
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<Text
|
||||
style={{
|
||||
flex: 0.15,
|
||||
alignSelf: "center",
|
||||
marginLeft: 10,
|
||||
}}
|
||||
>
|
||||
{(
|
||||
this.state.value * 100
|
||||
).toFixed(0)}
|
||||
%
|
||||
</Text>
|
||||
</View>
|
||||
</Popover>
|
||||
</React.Fragment>
|
||||
)}
|
||||
</PopoverController>
|
||||
<TouchableOpacity
|
||||
onPress={this.toggleModal}
|
||||
style={styles.payoutButton}
|
||||
>
|
||||
<Text style={styles.payout}>
|
||||
${this.props.content.pending_payout_value}
|
||||
</Text>
|
||||
<Icon
|
||||
name="md-arrow-dropdown"
|
||||
style={styles.payoutIcon}
|
||||
/>
|
||||
<Modal isVisible={this.state.isModalVisible}>
|
||||
<View
|
||||
style={{
|
||||
flex: 0.8,
|
||||
backgroundColor: "white",
|
||||
borderRadius: 10,
|
||||
}}
|
||||
>
|
||||
<TouchableOpacity
|
||||
onPress={this.toggleModal}
|
||||
>
|
||||
<Text>Tap to close!</Text>
|
||||
</TouchableOpacity>
|
||||
<FlatList
|
||||
data={this.props.content.active_votes}
|
||||
keyExtractor={item =>
|
||||
item.voter.toString()
|
||||
}
|
||||
renderItem={({ item }) => (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
borderColor: "lightgray",
|
||||
borderWidth: 1,
|
||||
borderRadius: 10,
|
||||
}}
|
||||
>
|
||||
<Thumbnail
|
||||
style={{
|
||||
width: 34,
|
||||
height: 34,
|
||||
borderRadius: 17,
|
||||
flex: 0.1,
|
||||
}}
|
||||
source={{
|
||||
uri: item.avatar,
|
||||
}}
|
||||
/>
|
||||
<Text style={{ flex: 0.5 }}>
|
||||
{" "}
|
||||
{item.voter} (
|
||||
{item.reputation})
|
||||
</Text>
|
||||
<Text style={{ flex: 0.2 }}>
|
||||
{item.value}$
|
||||
</Text>
|
||||
<Text style={{ flex: 0.2 }}>
|
||||
{item.percent}%
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
/>
|
||||
</View>
|
||||
</Modal>
|
||||
</TouchableOpacity>
|
||||
</Left>
|
||||
<Right>
|
||||
<TouchableOpacity start style={styles.commentButton}>
|
||||
<Icon
|
||||
style={styles.commentIcon}
|
||||
active
|
||||
name="ios-chatbubbles-outline"
|
||||
/>
|
||||
<Text style={styles.comment}>
|
||||
{this.props.content.children}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
</Right>
|
||||
</CardItem>
|
||||
{this.props.content.top_likers ? (
|
||||
<CardItem style={styles.topLikers}>
|
||||
<Thumbnail
|
||||
source={{
|
||||
uri: `https://steemitimages.com/u/${
|
||||
this.props.content.top_likers[0]
|
||||
}/avatar/small`,
|
||||
}}
|
||||
style={styles.likers_1}
|
||||
/>
|
||||
<Thumbnail
|
||||
source={{
|
||||
uri: `https://steemitimages.com/u/${
|
||||
this.props.content.top_likers[1]
|
||||
}/avatar/small`,
|
||||
}}
|
||||
style={styles.likers_2}
|
||||
/>
|
||||
<Thumbnail
|
||||
source={{
|
||||
uri: `https://steemitimages.com/u/${
|
||||
this.props.content.top_likers[2]
|
||||
}/avatar/small`,
|
||||
}}
|
||||
style={styles.likers_3}
|
||||
/>
|
||||
<Text style={styles.footer}>
|
||||
@{this.props.content.top_likers[0]}, @
|
||||
{this.props.content.top_likers[1]}, @
|
||||
{this.props.content.top_likers[2]}
|
||||
<Text style={styles.footer}> & </Text>
|
||||
{this.props.content.vote_count -
|
||||
this.props.content.top_likers.length}{" "}
|
||||
others like this
|
||||
</Text>
|
||||
</CardItem>
|
||||
) : (
|
||||
<CardItem>
|
||||
<Text style={styles.footer}>
|
||||
{this.props.content.vote_count} likes
|
||||
</Text>
|
||||
</CardItem>
|
||||
)}
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
}
|
||||
const styles = StyleSheet.create({
|
||||
post: {
|
||||
shadowColor: "white",
|
||||
padding: 0,
|
||||
marginRight: 0,
|
||||
marginLeft: 0,
|
||||
marginTop: 10,
|
||||
marginBottom: 0,
|
||||
borderWidth: 1,
|
||||
borderColor: "#e5e5e5",
|
||||
borderRadius: 5,
|
||||
},
|
||||
avatar: {
|
||||
width: 30,
|
||||
height: 30,
|
||||
borderRadius: 15,
|
||||
borderColor: "lightgray",
|
||||
borderWidth: 1,
|
||||
},
|
||||
author: {
|
||||
backgroundColor: "white",
|
||||
alignSelf: "flex-start",
|
||||
paddingVertical: 5,
|
||||
},
|
||||
timeAgo: {
|
||||
alignSelf: "center",
|
||||
fontSize: 9,
|
||||
fontWeight: "100",
|
||||
marginHorizontal: 3,
|
||||
},
|
||||
authorName: {
|
||||
color: "#222",
|
||||
fontWeight: "600",
|
||||
fontSize: 10,
|
||||
},
|
||||
upvoteButton: {
|
||||
margin: 0,
|
||||
flexDirection: "row",
|
||||
paddingVertical: 0,
|
||||
},
|
||||
upvoteIcon: {
|
||||
alignSelf: "flex-start",
|
||||
fontSize: 20,
|
||||
color: "#007ee5",
|
||||
margin: 0,
|
||||
width: 18,
|
||||
},
|
||||
payout: {
|
||||
alignSelf: "center",
|
||||
fontSize: 10,
|
||||
color: "#626262",
|
||||
marginLeft: 3,
|
||||
},
|
||||
payoutIcon: {
|
||||
fontSize: 15,
|
||||
marginHorizontal: 3,
|
||||
color: "#a0a0a0",
|
||||
alignSelf: "center",
|
||||
},
|
||||
payoutButton: {
|
||||
flexDirection: "row",
|
||||
alignSelf: "flex-start",
|
||||
paddingVertical: 2,
|
||||
},
|
||||
commentButton: {
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
flexDirection: "row",
|
||||
},
|
||||
comment: {
|
||||
alignSelf: "center",
|
||||
fontSize: 10,
|
||||
color: "#626262",
|
||||
marginLeft: 3,
|
||||
},
|
||||
commentIcon: {
|
||||
alignSelf: "flex-start",
|
||||
fontSize: 20,
|
||||
color: "#007ee5",
|
||||
margin: 0,
|
||||
width: 20,
|
||||
},
|
||||
title: {
|
||||
fontSize: 12,
|
||||
fontWeight: "500",
|
||||
marginVertical: 5,
|
||||
},
|
||||
summary: {
|
||||
fontSize: 10,
|
||||
fontWeight: "200",
|
||||
overflow: "hidden",
|
||||
},
|
||||
header: {
|
||||
shadowColor: "white",
|
||||
height: 50,
|
||||
borderRadius: 5,
|
||||
},
|
||||
body: {
|
||||
justifyContent: "flex-start",
|
||||
flexDirection: "row",
|
||||
},
|
||||
image: {
|
||||
margin: 0,
|
||||
width: "100%",
|
||||
height: 160,
|
||||
},
|
||||
badge: {
|
||||
alignSelf: "center",
|
||||
borderColor: "lightgray",
|
||||
borderWidth: 1,
|
||||
borderRadius: 10,
|
||||
width: 15,
|
||||
height: 15,
|
||||
padding: 2,
|
||||
backgroundColor: "lightgray",
|
||||
marginHorizontal: 5,
|
||||
},
|
||||
category: {
|
||||
alignSelf: "center",
|
||||
borderRadius: 10,
|
||||
height: 15,
|
||||
backgroundColor: "#007EE5",
|
||||
paddingHorizontal: 5,
|
||||
paddingVertical: 1.5,
|
||||
},
|
||||
categoryText: {
|
||||
fontSize: 9,
|
||||
color: "white",
|
||||
fontWeight: "600",
|
||||
},
|
||||
text: {
|
||||
fontSize: 7,
|
||||
alignSelf: "center",
|
||||
textAlignVertical: "center",
|
||||
color: "white",
|
||||
fontWeight: "bold",
|
||||
},
|
||||
topLikers: {
|
||||
shadowColor: "white",
|
||||
backgroundColor: "#f8f8f8",
|
||||
borderWidth: 0,
|
||||
padding: 0,
|
||||
borderRadius: 5,
|
||||
},
|
||||
likers_1: {
|
||||
width: 14,
|
||||
height: 14,
|
||||
borderRadius: 7,
|
||||
borderWidth: 0.5,
|
||||
borderColor: "lightgray",
|
||||
marginVertical: -5,
|
||||
},
|
||||
likers_2: {
|
||||
width: 14,
|
||||
height: 14,
|
||||
borderRadius: 7,
|
||||
borderWidth: 0.5,
|
||||
borderColor: "lightgray",
|
||||
marginVertical: -5,
|
||||
marginLeft: -3,
|
||||
},
|
||||
likers_3: {
|
||||
width: 14,
|
||||
height: 14,
|
||||
borderRadius: 7,
|
||||
borderWidth: 0.5,
|
||||
borderColor: "lightgray",
|
||||
marginVertical: -5,
|
||||
marginLeft: -3,
|
||||
},
|
||||
footer: {
|
||||
shadowColor: "white",
|
||||
paddingLeft: 5,
|
||||
borderRadius: 5,
|
||||
fontSize: 7,
|
||||
fontWeight: "100",
|
||||
color: "#777777",
|
||||
},
|
||||
popover: {
|
||||
width: Dimensions.get("window").width - 20,
|
||||
borderRadius: 5,
|
||||
padding: 10,
|
||||
},
|
||||
track: {
|
||||
height: 2,
|
||||
borderRadius: 1,
|
||||
},
|
||||
thumb: {
|
||||
width: 30,
|
||||
height: 30,
|
||||
borderRadius: 30 / 2,
|
||||
backgroundColor: "white",
|
||||
shadowColor: "black",
|
||||
shadowOffset: { width: 0, height: 2 },
|
||||
shadowRadius: 2,
|
||||
shadowOpacity: 0.35,
|
||||
},
|
||||
});
|
||||
|
||||
export default PostCard;
|
35
src/components/postCard/container/postCardContainer.js
Normal file
35
src/components/postCard/container/postCardContainer.js
Normal file
@ -0,0 +1,35 @@
|
||||
import React, { Component } from "react";
|
||||
|
||||
// Services and Actions
|
||||
|
||||
// Middleware
|
||||
|
||||
// Constants
|
||||
|
||||
// Utilities
|
||||
|
||||
// Component
|
||||
import { PostCardView } from "../";
|
||||
|
||||
/*
|
||||
* Props Name Description Value
|
||||
*@props --> props name here description here Value Type Here
|
||||
*
|
||||
*/
|
||||
|
||||
class PostCardContainer extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {};
|
||||
}
|
||||
|
||||
// Component Life Cycle Functions
|
||||
|
||||
// Component Functions
|
||||
|
||||
render() {
|
||||
return <PostCardView {...this.props} />;
|
||||
}
|
||||
}
|
||||
|
||||
export default PostCardContainer;
|
5
src/components/postCard/index.js
Normal file
5
src/components/postCard/index.js
Normal file
@ -0,0 +1,5 @@
|
||||
import PostCardView from "./view/postCardView";
|
||||
import PostCard from "./container/postCardContainer";
|
||||
|
||||
export { PostCardView, PostCard };
|
||||
export default PostCard;
|
200
src/components/postCard/view/postCardStyles.js
Normal file
200
src/components/postCard/view/postCardStyles.js
Normal file
@ -0,0 +1,200 @@
|
||||
import EStyleSheet from "react-native-extended-stylesheet";
|
||||
|
||||
export default EStyleSheet.create({
|
||||
post: {
|
||||
shadowColor: "white",
|
||||
padding: 0,
|
||||
marginRight: 0,
|
||||
marginLeft: 0,
|
||||
marginTop: 10,
|
||||
marginBottom: 0,
|
||||
borderWidth: 1,
|
||||
borderColor: "#e5e5e5",
|
||||
borderRadius: 5,
|
||||
},
|
||||
avatar: {
|
||||
width: 30,
|
||||
height: 30,
|
||||
borderRadius: 15,
|
||||
borderColor: "lightgray",
|
||||
borderWidth: 1,
|
||||
},
|
||||
author: {
|
||||
backgroundColor: "white",
|
||||
alignSelf: "flex-start",
|
||||
paddingVertical: 5,
|
||||
},
|
||||
timeAgo: {
|
||||
alignSelf: "center",
|
||||
fontSize: 9,
|
||||
fontWeight: "100",
|
||||
marginHorizontal: 3,
|
||||
},
|
||||
authorName: {
|
||||
color: "#222",
|
||||
fontWeight: "600",
|
||||
fontSize: 10,
|
||||
},
|
||||
upvoteButton: {
|
||||
margin: 0,
|
||||
flexDirection: "row",
|
||||
paddingVertical: 0,
|
||||
},
|
||||
upvoteIcon: {
|
||||
alignSelf: "flex-start",
|
||||
fontSize: 20,
|
||||
color: "#007ee5",
|
||||
margin: 0,
|
||||
width: 18,
|
||||
},
|
||||
payout: {
|
||||
alignSelf: "center",
|
||||
fontSize: 10,
|
||||
color: "#626262",
|
||||
marginLeft: 3,
|
||||
},
|
||||
payoutIcon: {
|
||||
fontSize: 15,
|
||||
marginHorizontal: 3,
|
||||
color: "#a0a0a0",
|
||||
alignSelf: "center",
|
||||
},
|
||||
payoutButton: {
|
||||
flexDirection: "row",
|
||||
alignSelf: "flex-start",
|
||||
paddingVertical: 2,
|
||||
},
|
||||
commentButton: {
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
flexDirection: "row",
|
||||
},
|
||||
comment: {
|
||||
alignSelf: "center",
|
||||
fontSize: 10,
|
||||
color: "#626262",
|
||||
marginLeft: 3,
|
||||
},
|
||||
commentIcon: {
|
||||
alignSelf: "flex-start",
|
||||
fontSize: 20,
|
||||
color: "#007ee5",
|
||||
margin: 0,
|
||||
width: 20,
|
||||
},
|
||||
title: {
|
||||
fontSize: 12,
|
||||
fontWeight: "500",
|
||||
marginVertical: 5,
|
||||
},
|
||||
summary: {
|
||||
fontSize: 10,
|
||||
fontWeight: "200",
|
||||
overflow: "hidden",
|
||||
},
|
||||
header: {
|
||||
shadowColor: "white",
|
||||
height: 50,
|
||||
borderRadius: 5,
|
||||
},
|
||||
body: {
|
||||
justifyContent: "flex-start",
|
||||
flexDirection: "row",
|
||||
},
|
||||
image: {
|
||||
margin: 0,
|
||||
width: "100%",
|
||||
height: 160,
|
||||
},
|
||||
badge: {
|
||||
alignSelf: "center",
|
||||
borderColor: "lightgray",
|
||||
borderWidth: 1,
|
||||
borderRadius: 10,
|
||||
width: 15,
|
||||
height: 15,
|
||||
padding: 2,
|
||||
backgroundColor: "lightgray",
|
||||
marginHorizontal: 5,
|
||||
},
|
||||
category: {
|
||||
alignSelf: "center",
|
||||
borderRadius: 10,
|
||||
height: 15,
|
||||
backgroundColor: "#007EE5",
|
||||
paddingHorizontal: 5,
|
||||
paddingVertical: 1.5,
|
||||
},
|
||||
categoryText: {
|
||||
fontSize: 9,
|
||||
color: "white",
|
||||
fontWeight: "600",
|
||||
},
|
||||
text: {
|
||||
fontSize: 7,
|
||||
alignSelf: "center",
|
||||
textAlignVertical: "center",
|
||||
color: "white",
|
||||
fontWeight: "bold",
|
||||
},
|
||||
topLikers: {
|
||||
shadowColor: "white",
|
||||
backgroundColor: "#f8f8f8",
|
||||
borderWidth: 0,
|
||||
padding: 0,
|
||||
borderRadius: 5,
|
||||
},
|
||||
likers_1: {
|
||||
width: 14,
|
||||
height: 14,
|
||||
borderRadius: 7,
|
||||
borderWidth: 0.5,
|
||||
borderColor: "lightgray",
|
||||
marginVertical: -5,
|
||||
},
|
||||
likers_2: {
|
||||
width: 14,
|
||||
height: 14,
|
||||
borderRadius: 7,
|
||||
borderWidth: 0.5,
|
||||
borderColor: "lightgray",
|
||||
marginVertical: -5,
|
||||
marginLeft: -3,
|
||||
},
|
||||
likers_3: {
|
||||
width: 14,
|
||||
height: 14,
|
||||
borderRadius: 7,
|
||||
borderWidth: 0.5,
|
||||
borderColor: "lightgray",
|
||||
marginVertical: -5,
|
||||
marginLeft: -3,
|
||||
},
|
||||
footer: {
|
||||
shadowColor: "white",
|
||||
paddingLeft: 5,
|
||||
borderRadius: 5,
|
||||
fontSize: 7,
|
||||
fontWeight: "100",
|
||||
color: "#777777",
|
||||
},
|
||||
popover: {
|
||||
width: "$deviceWidth - 20",
|
||||
borderRadius: 5,
|
||||
padding: 10,
|
||||
},
|
||||
track: {
|
||||
height: 2,
|
||||
borderRadius: 1,
|
||||
},
|
||||
thumb: {
|
||||
width: 30,
|
||||
height: 30,
|
||||
borderRadius: 30 / 2,
|
||||
backgroundColor: "white",
|
||||
shadowColor: "black",
|
||||
shadowOffset: { width: 0, height: 2 },
|
||||
shadowRadius: 2,
|
||||
shadowOpacity: 0.35,
|
||||
},
|
||||
});
|
423
src/components/postCard/view/postCardView.js
Normal file
423
src/components/postCard/view/postCardView.js
Normal file
@ -0,0 +1,423 @@
|
||||
import React, { Component } from "react";
|
||||
import {
|
||||
Image,
|
||||
TouchableOpacity,
|
||||
FlatList,
|
||||
ActivityIndicator,
|
||||
} from "react-native";
|
||||
import {
|
||||
Card,
|
||||
CardItem,
|
||||
Left,
|
||||
Right,
|
||||
Thumbnail,
|
||||
View,
|
||||
Icon,
|
||||
Body,
|
||||
Text,
|
||||
} from "native-base";
|
||||
import { Navigation } from "react-native-navigation";
|
||||
import Modal from "react-native-modal";
|
||||
import { Popover, PopoverController } from "react-native-modal-popover";
|
||||
import Slider from "react-native-slider";
|
||||
|
||||
// STEEM
|
||||
import { upvote, upvoteAmount } from "../../../providers/steem/dsteem";
|
||||
import { decryptKey } from "../../../utils/crypto";
|
||||
import { getUserData } from "../../../realm/realm";
|
||||
|
||||
// Styles
|
||||
import styles from "./postCardStyles";
|
||||
|
||||
class PostCard extends Component {
|
||||
/* Props
|
||||
* ------------------------------------------------
|
||||
* @prop { string } description - Description texts.
|
||||
* @prop { string } iconName - For icon render name.
|
||||
*
|
||||
*/
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.upvoteContent = this.upvoteContent.bind(this);
|
||||
this.calculateEstimatedAmount = this.calculateEstimatedAmount.bind(this);
|
||||
|
||||
this.state = {
|
||||
value: 0.0,
|
||||
isVoting: false,
|
||||
isVoted: props.content && props.content.isVoted,
|
||||
amount: "0.00",
|
||||
isModalVisible: false,
|
||||
};
|
||||
}
|
||||
|
||||
// Component Lifecycle Functions
|
||||
componentDidMount() {
|
||||
const { isLoggedIn } = this.props;
|
||||
|
||||
isLoggedIn && this.calculateEstimatedAmount();
|
||||
}
|
||||
|
||||
// Component Functions
|
||||
calculateEstimatedAmount = async () => {
|
||||
const { user } = this.props;
|
||||
const { value } = this.state;
|
||||
// Calculate total vesting shares
|
||||
const total_vests =
|
||||
parseFloat(user.vesting_shares) +
|
||||
parseFloat(user.received_vesting_shares) -
|
||||
parseFloat(user.delegated_vesting_shares);
|
||||
|
||||
const final_vest = total_vests * 1e6;
|
||||
|
||||
const power = (user.voting_power * (value * 10000)) / 10000 / 50;
|
||||
|
||||
const rshares = (power * final_vest) / 10000;
|
||||
|
||||
const estimated = await upvoteAmount(rshares);
|
||||
|
||||
this.setState({
|
||||
amount: estimated.toFixed(3),
|
||||
});
|
||||
};
|
||||
|
||||
upvoteContent = async () => {
|
||||
const { isLoggedIn, user, content } = this.prop;
|
||||
const { value } = this.state;
|
||||
|
||||
let postingKey;
|
||||
let userData;
|
||||
|
||||
if (isLoggedIn) {
|
||||
await this.setState({
|
||||
isVoting: true,
|
||||
});
|
||||
|
||||
await getUserData().then(result => {
|
||||
userData = Array.from(result);
|
||||
postingKey = decryptKey(userData[0].postingKey, "pinCode");
|
||||
});
|
||||
upvote(
|
||||
{
|
||||
voter: user && user.name,
|
||||
author: content && content.author,
|
||||
permlink: content && content.permlink,
|
||||
weight: (value * 100).toFixed(0) * 100,
|
||||
},
|
||||
postingKey
|
||||
)
|
||||
.then(res => {
|
||||
console.log(res);
|
||||
this.setState({
|
||||
isVoted: true,
|
||||
isVoting: false,
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
this.setState({
|
||||
isVoted: false,
|
||||
isVoting: false,
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
toggleModal = () => {
|
||||
const { isModalVisible } = this.state;
|
||||
|
||||
this.setState({
|
||||
isModalVisible: !isModalVisible,
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
const { content, isLoggedIn, user } = this.props;
|
||||
const { isVoted, isVoting, isModalVisible, value } = this.state;
|
||||
|
||||
// TODO: Should seperate bunch of component REFACTOR ME!
|
||||
return (
|
||||
<Card style={styles.post}>
|
||||
<CardItem style={styles.header}>
|
||||
<Left>
|
||||
<TouchableOpacity
|
||||
onPress={() =>
|
||||
Navigation.push("tab1Stack", {
|
||||
component: {
|
||||
name: "navigation.eSteem.Author",
|
||||
passProps: {
|
||||
author: content && content.author,
|
||||
isLoggedIn: isLoggedIn,
|
||||
user: user,
|
||||
},
|
||||
options: {
|
||||
topBar: {},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
>
|
||||
<Thumbnail
|
||||
style={styles.avatar}
|
||||
source={{ uri: content && content.avatar }}
|
||||
/>
|
||||
</TouchableOpacity>
|
||||
<Body style={styles.body}>
|
||||
<View style={styles.author}>
|
||||
<Text style={styles.authorName}>{content.author}</Text>
|
||||
</View>
|
||||
<View style={styles.badge}>
|
||||
<Text style={styles.text}>{content.author_reputation}</Text>
|
||||
</View>
|
||||
<View style={styles.category}>
|
||||
<Text style={styles.categoryText}>{content.category}</Text>
|
||||
</View>
|
||||
<Text style={styles.timeAgo} note>
|
||||
{" "}
|
||||
{content.created}{" "}
|
||||
</Text>
|
||||
</Body>
|
||||
</Left>
|
||||
<Right>
|
||||
<Icon name="md-more" />
|
||||
</Right>
|
||||
</CardItem>
|
||||
<Image
|
||||
source={{ uri: content && content.image }}
|
||||
defaultSource={require("../../../assets/no_image.png")}
|
||||
style={styles.image}
|
||||
/>
|
||||
<TouchableOpacity
|
||||
onPress={() =>
|
||||
Navigation.push("tab1Stack", {
|
||||
component: {
|
||||
name: "navigation.eSteem.Post",
|
||||
passProps: {
|
||||
content: content,
|
||||
isLoggedIn: isLoggedIn,
|
||||
user: user,
|
||||
},
|
||||
options: {
|
||||
topBar: {},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
>
|
||||
<CardItem>
|
||||
<Body>
|
||||
<Text style={styles.title}>{content.title}</Text>
|
||||
<Text style={styles.summary}>{content.summary}</Text>
|
||||
</Body>
|
||||
</CardItem>
|
||||
</TouchableOpacity>
|
||||
<CardItem>
|
||||
<Left>
|
||||
<PopoverController>
|
||||
{({
|
||||
openPopover,
|
||||
closePopover,
|
||||
popoverVisible,
|
||||
setPopoverAnchor,
|
||||
popoverAnchorRect,
|
||||
}) => (
|
||||
<React.Fragment>
|
||||
<TouchableOpacity
|
||||
start
|
||||
ref={setPopoverAnchor}
|
||||
onPress={openPopover}
|
||||
style={styles.upvoteButton}
|
||||
>
|
||||
{isVoting ? (
|
||||
<ActivityIndicator />
|
||||
) : (
|
||||
<View>
|
||||
{isVoted ? (
|
||||
<Icon
|
||||
style={{
|
||||
color: "#007ee5",
|
||||
}}
|
||||
style={styles.upvoteIcon}
|
||||
active
|
||||
name="ios-arrow-dropup-circle"
|
||||
/>
|
||||
) : (
|
||||
<Icon
|
||||
style={{
|
||||
color: "#007ee5",
|
||||
}}
|
||||
style={styles.upvoteIcon}
|
||||
active
|
||||
name="ios-arrow-dropup-outline"
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
<Popover
|
||||
contentStyle={styles.popover}
|
||||
arrowStyle={styles.arrow}
|
||||
backgroundStyle={styles.background}
|
||||
visible={popoverVisible}
|
||||
onClose={closePopover}
|
||||
fromRect={popoverAnchorRect}
|
||||
placement={"top"}
|
||||
supportedOrientations={["portrait", "landscape"]}
|
||||
>
|
||||
<Text>${this.state.amount}</Text>
|
||||
<View
|
||||
style={{
|
||||
flex: 1,
|
||||
flexDirection: "row",
|
||||
}}
|
||||
>
|
||||
<TouchableOpacity
|
||||
onPress={() => {
|
||||
closePopover();
|
||||
this.upvoteContent();
|
||||
}}
|
||||
style={{
|
||||
flex: 0.1,
|
||||
alignSelf: "center",
|
||||
}}
|
||||
>
|
||||
<Icon
|
||||
style={{ color: "#007ee5" }}
|
||||
active
|
||||
name="ios-arrow-dropup-outline"
|
||||
/>
|
||||
</TouchableOpacity>
|
||||
<Slider
|
||||
style={{ flex: 0.75 }}
|
||||
minimumTrackTintColor="#13a9d6"
|
||||
trackStyle={styles.track}
|
||||
thumbStyle={styles.thumb}
|
||||
thumbTintColor="#007ee5"
|
||||
value={value}
|
||||
onValueChange={value => {
|
||||
this.setState({ value }, () => {
|
||||
this.calculateEstimatedAmount();
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<Text
|
||||
style={{
|
||||
flex: 0.15,
|
||||
alignSelf: "center",
|
||||
marginLeft: 10,
|
||||
}}
|
||||
>
|
||||
{(value * 100).toFixed(0)}%
|
||||
</Text>
|
||||
</View>
|
||||
</Popover>
|
||||
</React.Fragment>
|
||||
)}
|
||||
</PopoverController>
|
||||
<TouchableOpacity
|
||||
onPress={this.toggleModal}
|
||||
style={styles.payoutButton}
|
||||
>
|
||||
<Text style={styles.payout}>${content.pending_payout_value}</Text>
|
||||
<Icon name="md-arrow-dropdown" style={styles.payoutIcon} />
|
||||
<Modal isVisible={isModalVisible}>
|
||||
<View
|
||||
style={{
|
||||
flex: 0.8,
|
||||
backgroundColor: "white",
|
||||
borderRadius: 10,
|
||||
}}
|
||||
>
|
||||
<TouchableOpacity onPress={this.toggleModal}>
|
||||
<Text>Tap to close!</Text>
|
||||
</TouchableOpacity>
|
||||
<FlatList
|
||||
data={this.props.content.active_votes}
|
||||
keyExtractor={item => item.voter.toString()}
|
||||
renderItem={({ item }) => (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
borderColor: "lightgray",
|
||||
borderWidth: 1,
|
||||
borderRadius: 10,
|
||||
}}
|
||||
>
|
||||
<Thumbnail
|
||||
style={{
|
||||
width: 34,
|
||||
height: 34,
|
||||
borderRadius: 17,
|
||||
flex: 0.1,
|
||||
}}
|
||||
source={{
|
||||
uri: item.avatar,
|
||||
}}
|
||||
/>
|
||||
<Text style={{ flex: 0.5 }}>
|
||||
{" "}
|
||||
{item.voter} ({item.reputation})
|
||||
</Text>
|
||||
<Text style={{ flex: 0.2 }}>{item.value}$</Text>
|
||||
<Text style={{ flex: 0.2 }}>{item.percent}%</Text>
|
||||
</View>
|
||||
)}
|
||||
/>
|
||||
</View>
|
||||
</Modal>
|
||||
</TouchableOpacity>
|
||||
</Left>
|
||||
<Right>
|
||||
<TouchableOpacity start style={styles.commentButton}>
|
||||
<Icon
|
||||
style={styles.commentIcon}
|
||||
active
|
||||
name="ios-chatbubbles-outline"
|
||||
/>
|
||||
<Text style={styles.comment}>{content.children}</Text>
|
||||
</TouchableOpacity>
|
||||
</Right>
|
||||
</CardItem>
|
||||
{content.top_likers ? (
|
||||
<CardItem style={styles.topLikers}>
|
||||
<Thumbnail
|
||||
source={{
|
||||
uri: `https://steemitimages.com/u/${
|
||||
content.top_likers[0]
|
||||
}/avatar/small`,
|
||||
}}
|
||||
style={styles.likers_1}
|
||||
/>
|
||||
<Thumbnail
|
||||
source={{
|
||||
uri: `https://steemitimages.com/u/${
|
||||
content.top_likers[1]
|
||||
}/avatar/small`,
|
||||
}}
|
||||
style={styles.likers_2}
|
||||
/>
|
||||
<Thumbnail
|
||||
source={{
|
||||
uri: `https://steemitimages.com/u/${
|
||||
content.top_likers[2]
|
||||
}/avatar/small`,
|
||||
}}
|
||||
style={styles.likers_3}
|
||||
/>
|
||||
<Text style={styles.footer}>
|
||||
@{content.top_likers[0]}, @{content.top_likers[1]}, @
|
||||
{content.top_likers[2]}
|
||||
<Text style={styles.footer}> & </Text>
|
||||
{content.vote_count - content.top_likers.length} others like this
|
||||
</Text>
|
||||
</CardItem>
|
||||
) : (
|
||||
<CardItem>
|
||||
<Text style={styles.footer}>{content.vote_count} likes</Text>
|
||||
</CardItem>
|
||||
)}
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default PostCard;
|
File diff suppressed because it is too large
Load Diff
@ -1,23 +1,23 @@
|
||||
import React from "react";
|
||||
import {
|
||||
StyleSheet,
|
||||
FlatList,
|
||||
View,
|
||||
StatusBar,
|
||||
Dimensions,
|
||||
ActivityIndicator,
|
||||
StyleSheet,
|
||||
FlatList,
|
||||
View,
|
||||
StatusBar,
|
||||
Dimensions,
|
||||
ActivityIndicator,
|
||||
} from "react-native";
|
||||
import {
|
||||
Container,
|
||||
Header,
|
||||
Button,
|
||||
Thumbnail,
|
||||
Right,
|
||||
Text,
|
||||
Tabs,
|
||||
Tab,
|
||||
Icon,
|
||||
ScrollableTab,
|
||||
Container,
|
||||
Header,
|
||||
Button,
|
||||
Thumbnail,
|
||||
Right,
|
||||
Text,
|
||||
Tabs,
|
||||
Tab,
|
||||
Icon,
|
||||
ScrollableTab,
|
||||
} from "native-base";
|
||||
import styles from "../../styles/feed.styles";
|
||||
// STEEM
|
||||
@ -27,155 +27,156 @@ import { getPosts } from "../../providers/steem/dsteem";
|
||||
import Placeholder from "rn-placeholder";
|
||||
|
||||
// COMPONENTS
|
||||
import PostCard from "../../components/post-card/postCard";
|
||||
import { PostCard } from "../../components/postCard";
|
||||
|
||||
/* eslint-enable no-unused-vars */
|
||||
|
||||
class FeedPage extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.getFeed = this.getFeed.bind(this);
|
||||
this.getMore = this.getMore.bind(this);
|
||||
this.refreshPosts = this.refreshPosts.bind(this);
|
||||
this.state = {
|
||||
isReady: false,
|
||||
posts: [],
|
||||
start_author: "",
|
||||
start_permlink: "",
|
||||
refreshing: false,
|
||||
loading: false,
|
||||
};
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
this.getFeed();
|
||||
}
|
||||
|
||||
getFeed = () => {
|
||||
getPosts(
|
||||
"feed",
|
||||
{ tag: this.props.user.name, limit: 10 },
|
||||
this.props.user.name
|
||||
)
|
||||
.then(result => {
|
||||
// TODO: We should put null check for result
|
||||
this.setState({
|
||||
isReady: true,
|
||||
posts: result,
|
||||
start_author: result[result.length - 1].author,
|
||||
start_permlink: result[result.length - 1].permlink,
|
||||
refreshing: false,
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
alert(err);
|
||||
});
|
||||
this.getFeed = this.getFeed.bind(this);
|
||||
this.getMore = this.getMore.bind(this);
|
||||
this.refreshPosts = this.refreshPosts.bind(this);
|
||||
this.state = {
|
||||
isReady: false,
|
||||
posts: [],
|
||||
start_author: "",
|
||||
start_permlink: "",
|
||||
refreshing: false,
|
||||
loading: false,
|
||||
};
|
||||
}
|
||||
|
||||
getMore = () => {
|
||||
this.setState({ loading: true });
|
||||
getPosts(
|
||||
"feed",
|
||||
{
|
||||
tag: this.props.user.name,
|
||||
limit: 10,
|
||||
start_author: this.state.start_author,
|
||||
start_permlink: this.state.start_permlink,
|
||||
},
|
||||
this.props.user.name
|
||||
).then(result => {
|
||||
let posts = result;
|
||||
posts.shift();
|
||||
this.setState({
|
||||
posts: [...this.state.posts, ...posts],
|
||||
start_author: result[result.length - 1].author,
|
||||
start_permlink: result[result.length - 1].permlink,
|
||||
});
|
||||
componentWillMount() {
|
||||
this.getFeed();
|
||||
}
|
||||
|
||||
getFeed = () => {
|
||||
getPosts(
|
||||
"feed",
|
||||
{ tag: this.props.user.name, limit: 10 },
|
||||
this.props.user.name
|
||||
)
|
||||
.then(result => {
|
||||
// TODO: We should put null check for result
|
||||
this.setState({
|
||||
isReady: true,
|
||||
posts: result,
|
||||
start_author: result[result.length - 1].author,
|
||||
start_permlink: result[result.length - 1].permlink,
|
||||
refreshing: false,
|
||||
});
|
||||
};
|
||||
})
|
||||
.catch(err => {
|
||||
alert(err);
|
||||
});
|
||||
};
|
||||
|
||||
refreshPosts = () => {
|
||||
this.setState(
|
||||
{
|
||||
refreshing: true,
|
||||
},
|
||||
() => {
|
||||
this.getFeed();
|
||||
}
|
||||
);
|
||||
};
|
||||
getMore = () => {
|
||||
this.setState({ loading: true });
|
||||
getPosts(
|
||||
"feed",
|
||||
{
|
||||
tag: this.props.user.name,
|
||||
limit: 10,
|
||||
start_author: this.state.start_author,
|
||||
start_permlink: this.state.start_permlink,
|
||||
},
|
||||
this.props.user.name
|
||||
).then(result => {
|
||||
let posts = result;
|
||||
posts.shift();
|
||||
this.setState({
|
||||
posts: [...this.state.posts, ...posts],
|
||||
start_author: result[result.length - 1].author,
|
||||
start_permlink: result[result.length - 1].permlink,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
renderFooter = () => {
|
||||
if (!this.state.loading) return null;
|
||||
refreshPosts = () => {
|
||||
this.setState(
|
||||
{
|
||||
refreshing: true,
|
||||
},
|
||||
() => {
|
||||
this.getFeed();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<View style={styles.flatlistFooter}>
|
||||
<ActivityIndicator animating size="large" />
|
||||
renderFooter = () => {
|
||||
if (!this.state.loading) return null;
|
||||
|
||||
return (
|
||||
<View style={styles.flatlistFooter}>
|
||||
<ActivityIndicator animating size="large" />
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View style={{ flex: 1 }}>
|
||||
{this.state.isReady ? (
|
||||
<FlatList
|
||||
data={this.state.posts}
|
||||
showsVerticalScrollIndicator={false}
|
||||
renderItem={({ item }) => (
|
||||
<PostCard
|
||||
componentId={this.props.componentId}
|
||||
content={item}
|
||||
user={this.props.user}
|
||||
isLoggedIn={true}
|
||||
/>
|
||||
)}
|
||||
keyExtractor={(post, index) => index.toString()}
|
||||
onEndReached={this.getMore}
|
||||
removeClippedSubviews={true}
|
||||
refreshing={this.state.refreshing}
|
||||
onRefresh={() => this.refreshPosts()}
|
||||
onEndThreshold={0}
|
||||
initialNumToRender={10}
|
||||
ListFooterComponent={this.renderFooter}
|
||||
/>
|
||||
) : (
|
||||
<View>
|
||||
<View style={styles.placeholder}>
|
||||
<Placeholder.ImageContent
|
||||
size={60}
|
||||
animate="fade"
|
||||
lineNumber={4}
|
||||
lineSpacing={5}
|
||||
lastLineWidth="30%"
|
||||
onReady={this.state.isReady}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View style={{ flex: 1 }}>
|
||||
{this.state.isReady ? (
|
||||
<FlatList
|
||||
data={this.state.posts}
|
||||
showsVerticalScrollIndicator={false}
|
||||
renderItem={({ item }) => (
|
||||
<PostCard
|
||||
componentId={this.props.componentId}
|
||||
content={item}
|
||||
user={this.props.user}
|
||||
isLoggedIn={true}
|
||||
/>
|
||||
)}
|
||||
keyExtractor={(post, index) => index.toString()}
|
||||
onEndReached={this.getMore}
|
||||
removeClippedSubviews={true}
|
||||
refreshing={this.state.refreshing}
|
||||
onRefresh={() => this.refreshPosts()}
|
||||
onEndThreshold={0}
|
||||
initialNumToRender={10}
|
||||
ListFooterComponent={this.renderFooter}
|
||||
/>
|
||||
) : (
|
||||
<View>
|
||||
<View style={styles.placeholder}>
|
||||
<Placeholder.ImageContent
|
||||
size={60}
|
||||
animate="fade"
|
||||
lineNumber={4}
|
||||
lineSpacing={5}
|
||||
lastLineWidth="30%"
|
||||
onReady={this.state.isReady}
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.placeholder}>
|
||||
<Placeholder.ImageContent
|
||||
size={60}
|
||||
animate="fade"
|
||||
lineNumber={4}
|
||||
lineSpacing={5}
|
||||
lastLineWidth="30%"
|
||||
onReady={this.state.isReady}
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.placeholder}>
|
||||
<Placeholder.ImageContent
|
||||
size={60}
|
||||
animate="fade"
|
||||
lineNumber={4}
|
||||
lineSpacing={5}
|
||||
lastLineWidth="30%"
|
||||
onReady={this.state.isReady}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
<View style={styles.placeholder}>
|
||||
<Placeholder.ImageContent
|
||||
size={60}
|
||||
animate="fade"
|
||||
lineNumber={4}
|
||||
lineSpacing={5}
|
||||
lastLineWidth="30%"
|
||||
onReady={this.state.isReady}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
<View style={styles.placeholder}>
|
||||
<Placeholder.ImageContent
|
||||
size={60}
|
||||
animate="fade"
|
||||
lineNumber={4}
|
||||
lineSpacing={5}
|
||||
lastLineWidth="30%"
|
||||
onReady={this.state.isReady}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default FeedPage;
|
||||
|
@ -1,14 +1,6 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import React from "react";
|
||||
import {
|
||||
StyleSheet,
|
||||
FlatList,
|
||||
View,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
ActivityIndicator,
|
||||
} from "react-native";
|
||||
import { Navigation } from "react-native-navigation";
|
||||
import { FlatList, View, ActivityIndicator } from "react-native";
|
||||
|
||||
import styles from "../../styles/hot.styles";
|
||||
|
||||
@ -19,154 +11,154 @@ import { getPosts } from "../../providers/steem/dsteem";
|
||||
import Placeholder from "rn-placeholder";
|
||||
|
||||
// COMPONENTS
|
||||
import PostCard from "../../components/post-card/postCard";
|
||||
import { PostCard } from "../../components/postCard";
|
||||
|
||||
// SCREENS
|
||||
/* eslint-enable no-unused-vars */
|
||||
|
||||
class HotPage extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.getHotPosts = this.getHotPosts.bind(this);
|
||||
this.getMoreHot = this.getMoreHot.bind(this);
|
||||
this.refreshHotPosts = this.refreshHotPosts.bind(this);
|
||||
this.state = {
|
||||
isReady: false,
|
||||
posts: [],
|
||||
start_author: "",
|
||||
start_permlink: "",
|
||||
refreshing: false,
|
||||
loading: false,
|
||||
isLoggedIn: this.props.isLoggedIn,
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
console.log(this.props);
|
||||
this.getHotPosts();
|
||||
}
|
||||
|
||||
getHotPosts = () => {
|
||||
getPosts("hot", { tag: "", limit: 10 }, this.props.user.name)
|
||||
.then(result => {
|
||||
this.setState({
|
||||
isReady: true,
|
||||
posts: result,
|
||||
start_author: result[result.length - 1].author,
|
||||
start_permlink: result[result.length - 1].permlink,
|
||||
refreshing: false,
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
alert(err);
|
||||
});
|
||||
this.getHotPosts = this.getHotPosts.bind(this);
|
||||
this.getMoreHot = this.getMoreHot.bind(this);
|
||||
this.refreshHotPosts = this.refreshHotPosts.bind(this);
|
||||
this.state = {
|
||||
isReady: false,
|
||||
posts: [],
|
||||
start_author: "",
|
||||
start_permlink: "",
|
||||
refreshing: false,
|
||||
loading: false,
|
||||
isLoggedIn: this.props.isLoggedIn,
|
||||
};
|
||||
}
|
||||
|
||||
getMoreHot = () => {
|
||||
this.setState({ loading: true });
|
||||
getPosts(
|
||||
"hot",
|
||||
{
|
||||
tag: "",
|
||||
limit: 10,
|
||||
start_author: this.state.start_author,
|
||||
start_permlink: this.state.start_permlink,
|
||||
},
|
||||
this.props.user.name
|
||||
).then(result => {
|
||||
let posts = result;
|
||||
posts.shift();
|
||||
this.setState({
|
||||
posts: [...this.state.posts, ...posts],
|
||||
start_author: result[result.length - 1].author,
|
||||
start_permlink: result[result.length - 1].permlink,
|
||||
});
|
||||
componentDidMount() {
|
||||
console.log(this.props);
|
||||
this.getHotPosts();
|
||||
}
|
||||
|
||||
getHotPosts = () => {
|
||||
getPosts("hot", { tag: "", limit: 10 }, this.props.user.name)
|
||||
.then(result => {
|
||||
this.setState({
|
||||
isReady: true,
|
||||
posts: result,
|
||||
start_author: result[result.length - 1].author,
|
||||
start_permlink: result[result.length - 1].permlink,
|
||||
refreshing: false,
|
||||
});
|
||||
};
|
||||
})
|
||||
.catch(err => {
|
||||
alert(err);
|
||||
});
|
||||
};
|
||||
|
||||
refreshHotPosts = () => {
|
||||
this.setState(
|
||||
{
|
||||
refreshing: true,
|
||||
},
|
||||
() => {
|
||||
this.getHotPosts();
|
||||
}
|
||||
);
|
||||
};
|
||||
getMoreHot = () => {
|
||||
this.setState({ loading: true });
|
||||
getPosts(
|
||||
"hot",
|
||||
{
|
||||
tag: "",
|
||||
limit: 10,
|
||||
start_author: this.state.start_author,
|
||||
start_permlink: this.state.start_permlink,
|
||||
},
|
||||
this.props.user.name
|
||||
).then(result => {
|
||||
let posts = result;
|
||||
posts.shift();
|
||||
this.setState({
|
||||
posts: [...this.state.posts, ...posts],
|
||||
start_author: result[result.length - 1].author,
|
||||
start_permlink: result[result.length - 1].permlink,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
renderFooter = () => {
|
||||
if (!this.state.loading) return null;
|
||||
refreshHotPosts = () => {
|
||||
this.setState(
|
||||
{
|
||||
refreshing: true,
|
||||
},
|
||||
() => {
|
||||
this.getHotPosts();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<View style={styles.flatlistFooter}>
|
||||
<ActivityIndicator animating size="large" />
|
||||
renderFooter = () => {
|
||||
if (!this.state.loading) return null;
|
||||
|
||||
return (
|
||||
<View style={styles.flatlistFooter}>
|
||||
<ActivityIndicator animating size="large" />
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View style={{ flex: 1 }}>
|
||||
{this.state.isReady ? (
|
||||
<FlatList
|
||||
data={this.state.posts}
|
||||
showsVerticalScrollIndicator={false}
|
||||
renderItem={({ item }) => (
|
||||
<PostCard
|
||||
componentId={this.props.componentId}
|
||||
content={item}
|
||||
user={this.props.user}
|
||||
isLoggedIn={this.state.isLoggedIn}
|
||||
/>
|
||||
)}
|
||||
keyExtractor={(post, index) => index.toString()}
|
||||
onEndReached={this.getMore}
|
||||
removeClippedSubviews={true}
|
||||
refreshing={this.state.refreshing}
|
||||
onRefresh={() => this.refreshHotPosts()}
|
||||
onEndThreshold={0}
|
||||
initialNumToRender={10}
|
||||
ListFooterComponent={this.renderFooter}
|
||||
/>
|
||||
) : (
|
||||
<View>
|
||||
<View style={styles.placeholder}>
|
||||
<Placeholder.ImageContent
|
||||
size={60}
|
||||
animate="fade"
|
||||
lineNumber={4}
|
||||
lineSpacing={5}
|
||||
lastLineWidth="30%"
|
||||
onReady={this.state.isReady}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View style={{ flex: 1 }}>
|
||||
{this.state.isReady ? (
|
||||
<FlatList
|
||||
data={this.state.posts}
|
||||
showsVerticalScrollIndicator={false}
|
||||
renderItem={({ item }) => (
|
||||
<PostCard
|
||||
componentId={this.props.componentId}
|
||||
content={item}
|
||||
user={this.props.user}
|
||||
isLoggedIn={this.state.isLoggedIn}
|
||||
/>
|
||||
)}
|
||||
keyExtractor={(post, index) => index.toString()}
|
||||
onEndReached={this.getMore}
|
||||
removeClippedSubviews={true}
|
||||
refreshing={this.state.refreshing}
|
||||
onRefresh={() => this.refreshHotPosts()}
|
||||
onEndThreshold={0}
|
||||
initialNumToRender={10}
|
||||
ListFooterComponent={this.renderFooter}
|
||||
/>
|
||||
) : (
|
||||
<View>
|
||||
<View style={styles.placeholder}>
|
||||
<Placeholder.ImageContent
|
||||
size={60}
|
||||
animate="fade"
|
||||
lineNumber={4}
|
||||
lineSpacing={5}
|
||||
lastLineWidth="30%"
|
||||
onReady={this.state.isReady}
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.placeholder}>
|
||||
<Placeholder.ImageContent
|
||||
size={60}
|
||||
animate="fade"
|
||||
lineNumber={4}
|
||||
lineSpacing={5}
|
||||
lastLineWidth="30%"
|
||||
onReady={this.state.isReady}
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.placeholder}>
|
||||
<Placeholder.ImageContent
|
||||
size={60}
|
||||
animate="fade"
|
||||
lineNumber={4}
|
||||
lineSpacing={5}
|
||||
lastLineWidth="30%"
|
||||
onReady={this.state.isReady}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
<View style={styles.placeholder}>
|
||||
<Placeholder.ImageContent
|
||||
size={60}
|
||||
animate="fade"
|
||||
lineNumber={4}
|
||||
lineSpacing={5}
|
||||
lastLineWidth="30%"
|
||||
onReady={this.state.isReady}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
<View style={styles.placeholder}>
|
||||
<Placeholder.ImageContent
|
||||
size={60}
|
||||
animate="fade"
|
||||
lineNumber={4}
|
||||
lineSpacing={5}
|
||||
lastLineWidth="30%"
|
||||
onReady={this.state.isReady}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default HotPage;
|
||||
|
@ -9,154 +9,154 @@ import { getPosts } from "../../providers/steem/dsteem";
|
||||
import Placeholder from "rn-placeholder";
|
||||
|
||||
// COMPONENTS
|
||||
import PostCard from "../../components/post-card/postCard";
|
||||
import { PostCard } from "../../components/postCard";
|
||||
|
||||
// SCREENS
|
||||
/* eslint-enable no-unused-vars */
|
||||
|
||||
class TrendingPage extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.getTrending = this.getTrending.bind(this);
|
||||
this.getMore = this.getMore.bind(this);
|
||||
this.refreshData = this.refreshData.bind(this);
|
||||
this.state = {
|
||||
isReady: false,
|
||||
posts: [],
|
||||
user: [],
|
||||
start_author: "",
|
||||
start_permlink: "",
|
||||
refreshing: false,
|
||||
loading: false,
|
||||
isLoggedIn: this.props.isLoggedIn,
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.getTrending();
|
||||
}
|
||||
|
||||
getTrending = () => {
|
||||
getPosts("trending", { tag: "", limit: 10 }, this.props.user.name)
|
||||
.then(result => {
|
||||
this.setState({
|
||||
isReady: true,
|
||||
posts: result,
|
||||
start_author: result[result.length - 1].author,
|
||||
start_permlink: result[result.length - 1].permlink,
|
||||
refreshing: false,
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
alert(err);
|
||||
});
|
||||
this.getTrending = this.getTrending.bind(this);
|
||||
this.getMore = this.getMore.bind(this);
|
||||
this.refreshData = this.refreshData.bind(this);
|
||||
this.state = {
|
||||
isReady: false,
|
||||
posts: [],
|
||||
user: [],
|
||||
start_author: "",
|
||||
start_permlink: "",
|
||||
refreshing: false,
|
||||
loading: false,
|
||||
isLoggedIn: this.props.isLoggedIn,
|
||||
};
|
||||
}
|
||||
|
||||
getMore = () => {
|
||||
this.setState({ loading: true });
|
||||
getPosts(
|
||||
"trending",
|
||||
{
|
||||
tag: "",
|
||||
limit: 10,
|
||||
start_author: this.state.start_author,
|
||||
start_permlink: this.state.start_permlink,
|
||||
},
|
||||
this.props.user.name
|
||||
).then(result => {
|
||||
let posts = result;
|
||||
posts.shift();
|
||||
this.setState({
|
||||
posts: [...this.state.posts, ...posts],
|
||||
start_author: result[result.length - 1].author,
|
||||
start_permlink: result[result.length - 1].permlink,
|
||||
});
|
||||
componentDidMount() {
|
||||
this.getTrending();
|
||||
}
|
||||
|
||||
getTrending = () => {
|
||||
getPosts("trending", { tag: "", limit: 10 }, this.props.user.name)
|
||||
.then(result => {
|
||||
this.setState({
|
||||
isReady: true,
|
||||
posts: result,
|
||||
start_author: result[result.length - 1].author,
|
||||
start_permlink: result[result.length - 1].permlink,
|
||||
refreshing: false,
|
||||
});
|
||||
};
|
||||
})
|
||||
.catch(err => {
|
||||
alert(err);
|
||||
});
|
||||
};
|
||||
|
||||
refreshData = () => {
|
||||
this.setState(
|
||||
{
|
||||
refreshing: true,
|
||||
},
|
||||
() => {
|
||||
this.getTrending();
|
||||
}
|
||||
);
|
||||
};
|
||||
getMore = () => {
|
||||
this.setState({ loading: true });
|
||||
getPosts(
|
||||
"trending",
|
||||
{
|
||||
tag: "",
|
||||
limit: 10,
|
||||
start_author: this.state.start_author,
|
||||
start_permlink: this.state.start_permlink,
|
||||
},
|
||||
this.props.user.name
|
||||
).then(result => {
|
||||
let posts = result;
|
||||
posts.shift();
|
||||
this.setState({
|
||||
posts: [...this.state.posts, ...posts],
|
||||
start_author: result[result.length - 1].author,
|
||||
start_permlink: result[result.length - 1].permlink,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
renderFooter = () => {
|
||||
if (!this.state.loading) return null;
|
||||
refreshData = () => {
|
||||
this.setState(
|
||||
{
|
||||
refreshing: true,
|
||||
},
|
||||
() => {
|
||||
this.getTrending();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<View style={styles.flatlistFooter}>
|
||||
<ActivityIndicator animating size="large" />
|
||||
renderFooter = () => {
|
||||
if (!this.state.loading) return null;
|
||||
|
||||
return (
|
||||
<View style={styles.flatlistFooter}>
|
||||
<ActivityIndicator animating size="large" />
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View style={{ flex: 1 }}>
|
||||
{this.state.isReady ? (
|
||||
<FlatList
|
||||
data={this.state.posts}
|
||||
showsVerticalScrollIndicator={false}
|
||||
renderItem={({ item }) => (
|
||||
<PostCard
|
||||
componentId={this.props.componentId}
|
||||
content={item}
|
||||
user={this.props.user}
|
||||
isLoggedIn={this.state.isLoggedIn}
|
||||
/>
|
||||
)}
|
||||
keyExtractor={(post, index) => index.toString()}
|
||||
onEndReached={this.getMore}
|
||||
removeClippedSubviews={true}
|
||||
refreshing={this.state.refreshing}
|
||||
onRefresh={() => this.refreshData()}
|
||||
onEndThreshold={0}
|
||||
initialNumToRender={10}
|
||||
ListFooterComponent={this.renderFooter}
|
||||
/>
|
||||
) : (
|
||||
<View>
|
||||
<View style={styles.placeholder}>
|
||||
<Placeholder.ImageContent
|
||||
size={60}
|
||||
animate="fade"
|
||||
lineNumber={4}
|
||||
lineSpacing={5}
|
||||
lastLineWidth="30%"
|
||||
onReady={this.state.isReady}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View style={{ flex: 1 }}>
|
||||
{this.state.isReady ? (
|
||||
<FlatList
|
||||
data={this.state.posts}
|
||||
showsVerticalScrollIndicator={false}
|
||||
renderItem={({ item }) => (
|
||||
<PostCard
|
||||
componentId={this.props.componentId}
|
||||
content={item}
|
||||
user={this.props.user}
|
||||
isLoggedIn={this.state.isLoggedIn}
|
||||
/>
|
||||
)}
|
||||
keyExtractor={(post, index) => index.toString()}
|
||||
onEndReached={this.getMore}
|
||||
removeClippedSubviews={true}
|
||||
refreshing={this.state.refreshing}
|
||||
onRefresh={() => this.refreshData()}
|
||||
onEndThreshold={0}
|
||||
initialNumToRender={10}
|
||||
ListFooterComponent={this.renderFooter}
|
||||
/>
|
||||
) : (
|
||||
<View>
|
||||
<View style={styles.placeholder}>
|
||||
<Placeholder.ImageContent
|
||||
size={60}
|
||||
animate="fade"
|
||||
lineNumber={4}
|
||||
lineSpacing={5}
|
||||
lastLineWidth="30%"
|
||||
onReady={this.state.isReady}
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.placeholder}>
|
||||
<Placeholder.ImageContent
|
||||
size={60}
|
||||
animate="fade"
|
||||
lineNumber={4}
|
||||
lineSpacing={5}
|
||||
lastLineWidth="30%"
|
||||
onReady={this.state.isReady}
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.placeholder}>
|
||||
<Placeholder.ImageContent
|
||||
size={60}
|
||||
animate="fade"
|
||||
lineNumber={4}
|
||||
lineSpacing={5}
|
||||
lastLineWidth="30%"
|
||||
onReady={this.state.isReady}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
<View style={styles.placeholder}>
|
||||
<Placeholder.ImageContent
|
||||
size={60}
|
||||
animate="fade"
|
||||
lineNumber={4}
|
||||
lineSpacing={5}
|
||||
lastLineWidth="30%"
|
||||
onReady={this.state.isReady}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
<View style={styles.placeholder}>
|
||||
<Placeholder.ImageContent
|
||||
size={60}
|
||||
animate="fade"
|
||||
lineNumber={4}
|
||||
lineSpacing={5}
|
||||
lastLineWidth="30%"
|
||||
onReady={this.state.isReady}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default TrendingPage;
|
||||
|
@ -1,11 +1,6 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import React from "react";
|
||||
import {
|
||||
StatusBar,
|
||||
Dimensions,
|
||||
FlatList,
|
||||
ActivityIndicator,
|
||||
} from "react-native";
|
||||
import { FlatList, ActivityIndicator } from "react-native";
|
||||
|
||||
import moment from "moment";
|
||||
import FastImage from "react-native-fast-image";
|
||||
@ -13,375 +8,333 @@ import FastImage from "react-native-fast-image";
|
||||
import ScrollableTabView from "@esteemapp/react-native-scrollable-tab-view";
|
||||
import { TabBar } from "../../../components/tabBar";
|
||||
import DiscoverPage from "../discover/discover";
|
||||
import PostCard from "../../components/post-card/postCard";
|
||||
import { PostCard } from "../../components/postCard";
|
||||
import Comment from "../../components/comment/comment";
|
||||
|
||||
import {
|
||||
Content,
|
||||
Card,
|
||||
CardItem,
|
||||
View,
|
||||
Header,
|
||||
Left,
|
||||
Body,
|
||||
Right,
|
||||
Button,
|
||||
Icon,
|
||||
Title,
|
||||
Text,
|
||||
Container,
|
||||
} from "native-base";
|
||||
import { Card, CardItem, View, Body, Title, Container } from "native-base";
|
||||
|
||||
import { getUserData, getAuthStatus } from "../../realm/realm";
|
||||
import {
|
||||
getUser,
|
||||
getFollows,
|
||||
getPosts,
|
||||
getUserComments,
|
||||
getUserReplies,
|
||||
getUser,
|
||||
getFollows,
|
||||
getPosts,
|
||||
getUserComments,
|
||||
getUserReplies,
|
||||
} from "../../providers/steem/dsteem";
|
||||
import store from "../../redux/store/store";
|
||||
import styles from "../../styles/profile.styles";
|
||||
/* eslint-enable no-unused-vars */
|
||||
|
||||
class ProfilePage 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,
|
||||
},
|
||||
};
|
||||
}
|
||||
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() {
|
||||
super();
|
||||
this.getBlog = this.getBlog.bind(this);
|
||||
this.getMore = this.getMore.bind(this);
|
||||
this.getComments = this.getComments.bind(this);
|
||||
this.state = {
|
||||
user: [],
|
||||
posts: [],
|
||||
commments: [],
|
||||
replies: [],
|
||||
about: {},
|
||||
follows: {},
|
||||
isLoggedIn: false,
|
||||
};
|
||||
}
|
||||
constructor() {
|
||||
super();
|
||||
this.getBlog = this.getBlog.bind(this);
|
||||
this.getMore = this.getMore.bind(this);
|
||||
this.getComments = this.getComments.bind(this);
|
||||
this.state = {
|
||||
user: [],
|
||||
posts: [],
|
||||
commments: [],
|
||||
replies: [],
|
||||
about: {},
|
||||
follows: {},
|
||||
isLoggedIn: false,
|
||||
};
|
||||
}
|
||||
|
||||
async componentDidMount() {
|
||||
let isLoggedIn;
|
||||
let user;
|
||||
let userData;
|
||||
let follows;
|
||||
let about;
|
||||
async componentDidMount() {
|
||||
let isLoggedIn;
|
||||
let user;
|
||||
let userData;
|
||||
let follows;
|
||||
let about;
|
||||
|
||||
await getAuthStatus().then(res => {
|
||||
isLoggedIn = res;
|
||||
});
|
||||
await getAuthStatus().then(res => {
|
||||
isLoggedIn = res;
|
||||
});
|
||||
|
||||
if (isLoggedIn == true) {
|
||||
await getUserData().then(res => {
|
||||
userData = Array.from(res);
|
||||
});
|
||||
if (isLoggedIn == true) {
|
||||
await getUserData().then(res => {
|
||||
userData = Array.from(res);
|
||||
});
|
||||
|
||||
await getFollows(userData[0].username).then(res => {
|
||||
follows = res;
|
||||
});
|
||||
await getFollows(userData[0].username).then(res => {
|
||||
follows = res;
|
||||
});
|
||||
|
||||
user = await getUser(userData[0].username);
|
||||
about = JSON.parse(user.json_metadata);
|
||||
this.setState(
|
||||
{
|
||||
user: user,
|
||||
isLoggedIn: isLoggedIn,
|
||||
follows: follows,
|
||||
about: about.profile,
|
||||
},
|
||||
() => {
|
||||
this.getBlog(userData[0].username);
|
||||
this.getComments(userData[0].username);
|
||||
}
|
||||
);
|
||||
user = await getUser(userData[0].username);
|
||||
about = JSON.parse(user.json_metadata);
|
||||
this.setState(
|
||||
{
|
||||
user: user,
|
||||
isLoggedIn: isLoggedIn,
|
||||
follows: follows,
|
||||
about: about.profile,
|
||||
},
|
||||
() => {
|
||||
this.getBlog(userData[0].username);
|
||||
this.getComments(userData[0].username);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
renderFooter = () => {
|
||||
if (!this.state.loading == false) return null;
|
||||
renderFooter = () => {
|
||||
if (!this.state.loading == false) return null;
|
||||
|
||||
return (
|
||||
<View style={{ marginVertical: 20 }}>
|
||||
<ActivityIndicator animating size="large" />
|
||||
</View>
|
||||
);
|
||||
};
|
||||
return (
|
||||
<View style={{ marginVertical: 20 }}>
|
||||
<ActivityIndicator animating size="large" />
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
getBlog = user => {
|
||||
this.setState({ loading: true });
|
||||
getPosts("blog", { tag: user, limit: 10 }, user)
|
||||
.then(result => {
|
||||
this.setState({
|
||||
isReady: true,
|
||||
posts: result,
|
||||
start_author: result[result.length - 1].author,
|
||||
start_permlink: result[result.length - 1].permlink,
|
||||
refreshing: false,
|
||||
loading: false,
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
alert(err);
|
||||
});
|
||||
};
|
||||
|
||||
getMore = async () => {
|
||||
console.log("get more");
|
||||
await getPosts(
|
||||
"blog",
|
||||
{
|
||||
tag: this.state.user.name,
|
||||
limit: 10,
|
||||
start_author: this.state.start_author,
|
||||
start_permlink: this.state.start_permlink,
|
||||
},
|
||||
this.state.user.name
|
||||
).then(result => {
|
||||
console.log(result);
|
||||
let posts = result;
|
||||
posts.shift();
|
||||
this.setState({
|
||||
posts: [...this.state.posts, ...posts],
|
||||
start_author: result[result.length - 1].author,
|
||||
start_permlink: result[result.length - 1].permlink,
|
||||
loading: false,
|
||||
});
|
||||
getBlog = user => {
|
||||
this.setState({ loading: true });
|
||||
getPosts("blog", { tag: user, limit: 10 }, user)
|
||||
.then(result => {
|
||||
this.setState({
|
||||
isReady: true,
|
||||
posts: result,
|
||||
start_author: result[result.length - 1].author,
|
||||
start_permlink: result[result.length - 1].permlink,
|
||||
refreshing: false,
|
||||
loading: false,
|
||||
});
|
||||
};
|
||||
})
|
||||
.catch(err => {
|
||||
alert(err);
|
||||
});
|
||||
};
|
||||
|
||||
getComments = async user => {
|
||||
await getUserComments({ start_author: user, limit: 10 })
|
||||
.then(result => {
|
||||
this.setState({
|
||||
isReady: true,
|
||||
commments: result,
|
||||
refreshing: false,
|
||||
loading: false,
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
};
|
||||
getMore = async () => {
|
||||
console.log("get more");
|
||||
await getPosts(
|
||||
"blog",
|
||||
{
|
||||
tag: this.state.user.name,
|
||||
limit: 10,
|
||||
start_author: this.state.start_author,
|
||||
start_permlink: this.state.start_permlink,
|
||||
},
|
||||
this.state.user.name
|
||||
).then(result => {
|
||||
console.log(result);
|
||||
let posts = result;
|
||||
posts.shift();
|
||||
this.setState({
|
||||
posts: [...this.state.posts, ...posts],
|
||||
start_author: result[result.length - 1].author,
|
||||
start_permlink: result[result.length - 1].permlink,
|
||||
loading: false,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
{this.state.isLoggedIn ? (
|
||||
<View style={{ flex: 1 }}>
|
||||
<View style={styles.content}>
|
||||
<FastImage
|
||||
style={styles.cover}
|
||||
source={{
|
||||
uri: this.state.about.cover_image,
|
||||
priority: FastImage.priority.high,
|
||||
}}
|
||||
/>
|
||||
<FastImage
|
||||
style={styles.avatar}
|
||||
source={{
|
||||
uri: this.state.about.profile_image,
|
||||
priority: FastImage.priority.high,
|
||||
}}
|
||||
/>
|
||||
<Body style={{ top: -40 }}>
|
||||
<Text style={{ fontWeight: "bold" }}>
|
||||
{this.state.user.name}
|
||||
</Text>
|
||||
<Text>{this.state.about.about}</Text>
|
||||
</Body>
|
||||
<Card style={{ margin: 0 }}>
|
||||
<CardItem style={styles.about}>
|
||||
<View style={{ flex: 0.3 }}>
|
||||
<Text>
|
||||
{this.state.user.post_count} Posts
|
||||
</Text>
|
||||
</View>
|
||||
<View style={{ flex: 0.4 }}>
|
||||
<Text>
|
||||
{this.state.follows.follower_count}{" "}
|
||||
Followers
|
||||
</Text>
|
||||
</View>
|
||||
<View style={{ flex: 0.4 }}>
|
||||
<Text>
|
||||
{this.state.follows.following_count}{" "}
|
||||
Following
|
||||
</Text>
|
||||
</View>
|
||||
</CardItem>
|
||||
getComments = async user => {
|
||||
await getUserComments({ start_author: user, limit: 10 })
|
||||
.then(result => {
|
||||
this.setState({
|
||||
isReady: true,
|
||||
commments: result,
|
||||
refreshing: false,
|
||||
loading: false,
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
};
|
||||
|
||||
<CardItem style={styles.info}>
|
||||
<View style={{ flex: 0.5 }}>
|
||||
<Text
|
||||
style={{
|
||||
marginLeft: 20,
|
||||
alignSelf: "flex-start",
|
||||
}}
|
||||
>
|
||||
<Icon
|
||||
style={{
|
||||
fontSize: 20,
|
||||
alignSelf: "flex-start",
|
||||
}}
|
||||
name="md-pin"
|
||||
/>
|
||||
{this.state.about.location}
|
||||
</Text>
|
||||
</View>
|
||||
<View style={{ flex: 0.5 }}>
|
||||
<Text>
|
||||
<Icon
|
||||
style={{
|
||||
fontSize: 20,
|
||||
marginRight: 10,
|
||||
}}
|
||||
name="md-calendar"
|
||||
/>
|
||||
{moment
|
||||
.utc(this.state.user.created)
|
||||
.local()
|
||||
.fromNow()}
|
||||
</Text>
|
||||
</View>
|
||||
</CardItem>
|
||||
</Card>
|
||||
</View>
|
||||
<ScrollableTabView
|
||||
style={styles.tabs}
|
||||
style={{ flex: 1 }}
|
||||
renderTabBar={() => (
|
||||
<TabBar
|
||||
style={styles.tabbar}
|
||||
tabUnderlineDefaultWidth={30} // default containerWidth / (numberOfTabs * 4)
|
||||
tabUnderlineScaleX={3} // default 3
|
||||
activeColor={"#222"}
|
||||
inactiveColor={"#222"}
|
||||
/>
|
||||
)}
|
||||
>
|
||||
<View tabLabel="Blog" style={styles.tabbarItem}>
|
||||
<FlatList
|
||||
data={this.state.posts}
|
||||
showsVerticalScrollIndicator={false}
|
||||
renderItem={({ item }) => (
|
||||
<PostCard
|
||||
style={{ shadowColor: "white" }}
|
||||
content={item}
|
||||
user={this.state.user}
|
||||
isLoggedIn={true}
|
||||
/>
|
||||
)}
|
||||
keyExtractor={(post, index) =>
|
||||
index.toString()
|
||||
}
|
||||
onEndReached={info => {
|
||||
if (this.state.loading == false) {
|
||||
console.log(info);
|
||||
this.getMore();
|
||||
}
|
||||
}}
|
||||
onEndThreshold={0}
|
||||
bounces={false}
|
||||
ListFooterComponent={this.renderFooter}
|
||||
/>
|
||||
</View>
|
||||
render() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
{this.state.isLoggedIn ? (
|
||||
<View style={{ flex: 1 }}>
|
||||
<View style={styles.content}>
|
||||
<FastImage
|
||||
style={styles.cover}
|
||||
source={{
|
||||
uri: this.state.about.cover_image,
|
||||
priority: FastImage.priority.high,
|
||||
}}
|
||||
/>
|
||||
<FastImage
|
||||
style={styles.avatar}
|
||||
source={{
|
||||
uri: this.state.about.profile_image,
|
||||
priority: FastImage.priority.high,
|
||||
}}
|
||||
/>
|
||||
<Body style={{ top: -40 }}>
|
||||
<Text style={{ fontWeight: "bold" }}>
|
||||
{this.state.user.name}
|
||||
</Text>
|
||||
<Text>{this.state.about.about}</Text>
|
||||
</Body>
|
||||
<Card style={{ margin: 0 }}>
|
||||
<CardItem style={styles.about}>
|
||||
<View style={{ flex: 0.3 }}>
|
||||
<Text>{this.state.user.post_count} Posts</Text>
|
||||
</View>
|
||||
<View style={{ flex: 0.4 }}>
|
||||
<Text>{this.state.follows.follower_count} Followers</Text>
|
||||
</View>
|
||||
<View style={{ flex: 0.4 }}>
|
||||
<Text>{this.state.follows.following_count} Following</Text>
|
||||
</View>
|
||||
</CardItem>
|
||||
|
||||
<View tabLabel="Comments" style={styles.tabbarItem}>
|
||||
<FlatList
|
||||
data={this.state.commments}
|
||||
showsVerticalScrollIndicator={false}
|
||||
renderItem={({ item }) => (
|
||||
<Comment
|
||||
comment={item}
|
||||
isLoggedIn={true}
|
||||
user={this.state.user}
|
||||
/>
|
||||
)}
|
||||
keyExtractor={(post, index) =>
|
||||
index.toString()
|
||||
}
|
||||
onEndThreshold={0}
|
||||
bounces={false}
|
||||
ListFooterComponent={this.renderFooter}
|
||||
/>
|
||||
</View>
|
||||
<View
|
||||
tabLabel="Replies"
|
||||
style={styles.tabbarItem}
|
||||
/>
|
||||
<View tabLabel="Wallet" style={styles.tabbarItem}>
|
||||
<Card>
|
||||
<Text>
|
||||
STEEM Balance: {this.state.user.balance}
|
||||
</Text>
|
||||
</Card>
|
||||
<Card>
|
||||
<Text>
|
||||
SBD Balance:{" "}
|
||||
{this.state.user.sbd_balance}
|
||||
</Text>
|
||||
</Card>
|
||||
<Card>
|
||||
<Text>
|
||||
STEEM Power:{" "}
|
||||
{this.state.user.steem_power} SP
|
||||
</Text>
|
||||
<Text>
|
||||
Received STEEM Power:{" "}
|
||||
{this.state.user.received_steem_power}{" "}
|
||||
SP
|
||||
</Text>
|
||||
<Text>
|
||||
Delegated Power Power:{" "}
|
||||
{this.state.user.delegated_steem_power}{" "}
|
||||
SP
|
||||
</Text>
|
||||
</Card>
|
||||
<Card>
|
||||
<Text>
|
||||
Saving STEEM Balance:{" "}
|
||||
{this.state.user.savings_balance}
|
||||
</Text>
|
||||
<Text>
|
||||
Saving STEEM Balance:{" "}
|
||||
{this.state.user.savings_sbd_balance}
|
||||
</Text>
|
||||
</Card>
|
||||
</View>
|
||||
</ScrollableTabView>
|
||||
</View>
|
||||
) : (
|
||||
<DiscoverPage />
|
||||
)}
|
||||
<CardItem style={styles.info}>
|
||||
<View style={{ flex: 0.5 }}>
|
||||
<Text
|
||||
style={{
|
||||
marginLeft: 20,
|
||||
alignSelf: "flex-start",
|
||||
}}
|
||||
>
|
||||
<Icon
|
||||
style={{
|
||||
fontSize: 20,
|
||||
alignSelf: "flex-start",
|
||||
}}
|
||||
name="md-pin"
|
||||
/>
|
||||
{this.state.about.location}
|
||||
</Text>
|
||||
</View>
|
||||
<View style={{ flex: 0.5 }}>
|
||||
<Text>
|
||||
<Icon
|
||||
style={{
|
||||
fontSize: 20,
|
||||
marginRight: 10,
|
||||
}}
|
||||
name="md-calendar"
|
||||
/>
|
||||
{moment
|
||||
.utc(this.state.user.created)
|
||||
.local()
|
||||
.fromNow()}
|
||||
</Text>
|
||||
</View>
|
||||
</CardItem>
|
||||
</Card>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
<ScrollableTabView
|
||||
style={styles.tabs}
|
||||
style={{ flex: 1 }}
|
||||
renderTabBar={() => (
|
||||
<TabBar
|
||||
style={styles.tabbar}
|
||||
tabUnderlineDefaultWidth={30} // default containerWidth / (numberOfTabs * 4)
|
||||
tabUnderlineScaleX={3} // default 3
|
||||
activeColor={"#222"}
|
||||
inactiveColor={"#222"}
|
||||
/>
|
||||
)}
|
||||
>
|
||||
<View tabLabel="Blog" style={styles.tabbarItem}>
|
||||
<FlatList
|
||||
data={this.state.posts}
|
||||
showsVerticalScrollIndicator={false}
|
||||
renderItem={({ item }) => (
|
||||
<PostCard
|
||||
style={{ shadowColor: "white" }}
|
||||
content={item}
|
||||
user={this.state.user}
|
||||
isLoggedIn={true}
|
||||
/>
|
||||
)}
|
||||
keyExtractor={(post, index) => index.toString()}
|
||||
onEndReached={info => {
|
||||
if (this.state.loading == false) {
|
||||
console.log(info);
|
||||
this.getMore();
|
||||
}
|
||||
}}
|
||||
onEndThreshold={0}
|
||||
bounces={false}
|
||||
ListFooterComponent={this.renderFooter}
|
||||
/>
|
||||
</View>
|
||||
|
||||
<View tabLabel="Comments" style={styles.tabbarItem}>
|
||||
<FlatList
|
||||
data={this.state.commments}
|
||||
showsVerticalScrollIndicator={false}
|
||||
renderItem={({ item }) => (
|
||||
<Comment
|
||||
comment={item}
|
||||
isLoggedIn={true}
|
||||
user={this.state.user}
|
||||
/>
|
||||
)}
|
||||
keyExtractor={(post, index) => index.toString()}
|
||||
onEndThreshold={0}
|
||||
bounces={false}
|
||||
ListFooterComponent={this.renderFooter}
|
||||
/>
|
||||
</View>
|
||||
<View tabLabel="Replies" style={styles.tabbarItem} />
|
||||
<View tabLabel="Wallet" style={styles.tabbarItem}>
|
||||
<Card>
|
||||
<Text>STEEM Balance: {this.state.user.balance}</Text>
|
||||
</Card>
|
||||
<Card>
|
||||
<Text>SBD Balance: {this.state.user.sbd_balance}</Text>
|
||||
</Card>
|
||||
<Card>
|
||||
<Text>STEEM Power: {this.state.user.steem_power} SP</Text>
|
||||
<Text>
|
||||
Received STEEM Power: {this.state.user.received_steem_power}{" "}
|
||||
SP
|
||||
</Text>
|
||||
<Text>
|
||||
Delegated Power Power:{" "}
|
||||
{this.state.user.delegated_steem_power} SP
|
||||
</Text>
|
||||
</Card>
|
||||
<Card>
|
||||
<Text>
|
||||
Saving STEEM Balance: {this.state.user.savings_balance}
|
||||
</Text>
|
||||
<Text>
|
||||
Saving STEEM Balance: {this.state.user.savings_sbd_balance}
|
||||
</Text>
|
||||
</Card>
|
||||
</View>
|
||||
</ScrollableTabView>
|
||||
</View>
|
||||
) : (
|
||||
<DiscoverPage />
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default ProfilePage;
|
||||
|
@ -8,17 +8,18 @@ import FastImage from "react-native-fast-image";
|
||||
import ScrollableTabView from "@esteemapp/react-native-scrollable-tab-view";
|
||||
import { TabBar } from "../../../components/tabBar";
|
||||
import DiscoverPage from "../../discover/discover";
|
||||
import PostCard from "../../../components/post-card/postCard";
|
||||
import { PostCard } from "../../../components/postCard";
|
||||
|
||||
import Comment from "../../../components/comment/comment";
|
||||
|
||||
import { Card, CardItem, View, Body, Icon, Text } from "native-base";
|
||||
|
||||
import { getUserData, getAuthStatus } from "../../../realm/realm";
|
||||
import {
|
||||
getUser,
|
||||
getFollows,
|
||||
getPosts,
|
||||
getUserComments,
|
||||
getUser,
|
||||
getFollows,
|
||||
getPosts,
|
||||
getUserComments,
|
||||
} from "../../../providers/steem/dsteem";
|
||||
|
||||
// Styles
|
||||
@ -26,344 +27,317 @@ import styles from "./profileStyles";
|
||||
/* eslint-enable no-unused-vars */
|
||||
|
||||
class ProfileScreen 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,
|
||||
},
|
||||
};
|
||||
}
|
||||
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() {
|
||||
super();
|
||||
this.getBlog = this.getBlog.bind(this);
|
||||
this.getMore = this.getMore.bind(this);
|
||||
this.getComments = this.getComments.bind(this);
|
||||
this.state = {
|
||||
user: [],
|
||||
posts: [],
|
||||
commments: [],
|
||||
replies: [],
|
||||
about: {},
|
||||
follows: {},
|
||||
isLoggedIn: false,
|
||||
};
|
||||
}
|
||||
constructor() {
|
||||
super();
|
||||
this.getBlog = this.getBlog.bind(this);
|
||||
this.getMore = this.getMore.bind(this);
|
||||
this.getComments = this.getComments.bind(this);
|
||||
this.state = {
|
||||
user: [],
|
||||
posts: [],
|
||||
commments: [],
|
||||
replies: [],
|
||||
about: {},
|
||||
follows: {},
|
||||
isLoggedIn: false,
|
||||
};
|
||||
}
|
||||
|
||||
async componentDidMount() {
|
||||
await getAuthStatus().then(res => {
|
||||
const isLoggedIn = res;
|
||||
});
|
||||
async componentDidMount() {
|
||||
await getAuthStatus().then(res => {
|
||||
const isLoggedIn = res;
|
||||
});
|
||||
|
||||
if (isLoggedIn === true) {
|
||||
let user;
|
||||
let userData;
|
||||
let follows;
|
||||
let about;
|
||||
if (isLoggedIn === true) {
|
||||
let user;
|
||||
let userData;
|
||||
let follows;
|
||||
let about;
|
||||
|
||||
await getUserData().then(res => {
|
||||
userData = Array.from(res);
|
||||
});
|
||||
await getUserData().then(res => {
|
||||
userData = Array.from(res);
|
||||
});
|
||||
|
||||
await getFollows(userData[0].username).then(res => {
|
||||
follows = res;
|
||||
});
|
||||
await getFollows(userData[0].username).then(res => {
|
||||
follows = res;
|
||||
});
|
||||
|
||||
user = await getUser(userData[0].username);
|
||||
about = JSON.parse(user.json_metadata);
|
||||
// BUG: json_metadata: "{}" is coming emty object!!
|
||||
this.setState(
|
||||
{
|
||||
user: user,
|
||||
isLoggedIn: isLoggedIn,
|
||||
follows: follows,
|
||||
about: about.profile,
|
||||
},
|
||||
() => {
|
||||
this.getBlog(userData[0].username);
|
||||
this.getComments(userData[0].username);
|
||||
}
|
||||
);
|
||||
user = await getUser(userData[0].username);
|
||||
about = JSON.parse(user.json_metadata);
|
||||
// BUG: json_metadata: "{}" is coming emty object!!
|
||||
this.setState(
|
||||
{
|
||||
user: user,
|
||||
isLoggedIn: isLoggedIn,
|
||||
follows: follows,
|
||||
about: about.profile,
|
||||
},
|
||||
() => {
|
||||
this.getBlog(userData[0].username);
|
||||
this.getComments(userData[0].username);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
renderFooter = () => {
|
||||
if (!this.state.loading == false) return null;
|
||||
renderFooter = () => {
|
||||
if (!this.state.loading == false) return null;
|
||||
|
||||
return (
|
||||
<View style={{ marginVertical: 20 }}>
|
||||
<ActivityIndicator animating size="large" />
|
||||
</View>
|
||||
);
|
||||
};
|
||||
return (
|
||||
<View style={{ marginVertical: 20 }}>
|
||||
<ActivityIndicator animating size="large" />
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
getBlog = user => {
|
||||
this.setState({ loading: true });
|
||||
getPosts("blog", { tag: user, limit: 10 }, user)
|
||||
.then(result => {
|
||||
this.setState({
|
||||
isReady: true,
|
||||
posts: result,
|
||||
start_author: result[result.length - 1].author,
|
||||
start_permlink: result[result.length - 1].permlink,
|
||||
refreshing: false,
|
||||
loading: false,
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
alert(err);
|
||||
});
|
||||
};
|
||||
|
||||
getMore = async () => {
|
||||
console.log("get more");
|
||||
await getPosts(
|
||||
"blog",
|
||||
{
|
||||
tag: this.state.user.name,
|
||||
limit: 10,
|
||||
start_author: this.state.start_author,
|
||||
start_permlink: this.state.start_permlink,
|
||||
},
|
||||
this.state.user.name
|
||||
).then(result => {
|
||||
console.log(result);
|
||||
let posts = result;
|
||||
posts.shift();
|
||||
this.setState({
|
||||
posts: [...this.state.posts, ...posts],
|
||||
start_author: result[result.length - 1].author,
|
||||
start_permlink: result[result.length - 1].permlink,
|
||||
loading: false,
|
||||
});
|
||||
getBlog = user => {
|
||||
this.setState({ loading: true });
|
||||
getPosts("blog", { tag: user, limit: 10 }, user)
|
||||
.then(result => {
|
||||
this.setState({
|
||||
isReady: true,
|
||||
posts: result,
|
||||
start_author: result[result.length - 1].author,
|
||||
start_permlink: result[result.length - 1].permlink,
|
||||
refreshing: false,
|
||||
loading: false,
|
||||
});
|
||||
};
|
||||
})
|
||||
.catch(err => {
|
||||
alert(err);
|
||||
});
|
||||
};
|
||||
|
||||
getComments = async user => {
|
||||
await getUserComments({ start_author: user, limit: 10 })
|
||||
.then(result => {
|
||||
this.setState({
|
||||
isReady: true,
|
||||
commments: result,
|
||||
refreshing: false,
|
||||
loading: false,
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
};
|
||||
getMore = async () => {
|
||||
console.log("get more");
|
||||
await getPosts(
|
||||
"blog",
|
||||
{
|
||||
tag: this.state.user.name,
|
||||
limit: 10,
|
||||
start_author: this.state.start_author,
|
||||
start_permlink: this.state.start_permlink,
|
||||
},
|
||||
this.state.user.name
|
||||
).then(result => {
|
||||
console.log(result);
|
||||
let posts = result;
|
||||
posts.shift();
|
||||
this.setState({
|
||||
posts: [...this.state.posts, ...posts],
|
||||
start_author: result[result.length - 1].author,
|
||||
start_permlink: result[result.length - 1].permlink,
|
||||
loading: false,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
//TODO: Refactor ME !
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
{this.state.isLoggedIn ? (
|
||||
<View style={{ flex: 1 }}>
|
||||
<View style={styles.content}>
|
||||
<FastImage
|
||||
style={styles.cover}
|
||||
source={{
|
||||
uri: this.state.about.cover_image,
|
||||
priority: FastImage.priority.high,
|
||||
}}
|
||||
/>
|
||||
<FastImage
|
||||
style={styles.avatar}
|
||||
source={{
|
||||
uri: this.state.about.profile_image,
|
||||
priority: FastImage.priority.high,
|
||||
}}
|
||||
/>
|
||||
<Body style={{ top: -40 }}>
|
||||
<Text style={{ fontWeight: "bold" }}>
|
||||
{this.state.user.name}
|
||||
</Text>
|
||||
<Text>{this.state.about.about}</Text>
|
||||
</Body>
|
||||
<Card style={{ margin: 0 }}>
|
||||
<CardItem style={styles.about}>
|
||||
<View style={{ flex: 0.3 }}>
|
||||
<Text>
|
||||
{this.state.user.post_count} Posts
|
||||
</Text>
|
||||
</View>
|
||||
<View style={{ flex: 0.4 }}>
|
||||
<Text>
|
||||
{this.state.follows.follower_count}{" "}
|
||||
Followers
|
||||
</Text>
|
||||
</View>
|
||||
<View style={{ flex: 0.4 }}>
|
||||
<Text>
|
||||
{this.state.follows.following_count}{" "}
|
||||
Following
|
||||
</Text>
|
||||
</View>
|
||||
</CardItem>
|
||||
getComments = async user => {
|
||||
await getUserComments({ start_author: user, limit: 10 })
|
||||
.then(result => {
|
||||
this.setState({
|
||||
isReady: true,
|
||||
commments: result,
|
||||
refreshing: false,
|
||||
loading: false,
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
};
|
||||
|
||||
<CardItem style={styles.info}>
|
||||
<View style={{ flex: 0.5 }}>
|
||||
<Text
|
||||
style={{
|
||||
marginLeft: 20,
|
||||
alignSelf: "flex-start",
|
||||
}}
|
||||
>
|
||||
<Icon
|
||||
style={{
|
||||
fontSize: 20,
|
||||
alignSelf: "flex-start",
|
||||
}}
|
||||
name="md-pin"
|
||||
/>
|
||||
{this.state.about.location}
|
||||
</Text>
|
||||
</View>
|
||||
<View style={{ flex: 0.5 }}>
|
||||
<Text>
|
||||
<Icon
|
||||
style={{
|
||||
fontSize: 20,
|
||||
marginRight: 10,
|
||||
}}
|
||||
name="md-calendar"
|
||||
/>
|
||||
{moment
|
||||
.utc(this.state.user.created)
|
||||
.local()
|
||||
.fromNow()}
|
||||
</Text>
|
||||
</View>
|
||||
</CardItem>
|
||||
</Card>
|
||||
</View>
|
||||
<ScrollableTabView
|
||||
style={styles.tabs}
|
||||
style={{ flex: 1 }}
|
||||
renderTabBar={() => (
|
||||
<TabBar
|
||||
style={styles.tabbar}
|
||||
tabUnderlineDefaultWidth={30} // default containerWidth / (numberOfTabs * 4)
|
||||
tabUnderlineScaleX={3} // default 3
|
||||
activeColor={"#222"}
|
||||
inactiveColor={"#222"}
|
||||
/>
|
||||
)}
|
||||
>
|
||||
<View tabLabel="Blog" style={styles.tabbarItem}>
|
||||
<FlatList
|
||||
data={this.state.posts}
|
||||
showsVerticalScrollIndicator={false}
|
||||
renderItem={({ item }) => (
|
||||
<PostCard
|
||||
style={{ shadowColor: "white" }}
|
||||
content={item}
|
||||
user={this.state.user}
|
||||
isLoggedIn={true}
|
||||
/>
|
||||
)}
|
||||
keyExtractor={(post, index) =>
|
||||
index.toString()
|
||||
}
|
||||
onEndReached={info => {
|
||||
if (this.state.loading == false) {
|
||||
console.log(info);
|
||||
this.getMore();
|
||||
}
|
||||
}}
|
||||
onEndThreshold={0}
|
||||
bounces={false}
|
||||
ListFooterComponent={this.renderFooter}
|
||||
/>
|
||||
</View>
|
||||
render() {
|
||||
//TODO: Refactor ME !
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
{this.state.isLoggedIn ? (
|
||||
<View style={{ flex: 1 }}>
|
||||
<View style={styles.content}>
|
||||
<FastImage
|
||||
style={styles.cover}
|
||||
source={{
|
||||
uri: this.state.about.cover_image,
|
||||
priority: FastImage.priority.high,
|
||||
}}
|
||||
/>
|
||||
<FastImage
|
||||
style={styles.avatar}
|
||||
source={{
|
||||
uri: this.state.about.profile_image,
|
||||
priority: FastImage.priority.high,
|
||||
}}
|
||||
/>
|
||||
<Body style={{ top: -40 }}>
|
||||
<Text style={{ fontWeight: "bold" }}>
|
||||
{this.state.user.name}
|
||||
</Text>
|
||||
<Text>{this.state.about.about}</Text>
|
||||
</Body>
|
||||
<Card style={{ margin: 0 }}>
|
||||
<CardItem style={styles.about}>
|
||||
<View style={{ flex: 0.3 }}>
|
||||
<Text>{this.state.user.post_count} Posts</Text>
|
||||
</View>
|
||||
<View style={{ flex: 0.4 }}>
|
||||
<Text>{this.state.follows.follower_count} Followers</Text>
|
||||
</View>
|
||||
<View style={{ flex: 0.4 }}>
|
||||
<Text>{this.state.follows.following_count} Following</Text>
|
||||
</View>
|
||||
</CardItem>
|
||||
|
||||
<View tabLabel="Comments" style={styles.tabbarItem}>
|
||||
<FlatList
|
||||
data={this.state.commments}
|
||||
showsVerticalScrollIndicator={false}
|
||||
renderItem={({ item }) => (
|
||||
<Comment
|
||||
comment={item}
|
||||
isLoggedIn={true}
|
||||
user={this.state.user}
|
||||
/>
|
||||
)}
|
||||
keyExtractor={(post, index) =>
|
||||
index.toString()
|
||||
}
|
||||
onEndThreshold={0}
|
||||
bounces={false}
|
||||
ListFooterComponent={this.renderFooter}
|
||||
/>
|
||||
</View>
|
||||
<View
|
||||
tabLabel="Replies"
|
||||
style={styles.tabbarItem}
|
||||
/>
|
||||
<View tabLabel="Wallet" style={styles.tabbarItem}>
|
||||
<Card>
|
||||
<Text>
|
||||
STEEM Balance: {this.state.user.balance}
|
||||
</Text>
|
||||
</Card>
|
||||
<Card>
|
||||
<Text>
|
||||
SBD Balance:{" "}
|
||||
{this.state.user.sbd_balance}
|
||||
</Text>
|
||||
</Card>
|
||||
<Card>
|
||||
<Text>
|
||||
STEEM Power:{" "}
|
||||
{this.state.user.steem_power} SP
|
||||
</Text>
|
||||
<Text>
|
||||
Received STEEM Power:{" "}
|
||||
{this.state.user.received_steem_power}{" "}
|
||||
SP
|
||||
</Text>
|
||||
<Text>
|
||||
Delegated Power Power:{" "}
|
||||
{this.state.user.delegated_steem_power}{" "}
|
||||
SP
|
||||
</Text>
|
||||
</Card>
|
||||
<Card>
|
||||
<Text>
|
||||
Saving STEEM Balance:{" "}
|
||||
{this.state.user.savings_balance}
|
||||
</Text>
|
||||
<Text>
|
||||
Saving STEEM Balance:{" "}
|
||||
{this.state.user.savings_sbd_balance}
|
||||
</Text>
|
||||
</Card>
|
||||
</View>
|
||||
</ScrollableTabView>
|
||||
</View>
|
||||
) : (
|
||||
<DiscoverPage />
|
||||
)}
|
||||
<CardItem style={styles.info}>
|
||||
<View style={{ flex: 0.5 }}>
|
||||
<Text
|
||||
style={{
|
||||
marginLeft: 20,
|
||||
alignSelf: "flex-start",
|
||||
}}
|
||||
>
|
||||
<Icon
|
||||
style={{
|
||||
fontSize: 20,
|
||||
alignSelf: "flex-start",
|
||||
}}
|
||||
name="md-pin"
|
||||
/>
|
||||
{this.state.about.location}
|
||||
</Text>
|
||||
</View>
|
||||
<View style={{ flex: 0.5 }}>
|
||||
<Text>
|
||||
<Icon
|
||||
style={{
|
||||
fontSize: 20,
|
||||
marginRight: 10,
|
||||
}}
|
||||
name="md-calendar"
|
||||
/>
|
||||
{moment
|
||||
.utc(this.state.user.created)
|
||||
.local()
|
||||
.fromNow()}
|
||||
</Text>
|
||||
</View>
|
||||
</CardItem>
|
||||
</Card>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
<ScrollableTabView
|
||||
style={styles.tabs}
|
||||
style={{ flex: 1 }}
|
||||
renderTabBar={() => (
|
||||
<TabBar
|
||||
style={styles.tabbar}
|
||||
tabUnderlineDefaultWidth={30} // default containerWidth / (numberOfTabs * 4)
|
||||
tabUnderlineScaleX={3} // default 3
|
||||
activeColor={"#222"}
|
||||
inactiveColor={"#222"}
|
||||
/>
|
||||
)}
|
||||
>
|
||||
<View tabLabel="Blog" style={styles.tabbarItem}>
|
||||
<FlatList
|
||||
data={this.state.posts}
|
||||
showsVerticalScrollIndicator={false}
|
||||
renderItem={({ item }) => (
|
||||
<PostCard
|
||||
style={{ shadowColor: "white" }}
|
||||
content={item}
|
||||
user={this.state.user}
|
||||
isLoggedIn={true}
|
||||
/>
|
||||
)}
|
||||
keyExtractor={(post, index) => index.toString()}
|
||||
onEndReached={info => {
|
||||
if (this.state.loading == false) {
|
||||
console.log(info);
|
||||
this.getMore();
|
||||
}
|
||||
}}
|
||||
onEndThreshold={0}
|
||||
bounces={false}
|
||||
ListFooterComponent={this.renderFooter}
|
||||
/>
|
||||
</View>
|
||||
|
||||
<View tabLabel="Comments" style={styles.tabbarItem}>
|
||||
<FlatList
|
||||
data={this.state.commments}
|
||||
showsVerticalScrollIndicator={false}
|
||||
renderItem={({ item }) => (
|
||||
<Comment
|
||||
comment={item}
|
||||
isLoggedIn={true}
|
||||
user={this.state.user}
|
||||
/>
|
||||
)}
|
||||
keyExtractor={(post, index) => index.toString()}
|
||||
onEndThreshold={0}
|
||||
bounces={false}
|
||||
ListFooterComponent={this.renderFooter}
|
||||
/>
|
||||
</View>
|
||||
<View tabLabel="Replies" style={styles.tabbarItem} />
|
||||
<View tabLabel="Wallet" style={styles.tabbarItem}>
|
||||
<Card>
|
||||
<Text>STEEM Balance: {this.state.user.balance}</Text>
|
||||
</Card>
|
||||
<Card>
|
||||
<Text>SBD Balance: {this.state.user.sbd_balance}</Text>
|
||||
</Card>
|
||||
<Card>
|
||||
<Text>STEEM Power: {this.state.user.steem_power} SP</Text>
|
||||
<Text>
|
||||
Received STEEM Power: {this.state.user.received_steem_power}{" "}
|
||||
SP
|
||||
</Text>
|
||||
<Text>
|
||||
Delegated Power Power:{" "}
|
||||
{this.state.user.delegated_steem_power} SP
|
||||
</Text>
|
||||
</Card>
|
||||
<Card>
|
||||
<Text>
|
||||
Saving STEEM Balance: {this.state.user.savings_balance}
|
||||
</Text>
|
||||
<Text>
|
||||
Saving STEEM Balance: {this.state.user.savings_sbd_balance}
|
||||
</Text>
|
||||
</Card>
|
||||
</View>
|
||||
</ScrollableTabView>
|
||||
</View>
|
||||
) : (
|
||||
<DiscoverPage />
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default ProfileScreen;
|
||||
|
@ -22,116 +22,116 @@ import PinCode from "./pinCode/pinCodeContainer";
|
||||
|
||||
// COMPONENTS
|
||||
import SteemConnect from "./steem-connect/steemConnect";
|
||||
import PostCard from "../components/post-card/postCard";
|
||||
import { PostCard } from "../components/postCard";
|
||||
import Search from "../components/search/search";
|
||||
|
||||
export const registerScreens = () => {
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Splash",
|
||||
() => Splash,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Home",
|
||||
() => Home,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Hot",
|
||||
() => Hot,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Feed",
|
||||
() => Feed,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Post",
|
||||
() => SinglePost,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Login",
|
||||
() => Login,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Wallet",
|
||||
() => Wallet,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Editor",
|
||||
() => Editor,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Discover",
|
||||
() => Discover,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Settings",
|
||||
() => Settings,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Notifications",
|
||||
() => Notification,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.SideMenuScreen",
|
||||
() => SideMenu,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Profile",
|
||||
() => Profile,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Author",
|
||||
() => Author,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.PostCard",
|
||||
() => PostCard,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Search",
|
||||
() => Search,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.PinCode",
|
||||
() => PinCode,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.SteemConnect",
|
||||
() => SteemConnect,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Splash",
|
||||
() => Splash,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Home",
|
||||
() => Home,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Hot",
|
||||
() => Hot,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Feed",
|
||||
() => Feed,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Post",
|
||||
() => SinglePost,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Login",
|
||||
() => Login,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Wallet",
|
||||
() => Wallet,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Editor",
|
||||
() => Editor,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Discover",
|
||||
() => Discover,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Settings",
|
||||
() => Settings,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Notifications",
|
||||
() => Notification,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.SideMenuScreen",
|
||||
() => SideMenu,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Profile",
|
||||
() => Profile,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Author",
|
||||
() => Author,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.PostCard",
|
||||
() => PostCard,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.Search",
|
||||
() => Search,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.PinCode",
|
||||
() => PinCode,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
Navigation.registerComponentWithRedux(
|
||||
"navigation.eSteem.SteemConnect",
|
||||
() => SteemConnect,
|
||||
Provider,
|
||||
store
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user