Black flicker when opening map on Android
See original GitHub issueDescribe the bug On android when loading the map there is a black flicker when rendering a MapView. You can see this visually on the gif below
To Reproduce Reproduction code:
export class MapComponent extends Component {
constructor() {
super()
this.state = {
mapIsVisible: false
}
}
showMap = () => {
this.setState({ mapIsVisible: !this.state.mapIsVisible })
}
render() {
return (
<View style={{ flex: 1, backgroundColor: "red" }}>
<TouchableOpacity style={{ backgroundColor: "green", alignItems: "center", justifyContent: "center", height: 50, width: '100%' }} onPress={this.showMap}>
<Text>{this.state.mapIsVisible ? "Hide Map" : "Show Map"}</Text>
</TouchableOpacity>
{this.state.mapIsVisible ?
<MapboxGL.MapView
style={{ flex: 1, }}
zoomLevel={11}
showsMyLocationButton={true}
animated={false}
>
<MapboxGL.Camera
animationDuration={10}
animated={false}
zoomLevel={11}
centerCoordinate={[23.73153880, 37.99280960]}
>
<MapboxGL.UserLocation visible={true} />
</MapboxGL.Camera>
</MapboxGL.MapView>
: null}</View>
)
}
}
Expected behavior No black flickering as it degrades the user experience (edited)
Screenshots
Versions (please complete the following information):
- Platfrom: Android
- Device: [Nexus 5X simulator, Pocophone F1]
- OS: [Android 9 , Android 10]
- SDK Version [28,29]
- React Native Version [0.60.4, 0.61.3]
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:13 (5 by maintainers)
Top Results From Across the Web
Black flicker when opening map on Android #617 - GitHub
It's the initial map view without the tiles being loaded in. I guess, that's just the way it is ♂ . You can...
Read more >Google Maps V2 black screen flicker when adding or removing it
After loading the map i.e. you will get to know in onActivityCreated() of the map fragment. You should call the following method
Read more >Why is my phone flickering and having issues when i go to ...
The issue is that when Google Maps is navigating and i try go to another app, the app viewer or the home screen,...
Read more >How to Fix Screen Flickering on Android - Lifewire
Stop your Android screen from flickering or acting glitchy. Try these steps to diagnose, troubleshoot, and repair a flickering display.
Read more >Google Maps causing screen flickering in latest update
When updating too the latest Google Maps version, my screen flickering pretty bad. Is anybody else having this issue or is this time...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@psusmars I just had to ensure that the coloured overlay was in fact rendering above the map before it disappeared, instead of under it (which would have no effect). Maybe make it bright pink while you’re figuring the absolute ordering out to get it on top (i.e. zIndex and order of absolutely positioned components).
It’s a known issue: https://github.com/mapbox/mapbox-gl-native/issues/10990
We could expose
foregroundLoadColor
to react-native to reduce this artifact:https://docs.mapbox.com/android/api/map-sdk/8.6.1/com/mapbox/mapboxsdk/maps/MapboxMapOptions.html#foregroundLoadColor-int-