-
Notifications
You must be signed in to change notification settings - Fork 787
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
Conversation
Getting the latest Master with Android support
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.
Other than the conflicts, looks good! Thanks!
)} | ||
</SectionList> | ||
</ParallaxScroll>} | ||
</ScrollView> | ||
</ViewContainer> | ||
); | ||
} |
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.
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 <EntityInfo />
component.
/> | ||
</SectionList>} | ||
</SectionList> |
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.
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 comment
The 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
Looks good after a quick pass through! I can look at it more tomorrow morning :) |
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.
This looks great 🎉 For someone who doesn't have much React Native experience - this is pretty impressive.
Just a few minor nits and I would appreciate if you can upload a gif of the refreshControl
in action. Also I remember you mentioned issues with using the precommit hook, are the files you changed formatted with prettier
? If the precommit
is giving you trouble, try getting a plugin for your IDE (just wondering why all the whitespace is showing)
.all-contributorsrc
Outdated
@@ -155,6 +155,15 @@ | |||
"contributions": [ | |||
"code" | |||
] | |||
}, | |||
{ | |||
"login": "SammyIsra", |
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.
🎉 🎉 🎉 🎉 🎉
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.
Yes!
@@ -113,71 +114,87 @@ class AuthProfile extends Component { | |||
} | |||
}; | |||
|
|||
refreshProfile = () => { | |||
this.props.getUser(); |
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.
Can we extract this to a separate method (for example: getUserDetails
) and then call getUserDetails
in componentDidMount
as well as in the ScrollView
refreshControl
prop?
@@ -118,6 +118,14 @@ class Repository extends Component { | |||
} | |||
}; | |||
|
|||
refreshRepo = () => { | |||
const { navigation } = this.props; |
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.
Same thing here. Maybe rename this to something like getRepoInfo
and call the method within componentDidMount
and refreshControl
prop so we can avoid duplication
@housseindjirdeh @andrewda Thanks for the feedback! |
@SammyIsra here would be perfect (I don't think gitter even allows uploading attachments 😂). Usually with any PR that I do that has UI changes I always feel a screenshot or gif is super useful |
No worries at all mate looking through everything it looks solid and white space isn't a problem - they'll get formatted when one of use modifies the file thanks to prettier |
…their own functions.
Hey so, for some reason the repo stopped working on my machine again. I think this is an issue with my machine and not with the repo itself. Would someone be able to make sure this works again? Sorry for the issues caused :/ |
what's the issue you're seeing mate, let's try to help in the gitter channel again @SammyIsra And absolutely I'll take a look at this a bit later when I get the chance |
@housseindjirdeh sure, I'll post about it on Gitter whenever I get a chance (probably in around 4-ish hours). Hope we can work this out. |
Gif showing the pull down to refresh on GitPoint! http://i.imgur.com/plWbQX6.gif |
Fixed some merge issues (but another set of eyes on |
Would it be possible/desired for the stars, forks, bio and owner not to be replace until after being updated? By that I mean keep the current data until the new data is received, then update it so the screen isn't blank for a few seconds. |
<UserProfile | ||
type="user" | ||
initialUser={user} | ||
user={user} | ||
navigation={navigation} | ||
/> | ||
)} |
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.
Extra parenthesis here, guessing it got messed up in fixing the conflicts (see Travis build).
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.
Yup, merge issues :/ fixed it in the next commit!
All change requests have been addressed! |
…and VSCode yelling at me is easier than on the Github editor.
@SammyIsra don't ever rush my friend, take as long as you ever need to <3 Open source should never amount to additional stress, if a feature takes 5 months to complete than so be it :) |
The ticket itself is limited to User Profile and Repository screens. I've added it to the non logged in User, and the Issue/PR page. Adding a pull down to refresh feature on a page should be easier now! @housseindjirdeh thank you for pointing out the use of |
It seems to work on my phone (Android), and passed all checks :D |
One tiny thing I'd change is that (at least on iOS) when on the user auth screen (logged in user) after pulling down to refresh the loading screen is shown again. It works properly on another user's page, refreshing shows the loading spinner in the info area. |
Also please add this to organizations! |
@andrewda I was wondering about that. Looking at the code, the initial "loading" stage in auth user is different than the loading stage of other users. I can certainly take a look! Gotcha, will add it to Organizations too :) |
@SammyIsra Yea I figured that was the case. Would probably be best to fix/change that here because that part's a bit weird as it stands. |
So I already mentioned this on Gitter but putting this here just in case also. As @andrewda pointed out, when you pull down to refresh on the AuthUser page the entire page goes white while refreshing. The reason for that we don't have an "initial user" to render some of the profile information. I have two possible solutions for this. First, pass The second solution is to have a state property called I kinda prefer the second method since I believe it has a better experience when refreshing. But would still like to get everyone's opinion on it! |
Hey actually I found a bug on the latest version, so it's not safe yet to commit. The examples I mentioned in the last comment are unaffected tho, so if you want to take a look that part is not related to the bug. |
Thanks @SammyIsra - I'm actually okay with not having pull to refresh for Regarding |
@housseindjirdeh The flag is set to true not when the user has logged in, but when we have initially fetched the authenticated user. Also, when we log out, we don't empty out the |
@housseindjirdeh Also, not that much work now that it is already implemented haha. Easy to remove too if we, later on, decide not to have it. |
src/issue/screens/issue.screen.js
Outdated
@@ -230,7 +230,7 @@ class Issue extends Component { | |||
navigation, | |||
} = this.props; | |||
|
|||
const isLoadingData = isPendingComments || isPendingIssue; | |||
const isLoadingData = isPendingComments || isPendingIssue || false; |
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.
I don't think false is needed here. It will only use that value if the other two values are false.
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.
I was actually having problems on that line. For some reason, I was receiving undefined
on both isPendingComments
and isPendingIssue
and the OR of two undefined
is undefined
. That would usually not be an issue because of JS's truthsy falsy, but the refreshing
prop on <FlatList />
requires a boolean
specifically.
Looking over the file again... I am not sure how either of those props can be undefined
. They both come from issueReducer
and they both have default values.
As a solution to this, I can prepend the comparator with !!
to force it to be a boolean
, but that would just be avoiding this undefined
problem I kinda want to get to the root of.
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.
Huh, weird... !!
is probably the best solution for now, but I'm curious what the underlying issue is.
const isLoadingData = !!(isPendingComments || isPendingIssues);
Maybe do something like that for now?
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.
Gotcha, I did that on the latest commit. Thank you!
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.
Great! This decides crash the application when you open the issue.
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.
Huh, I don't think I've seen that issue before
Temporal fix, I still want to figure out why isPendingComments and isPendingIssue are undefined.
I think everything has been addressed now. I can't catch any bugs on the latest commit. Let me know if you see something! |
Alright I'll test it out again in an hour or so! |
@SammyIsra this looks good!!!!!! 🎉 🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉 |
🎉 |
* Added react-native-cli to avoid onboarding issues in the future * Pull down to refresh implemented in profile page * Pull down to refresh implemented in Repository page. Closes #103. * Fixed some merge issues * Fixing some more merging issues * Forgot to add myself as a contributor. * Fetching user data and fetching repository data have been moved into their own functions. * Fixed some merge issues. * Renamed the function that fetches the information to be a bit more descriptive * Again, fixing my own merge issues. Doing it here with code highlight and VSCode yelling at me is easier than on the Github editor. * Fixed some merge issues, _again_ * Added pull to refresh to the non auth profile screen. Other minor improv. * Fixing indentation inside of `<ScrollView />` * Removing extra newline * Adding a newline between our components and vendor components. * Added myself as a contributor. Code and Bug Reports * Valid NPM versions need to include three parts (x.y.z) * Removed the double ScrollView. Parallax can now take in refreshControl. Profile Screen, Repo, and Auth User screen have pull to refresh. * Pull down to refresh now in Issue/PR page (comment list) * Fixed some merging issues and yarn lockfile * Organizations are now refreshable * Better behavior on the AuthUser pull to refresh * Even better experience when refreshing AuthProfile. Now we have a flag when we _have_ a profile * Refreshing on Issues (specifically) works again * Used '!!' instead of '|| false' as per suggestion Temporal fix, I still want to figure out why isPendingComments and isPendingIssue are undefined.
Resolves #103
Pull down to refresh is implemented in both Profile and Repository pages. The diff seems to be more complicated than what the changes actually are (if there is a way to ignore whitespace on the diff this might make it easier to see).
I simply wrapped the views with a
<ScrollView />
with arefreshControl
that dictates the behavior of the app when the menu is pulled down.Because of my onboarding issues, I also added
react-native-cli
as a dev dependency. This is only needed to avoid a bug. Related issue hereFor posterity, here is a demo: