question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dynamically change draggable property.

See original GitHub issue

I need to dynamically switch the draggable property.

The case

There are a marker and an infoWindow as custom react components. onMouseDown event on the infoWindow the map’s property draggable has to be false and on onMouseUp becomes true.

Actually, this is not a problem to do. I added to the InfoWindow component function that calls to the parent component (the map) and rerender draggable property changes to the one that I need. If output to the console isDragAllow property at the time of rendering, it is the value that I need.

The Map component looks like that. <GoogleMap draggable={ this.state.isDragAllow }>{ Markers }</GoogleMap>

The problem

Although the value of which I bring to the console such as I need to, in fact, until I move cursor out of the infoWindow remains the possibility of drag. In other words, when onMouseDown fires and till cursor is above the infoWindow isDragAllow is still true.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
itsmichaeldiegocommented, Mar 20, 2018

Haha ok @vilkoalexander! Glad you worked it out! Let me know if you need further help!

0reactions
kylecombescommented, Jul 12, 2019

I’m having the same problem, except that the draggable behavior never seems to change. I’m toggling the value of the prop (successfully) with a button outside of the component, but the map stays draggable even when the prop is false. Is there any way to get the behavior to update?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can you dynamically change the dragged Element in HTML5 ...
Considered Solution1: 1. I wrap the dragged element ('canvas') in a div tag and add 'draggable' true attribute to it. 2. I append...
Read more >
Dynamically Update Positions During Drag Using react ...
Reorder will then change our array based on the result of the drag, and voila! We finish dragging, the array gets reordered and...
Read more >
Draggable Directions | Maps JavaScript API
This example demonstrates the use of the DirectionsService object to fetch directions between draggable markers. Read the documentation.
Read more >
Dynamically Change Component After Drag/Drop-Vue.js
The draggable component emits a change event: change event is triggered when list prop is not null and the corresponding array is altered...
Read more >
Create a Draggable Slider with a Dynamic Number Indicator
Use Variable and Chain to show your slider's dynamically changing ... Select the Knob layer, and in the properties panel, click on Make ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found