How is your experience with the OutSystems Community?
7
Views
2
Comments
Solved
Leafletmap on mobile doesn't display correctly [ODC]
Question
Application Type
Mobile

Hi, I have tried to insert the leaftmap block on a mobile screen, ma it doesn't seem to work:

That's the result :




2024-01-31 05-29-41
Akshay Deshpande
Solution

Hello 


You can reply with:

This usually happens when the Leaflet Map is rendered inside a container without a fixed/visible height during initialization. 

Try these checks: 
Give the parent Container a fixed height (Height: 100vh or explicit px value). 
Avoid rendering the map inside hidden tabs/containers on screen load. 
Trigger a map refresh after screen rendering (InvalidateMap / redraw). 
Check if any parent container uses display:flex without proper height propagation. 
On Mobile Apps, test on device — preview/emulator sometimes renders Leaflet incorrectly. 

Also verify: 
Leaflet CSS/JS dependencies are loaded correctly. No overflow/position CSS from Silk/UI custom theme is clipping the map.

This is a common Leaflet rendering behavior in OutSystems when the map initializes before the container gets its final dimensions.


hope this will helps you.

Thanks and Regards,
Akshay Deshpande

2024-02-07 07-35-05
Alessandro Bognetti
Solution

Hi, thank you for your feedback. Here are the answers to your points:

  • Give the parent Container a fixed height (Height: 100vh or explicit px value). -> even with a fixed weight, the problem occurs
  • Avoid rendering the map inside hidden tabs/containers on screen load. -> the map was not loaded on hidden tab/containers
  • Trigger a map refresh after screen rendering (InvalidateMap / redraw). -> I didn't find such a client action to invalidate the map or redraw
  • Check if any parent container uses display:flex without proper height propagation.  -> it was placed in the main content of the standard Outsystems Mobile layout
  • On Mobile Apps, test on device — preview/emulator sometimes renders Leaflet incorrectly.  _> the problem occurs also on device

You said that : "This is a common Leaflet rendering behavior in OutSystems when the map initializes before the container gets its final dimensions."

this is a good point. I've solved the problem by putting the map inside a If block and loading the map only after the data has fetched:


I hope this helps



2024-01-31 05-29-41
Akshay Deshpande
Solution

Hello 


You can reply with:

This usually happens when the Leaflet Map is rendered inside a container without a fixed/visible height during initialization. 

Try these checks: 
Give the parent Container a fixed height (Height: 100vh or explicit px value). 
Avoid rendering the map inside hidden tabs/containers on screen load. 
Trigger a map refresh after screen rendering (InvalidateMap / redraw). 
Check if any parent container uses display:flex without proper height propagation. 
On Mobile Apps, test on device — preview/emulator sometimes renders Leaflet incorrectly. 

Also verify: 
Leaflet CSS/JS dependencies are loaded correctly. No overflow/position CSS from Silk/UI custom theme is clipping the map.

This is a common Leaflet rendering behavior in OutSystems when the map initializes before the container gets its final dimensions.


hope this will helps you.

Thanks and Regards,
Akshay Deshpande

2024-02-07 07-35-05
Alessandro Bognetti
Solution

Hi, thank you for your feedback. Here are the answers to your points:

  • Give the parent Container a fixed height (Height: 100vh or explicit px value). -> even with a fixed weight, the problem occurs
  • Avoid rendering the map inside hidden tabs/containers on screen load. -> the map was not loaded on hidden tab/containers
  • Trigger a map refresh after screen rendering (InvalidateMap / redraw). -> I didn't find such a client action to invalidate the map or redraw
  • Check if any parent container uses display:flex without proper height propagation.  -> it was placed in the main content of the standard Outsystems Mobile layout
  • On Mobile Apps, test on device — preview/emulator sometimes renders Leaflet incorrectly.  _> the problem occurs also on device

You said that : "This is a common Leaflet rendering behavior in OutSystems when the map initializes before the container gets its final dimensions."

this is a good point. I've solved the problem by putting the map inside a If block and loading the map only after the data has fetched:


I hope this helps



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.