map-ir / mapir-react-native-sdk

MIT License
14 stars 3 forks source link

centerCoordinate not work #20

Open shayan1998 opened 4 years ago

shayan1998 commented 4 years ago

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

ReyhaneMasumi commented 4 years ago

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>
shayan1998 commented 4 years ago

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

ReyhaneMasumi commented 4 years ago

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

shayan1998 commented 4 years ago

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?

mhsattarian commented 4 years ago

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?

shayan1998 commented 4 years ago

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!

ReyhaneMasumi commented 4 years ago

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}
...
/>
shayan1998 commented 4 years ago

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

ReyhaneMasumi commented 4 years ago

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'.