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
Pull down to refresh implemented #132
Changes from 4 commits
f455e30
9e091a8
f52e2f6
90c8d76
8e285b4
5eb2b51
870ea3c
9a86228
08548e5
e02fe90
f308a7b
36d8cf7
5d7736b
088dc12
9d97a3a
7c11120
f8506e7
438a87f
f7da7a5
899d028
a17a572
88eee32
15d685b
ec7c9ef
f484cd8
442690c
203cc2b
f6ed3ba
02c5e67
3e907f9
5d639c1
66ad3e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import React, { Component } from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { StyleSheet } from 'react-native'; | ||
import { StyleSheet, ScrollView, RefreshControl } from 'react-native'; | ||
import { ListItem } from 'react-native-elements'; | ||
import Communications from 'react-native-communications'; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep this newline for consistency. We're separating external modules from internal components. |
||
|
@@ -60,90 +60,105 @@ class AuthProfile extends Component { | |
return url.substr(0, prefix.length) === prefix ? url : `http://${url}`; | ||
}; | ||
|
||
refreshProfile = () => { | ||
this.props.getUser(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we extract this to a separate method (for example: |
||
this.props.getOrgs(); | ||
}; | ||
|
||
render() { | ||
const { user, orgs, isPendingUser, isPendingOrgs, navigation } = this.props; | ||
const loading = isPendingUser || isPendingOrgs; | ||
|
||
return ( | ||
<ViewContainer> | ||
{loading && <LoadingContainer animating={loading} center />} | ||
|
||
{!loading && | ||
<ParallaxScroll | ||
renderContent={() => | ||
<UserProfile | ||
type="user" | ||
initialUser={user} | ||
user={user} | ||
navigation={navigation} | ||
/>} | ||
stickyTitle={user.login} | ||
> | ||
{user.bio && | ||
user.bio !== '' && | ||
<SectionList title="BIO"> | ||
<ScrollView | ||
refreshControl={ | ||
<RefreshControl | ||
refreshing={loading} | ||
onRefresh={this.refreshProfile} | ||
/> | ||
} | ||
> | ||
{loading && <LoadingContainer animating={loading} center />} | ||
|
||
{!loading && | ||
<ParallaxScroll | ||
renderContent={() => | ||
<UserProfile | ||
type="user" | ||
initialUser={user} | ||
user={user} | ||
navigation={navigation} | ||
/>} | ||
stickyTitle={user.login} | ||
> | ||
{user.bio && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can use |
||
user.bio !== '' && | ||
<SectionList title="BIO"> | ||
<ListItem | ||
subtitle={user.bio} | ||
subtitleStyle={styles.listSubTitle} | ||
hideChevron | ||
/> | ||
</SectionList>} | ||
|
||
<SectionList | ||
title="EMAIL" | ||
noItems={!user.email || user.email === ''} | ||
noItemsMessage={'No email associated with account'} | ||
> | ||
<ListItem | ||
subtitle={user.bio} | ||
title="Email" | ||
titleStyle={styles.listTitle} | ||
leftIcon={{ | ||
name: 'mail', | ||
color: colors.grey, | ||
type: 'octicon', | ||
}} | ||
subtitle={user.email} | ||
subtitleStyle={styles.listSubTitle} | ||
hideChevron | ||
onPress={() => | ||
Communications.email([user.email], null, null, 'Hi!', '')} | ||
underlayColor={colors.greyLight} | ||
/> | ||
</SectionList>} | ||
</SectionList> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This email section can be removed as it's included in EntityInfo 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah a bit of a mistake when merging... Last commit should have removed it I think, a second swing at merging your master into my branch |
||
|
||
<SectionList | ||
title="EMAIL" | ||
noItems={!user.email || user.email === ''} | ||
noItemsMessage={'No email associated with account'} | ||
> | ||
<ListItem | ||
title="Email" | ||
titleStyle={styles.listTitle} | ||
leftIcon={{ | ||
name: 'mail', | ||
color: colors.grey, | ||
type: 'octicon', | ||
}} | ||
subtitle={user.email} | ||
subtitleStyle={styles.listSubTitle} | ||
onPress={() => | ||
Communications.email([user.email], null, null, 'Hi!', '')} | ||
underlayColor={colors.greyLight} | ||
/> | ||
</SectionList> | ||
|
||
<SectionList | ||
title="WEBSITE" | ||
noItems={!user.blog || user.blog === ''} | ||
noItemsMessage={'No website associated with account'} | ||
> | ||
<ListItem | ||
title="Website" | ||
titleStyle={styles.listTitle} | ||
leftIcon={{ | ||
name: 'link', | ||
color: colors.grey, | ||
type: 'octicon', | ||
}} | ||
subtitle={user.blog} | ||
subtitleStyle={styles.listSubTitle} | ||
onPress={() => Communications.web(this.getUserBlog(user.blog))} | ||
underlayColor={colors.greyLight} | ||
/> | ||
</SectionList> | ||
|
||
<SectionList | ||
title="ORGANIZATIONS" | ||
noItems={orgs.length === 0} | ||
noItemsMessage={'No organizations'} | ||
> | ||
{orgs.map(item => | ||
<UserListItem | ||
key={item.id} | ||
user={item} | ||
navigation={navigation} | ||
<SectionList | ||
title="WEBSITE" | ||
noItems={!user.blog || user.blog === ''} | ||
noItemsMessage={'No website associated with account'} | ||
> | ||
<ListItem | ||
title="Website" | ||
titleStyle={styles.listTitle} | ||
leftIcon={{ | ||
name: 'link', | ||
color: colors.grey, | ||
type: 'octicon', | ||
}} | ||
subtitle={user.blog} | ||
subtitleStyle={styles.listSubTitle} | ||
onPress={() => | ||
Communications.web(this.getUserBlog(user.blog))} | ||
underlayColor={colors.greyLight} | ||
/> | ||
)} | ||
</SectionList> | ||
</ParallaxScroll>} | ||
</SectionList> | ||
|
||
<SectionList | ||
title="ORGANIZATIONS" | ||
noItems={orgs.length === 0} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be more readable? In the end, the result would be the same but in my opinion, |
||
noItemsMessage={'No organizations'} | ||
> | ||
{orgs.map(item => | ||
<UserListItem | ||
key={item.id} | ||
user={item} | ||
navigation={navigation} | ||
/> | ||
)} | ||
</SectionList> | ||
</ParallaxScroll>} | ||
</ScrollView> | ||
</ViewContainer> | ||
); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has got quite a few conflicts and is using a pretty old version of the file. For example, most of these SectionList's can be replaced with the |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this in here? Maybe I just missed it, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My machine was having problems with running yarn commands that called on
react-native
. The problem was with npm itself, and a workaround listed was to includereact-native-cli
as a dev dependency.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me then. =]