Let onVisibilityChanged() be called on children (mainly fixes Image issues)#2478
Conversation
|
LGTM @alvelig 🐽 |
|
Nice catch. I'll need to analyze that thoroughly, but overall LGTM. |
|
@danielgindi @alvelig can you investigate #2478 (comment) please? |
|
Yes, it’s an addition for RN 0.57, I just noticed that it’s a new feature. The other clipping code should do it’s best to avoid unnecessary drawing. Is there a way to enclose that specific line for > 0.57 only? |
|
@rborn I mean putting In the worst case we could just omit that line. I took it as a precaution in case RN takes over the clipping stuff, so worst case it will be slower when rendering to the bitmap. |
|
my java-fu sucks, @alvelig might be able to help maybe |
|
So we should wait for his feedback before doing a release... In anyway - the current situation is that 0.57 is the first to come with |
|
Okay so I just made the same mistake as the guys over there: Android's clipping affects children's overflow, not the parent's. |
|
@danielgindi just make it a string until we move definitely to 0.57 See this change: facebook/react-native@cfce6ee#diff-b26c3186930f561d80acdc8f0dde5dec |
|
Oh yeah. I misread their errors here, thought that |
|
Fixed in 710dca4 |
* upstream/master: (28 commits) Calculate bounding box from region (react-native-maps#2615) [iOS GoogleMap] Fix animateCamera (react-native-maps#2608) Fix type definition error (react-native-maps#2607) [Android] Fix app crash in Android if building found but cannot getActiveLevelIndex (react-native-maps#2598) Provide a camera system (react-native-maps#2563) Get visible map bounding box (react-native-maps#2571) [0.22.1] Release (react-native-maps#2574) Move dev only deps to devDependencies. (react-native-maps#2548) Specify how to use Google Maps (react-native-maps#2550) r2507: remove marker: Attempt to invoke virtual method 'void com.google.android.gms.maps.model.setIcon(com.google.android.gms.maps.model.BitmapDescription)' on a null object reference #: remove marker: Attempt to invoke virtual method 'void com.google.android.gms.maps.model.setIcon(com.google.android.gms.maps.model.BitmapDescription)' on a null object reference (react-native-maps#2555) update to clarify cacheEnabled is apple maps only [0.22.0] Release (react-native-maps#2535) Fix for “The specified child already has a parent” Improve installation docs (react-native-maps#2541) fix fitToSuppliedMarkers function (react-native-maps#2524) Performance improvements for tracksViewChanges (react-native-maps#2487) fix spelling mistakes Added flag to make sure that there has an Observer of view. hotfix PR react-native-maps#2478 Fix a peer dependencies warning ...
…VisibilityChanged Let onVisibilityChanged() be called on children (mainly fixes Image issues)
Does any other open PR do the same thing?
Nope.
What issue is this PR fixing?
This is related to the following issues:
#1870 #2105 #2048
The REAL problem with displaying images inside the markers in Android, is not a bug in Fresco as claimed in some issues. It's that Fresco depends on the
onVisibilityChanged(...)event to be called. And that's a protected method. And is propagated bydispatchVisibilityChanged(...)to the whole subview hierarchy.dispatchVisibilityChangedis protected too. And it depends onmAttachInfoetc.So fiddling with Reflection is not an option as it counts on too many private stuff to not change in Android's core.
The solution I propose here is having a semi-invisible ViewGroup and add the markers' views to it, so it is properly "visible".
I'm calling it semi-invisible because setting visibility to INVISIBLE/GONE will again prevent the subviews from getting visibility events. What I did is set it to zero size, offscreen, clipping, and 0 opacity. So basically doing everything to avoid it trying to draw, but letting the events pass through.
For me, this fixes the issue - together with #2477
How did you test this PR?
Real life project with animatable Markers.