map-ir/mapir-react-native-sdk

centerCoordinate not work

shayan1998 opened this issue ยท 9 comments

hi
I'm using react native 62 with this library the maps work but when i change centerCoordinate={[51.422548, 35.732573]} to my place nothing change!!!
any body had idea what's wrong?
I'm exactly using the sample code

Hi!
Maybe it's better to use Mapir.Camera component to set view of the map.
Here is an example:

<Mapir
          apiKey={'Your_api_key'}
          onRegionDidChange={(e) => onRegionDidChange(e)}
          style={styles.container}>
          <Mapir.Camera
            zoomLevel={13}
            centerCoordinate={[51.422548, 35.732573]}
          />
        </Mapir>

thank you, that's solve my problem
but still have some question
1.i have the same problem with map.ir vue js library and the center prop doesn't change the map location!!!
did you know how can i solve that?!
2.I tried to access the map functions through ref but nothing get
this is my ref :
600
and when i call any function i got this error :
601

please open an issue in mapir-vue repository or contact support group

sorry the mapir-vue repo don't have a issue section?!!!
and my second question was for this repo?

Hi, sorry for the trouble. I enabled the issue section for mapir-vue repo, you can ask there now.
and your second question is also related to vue, isn't it?

Hi, sorry for the trouble. I enabled the issue section for mapir-vue repo, you can ask there now.
and your second question is also related to vue, isn't it?

Thanks for your support. no my second question related to react native library!

It's normal. You should first define a ref by useRef() and then set ref props in the Mapir component in this way:

let map_ref = useRef()
...
<Mapir
ref={(ref) => map_ref = ref}
...
/>

It's normal. You should first define a ref by useRef() and then set ref props in the Mapir component in this way:

let map_ref = useRef()
...
<Mapir
ref={(ref) => map_ref = ref}
...
/>

yes I'm exactly doing this but still on map reference can't access to function like 'getPointInView' or 'getCoordinateFromView' ...
Other things works fine

It's normal. You should first define a ref by useRef() and then set ref props in the Mapir component in this way:

let map_ref = useRef()
...
<Mapir
ref={(ref) => map_ref = ref}
...
/>

yes I'm exactly doing this but still on map reference can't access to function like 'getPointInView' or 'getCoordinateFromView' ...
Other things works fine

Here is an example for 'getPointInView'.