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

Generating RLayerVector objects outside of RMap #8

Open
sl1g18 opened this issue Jul 26, 2021 · 2 comments
Open

Generating RLayerVector objects outside of RMap #8

sl1g18 opened this issue Jul 26, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@sl1g18
Copy link

sl1g18 commented Jul 26, 2021

Hello,
I am using this library in a React app where I am required to create components outside of my the RMap object. Is there any way, using RContext maybe, to generate RLayerVector objects outside of RMap and pass them in as children using the spread operator?

@mmomtchev mmomtchev added the enhancement New feature or request label Jul 27, 2021
@mmomtchev
Copy link
Owner

Currently, an RLayerVectordoes not support being detached and reattached to another RMap- this is the missing feature

@ngrhadi
Copy link

ngrhadi commented Jun 16, 2022

I think you need useRef for each RLayerVector in parent component, i'm working on that also, but the problem is when using RControl.Rlayer and you put RLayerVector inside or outside there with custom event handler yourself it's not work, I have code like this.

on parent component

const vector1 = useRef()
<RMap>
   <RLayerVector vector1Ref={vector1}/>
</RMap>

and then on your child component define ref on RLayerVector, and also mostly you can see that ref console.log(props.vector1Ref)

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

No branches or pull requests

3 participants