-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Fixes ActivityIndicatorIOS doesn't hide initially #8134
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks! |
Can you explain the root cause of the bug? |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
No not really 😞 , I've tried to trace diffs that relate to the ActivityIndicator but couldn't find the real origin. |
I know that calling stopRefreshing too early doesn't work, it's probably a but in UIKit, not sure exactly at what point does it start working but calling if after the first layout does the trick. My only concern is that I think it used to work at some point so I wonder what changed to break this. |
@redmar Do you know if it is broken since a specific version or RN or did it never actually work? |
@janicduplessis ok so this took me some time but I did a manual bisect of all the commits between 0.26 (good) and 0.27.0-rc (bad). I can pinpoint the bug to one specific commit now, even to 3 lines in that commit that enable it: The commit where the bug is introduced is: fe5c0d2 and the 'offending' lines that enable the visibility of the ActivityIndicator while it should be hidden are: react-native/React/Modules/RCTUIManager.m Lines 643 to 645 in fe5c0d2
when i comment those lines out everything is working fine. |
Great job finding out the commit that broke this! @rigdern Any idea on the best way to fix this? |
@redmar thanks for tracking that down. I think what is happening is that when the ActivityIndicator is stopped (which is its default state), it also internally sets actualActivityIndicator.hidden = shadowView.hidden // YES These are three possible solutions:
Maybe there are more ideas but those are the ones I have. |
@ide I think I got your first point working but without the catch of not being able to never display a stopped ActivityIndicator. See added commit. Tested this on the test case and it seems to work 😄 edit: whoopsie a bit too fast, forgot to add the old animating custom view property code. Now back. |
@redmar What if |
AFAIK it all works as expected in these cases. Current patched behaviour is now that when the 'offending' code (seen here react-native/React/Modules/RCTUIManager.m Lines 643 to 645 in fe5c0d2
All other interaction with the control is delegated to super so should still work as intended. |
@janicduplessis have you tried this already? For me this doesn't seem to work, but maybe i'm doing something wrong. (used master, reproduced existing bug, and then applied your suggestion but i don't see any changes while i can confirm the code was really changed). a possible reason for wanting to use the current patch (which now is only a couple of lines) is that it's an iOS bug only AFAIK so the fix also belongs to the iOS layer/space. But I'm pretty new to this repo so I'm not up to date yet with any policies about where to apply fixes or priority between JS or obj-c space. 😃 |
@@ -23,13 +23,30 @@ @implementation RCTConvert (UIActivityIndicatorView) | |||
|
|||
@end | |||
|
|||
@interface RCTActivityIndicatorView : UIActivityIndicatorView |
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.
Let's move this to it's own file for consistency with other views / view managers.
Ok let's do it this way. It doesn't fix the root issue of showing a view that is hidden initialy but I think this is so specific that activityindicator is the only control that this can cause an issue so fixing it here is fine. |
@janicduplessis committed changes based on your comments, hopefully i've done it all in the correct way. (changing and seeing the diff from those .pbxproj files always feels weird) |
Thanks @redmar! Sorry for the delay, looks good, lets ship this. @facebook-github-bot shipit |
Thanks for importing. If you are an FB employee go to Phabricator to review. |
a589985
How do I get this fix? |
It's not yet in v0.29.0-rc.0 AFAIK so you have to wait on the next rc but you can use it now by using master temporarily in your package.json with the following:
Don't forget to run an |
It should be in the final 0.29 release but it is not in the current 0.29rc. |
Summary: I used the reproducible steps as described in origin bug ticket facebook#7987 as test plan. This has the same contents as PR facebook#8130 but then against master per janicduplessis request. Closes facebook#8134 Differential Revision: D3491126 fbshipit-source-id: a22669dc998f82b36fbe31d882d0a29f0912e2ee
Summary: I used the reproducible steps as described in origin bug ticket facebook#7987 as test plan. This has the same contents as PR facebook#8130 but then against master per janicduplessis request. Closes facebook#8134 Differential Revision: D3491126 fbshipit-source-id: a22669dc998f82b36fbe31d882d0a29f0912e2ee
I used the reproducible steps as described in origin bug ticket #7987 as test plan.
This has the same contents as PR #8130 but then against master per @janicduplessis request.