Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

centerCoordinate not work #20

Open
shayan1998 opened this issue Oct 4, 2020 · 9 comments
Open

centerCoordinate not work #20

shayan1998 opened this issue Oct 4, 2020 · 9 comments

Comments

@shayan1998
Copy link

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
Copy link
Member

ReyhaneMasumi commented Oct 4, 2020

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
Copy link
Author

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
Copy link
Member

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

@shayan1998
Copy link
Author

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
Copy link
Member

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
Copy link
Author

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
Copy link
Member

ReyhaneMasumi commented Oct 5, 2020

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
Copy link
Author

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
Copy link
Member

ReyhaneMasumi commented Oct 10, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants