Skip to content

updates TimelineScreen.js fetchTimeline #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: foundation
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions src/Screens/TimelineScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@ export class TimelineScreen extends React.Component {
}

fetchTimeline = () => {

this.props.api
.fetchTimeline()
.then(timeline => {
this.setState({ timeline });
});
this.props.api.fetchTimeline().then(({ statuses }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe its better if we return the statuses from the API?

this.setState({ timeline: statuses });
});
};

handleTweetPress = id => {
console.log('handlePress => ', id);
console.log("handlePress => ", id);
/*
- navigate to `TWEET_DETAIL_SCREEN` passing the id as a param
*/
Expand All @@ -36,7 +33,7 @@ export class TimelineScreen extends React.Component {
- create a TweetItem component with this API:
<TweetItem item={item} handlePress={() => this.handleTweetPress(item.id_str)} />
*/
renderItem = ({ item }) => null
renderItem = ({ item }) => null;

render() {
const { timeline } = this.state;
Expand All @@ -45,9 +42,7 @@ export class TimelineScreen extends React.Component {
{timeline.length == 0 ? (
<ViewLoading />
) : (

<Text>{JSON.stringify(timeline, null, 4)}</Text>

<Text>{JSON.stringify(timeline, null, 4)}</Text>
)}
</Screen>
);
Expand Down