@@ -27,6 +27,7 @@ import {
2727 type Circle ,
2828 type Polyline ,
2929 type Polygon ,
30+ type Padding ,
3031} from '@googlemaps/react-native-navigation-sdk' ;
3132
3233export interface MapControlsProps {
@@ -41,6 +42,12 @@ const MapsControls: React.FC<MapControlsProps> = ({ mapViewController }) => {
4142 const [ enableLocationMarker , setEnableLocationMarker ] = useState ( true ) ;
4243 const [ latitude , onLatChanged ] = useState ( '' ) ;
4344 const [ longitude , onLngChanged ] = useState ( '' ) ;
45+ const [ padding , setPadding ] = useState < Padding > ( {
46+ top : 0 ,
47+ bottom : 0 ,
48+ left : 0 ,
49+ right : 0 ,
50+ } ) ;
4451
4552 useEffect ( ( ) => {
4653 if ( zoom !== null ) {
@@ -195,6 +202,12 @@ const MapsControls: React.FC<MapControlsProps> = ({ mapViewController }) => {
195202 mapViewController . clearMapView ( ) ;
196203 } ;
197204
205+ const onPaddingChanged = ( edge : keyof typeof padding , value : string ) => {
206+ const updatedPadding : Padding = { ...padding , [ edge ] : Number ( value ) } ;
207+ setPadding ( updatedPadding ) ;
208+ mapViewController . setPadding ( updatedPadding ) ;
209+ } ;
210+
198211 return (
199212 < View >
200213 < TextInput
@@ -280,6 +293,47 @@ const MapsControls: React.FC<MapControlsProps> = ({ mapViewController }) => {
280293 dropdownStyle = { styles . dropdownMenuStyle }
281294 />
282295 </ View >
296+ < View style = { styles . controlButtonGap } />
297+ < View style = { styles . rowContainer } >
298+ < Text > Top padding</ Text >
299+ < TextInput
300+ style = { styles . input }
301+ onChangeText = { value => onPaddingChanged ( 'top' , value ) }
302+ value = { padding . top ?. toFixed ( 0 ) }
303+ keyboardType = "numeric"
304+ inputMode = "numeric"
305+ />
306+ </ View >
307+ < View style = { styles . rowContainer } >
308+ < Text > Bottom padding</ Text >
309+ < TextInput
310+ style = { styles . input }
311+ onChangeText = { value => onPaddingChanged ( 'bottom' , value ) }
312+ value = { padding . bottom ?. toFixed ( 0 ) }
313+ keyboardType = "numeric"
314+ inputMode = "numeric"
315+ />
316+ </ View >
317+ < View style = { styles . rowContainer } >
318+ < Text > Left padding</ Text >
319+ < TextInput
320+ style = { styles . input }
321+ onChangeText = { value => onPaddingChanged ( 'left' , value ) }
322+ value = { padding . left ?. toFixed ( 0 ) }
323+ keyboardType = "numeric"
324+ inputMode = "numeric"
325+ />
326+ </ View >
327+ < View style = { styles . rowContainer } >
328+ < Text > Right padding</ Text >
329+ < TextInput
330+ style = { styles . input }
331+ onChangeText = { value => onPaddingChanged ( 'right' , value ) }
332+ value = { padding . right ?. toFixed ( 0 ) }
333+ keyboardType = "numeric"
334+ inputMode = "numeric"
335+ />
336+ </ View >
283337 </ View >
284338 ) ;
285339} ;
0 commit comments