UserLocation passed children not rendered
See original GitHub issueDescribe the bug
Pass a child into UserLocation
isn’t rendered.
To Reproduce I’ve tried several iterations, however I believe this is how the api is supposed to be used? Correct me if I’m wrong:
<MapboxGL.UserLocation
renderMode="custom"
visible
animated
onUpdate={myUserLocationUpdateCallback}
>
<View style={{ height: 10, width: 10, backgroundColor: 'red' }} />
</MapboxGL.UserLocation>
Expected behavior Passed child is rendered
Versions:
- Platfrom: Android
- Device: LG Q7
- OS: Android 8
- React Native Version [0.61.2]
Additional context Maybe I’m supposed to pass it in another way or set other props correctly?
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (8 by maintainers)
Top Results From Across the Web
UserLocation passed children not rendered #511 - GitHub
Pass a child into UserLocation isn't rendered. To Reproduce I've tried several iterations, however I believe this is how the api is supposed...
Read more >Why, in React, do children not re-render when parent ...
Your problem is that you are considering code like function ComponentToRender() { const count = React.useRef(0) React.
Read more >Using React Portals to Render Children Outside the DOM ...
Say we need to render a child element into a React application. Easy right? That child is mounted to the nearest DOM element...
Read more >Slow rendering - Android Developers
UI Rendering is the act of generating a frame from your app and displaying it on the screen. To ensure that a user's...
Read more >How to get user's location with React JS - DEV Community
In this article, we're not going to use any 3rd party library, Just Geolocation API. First, create your react app using this command,....
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
Hey,
native components such as views can’t be passed as children inside the MapView. Only mapbox-gl-native components can.
I’m guessing you want to pass in a symbol layer with an icon or something. If that is the case, you can do something like:
your-icon
needs to be loaded like any other mapbox icon.Just to tie this altogether. I now know why I was not getting the custom icon. The culprit was including this prop:
renderMode={'custom'}
.Basically I was following the old docs which expected ‘custom’. However in the latest version of the library, this makes the userLocation marker simply disappear.
Changing renderMode to ‘normal’ or removing the prop completely solves the problem.
Thank you