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

Can DraggableBounds properties be optional #400

Closed
thomaskbird opened this issue Apr 24, 2019 · 3 comments
Closed

Can DraggableBounds properties be optional #400

thomaskbird opened this issue Apr 24, 2019 · 3 comments

Comments

@thomaskbird
Copy link

Can DraggableBounds left, right, top and bottom be optional? The use case is that I have set axis={"x"} and I would like to limit the dragging to:

bounds={{
   left: -190,
   right: 0
}}

but I can't because the interface is currently:

export interface DraggableBounds {
    left: number
    right: number
    top: number
    bottom: number
}

and I would like it to be:

export interface DraggableBounds {
    left?: number
    right?: number
    top?: number
    bottom?: number
}
@lwolle
Copy link

lwolle commented Feb 24, 2020

Hey there, Is there an answer to this question. Does ReactDraggable expect all props to be passed in, or is it just coincidence that it doesn't throw when some properties of bounds missing.

@grhallenbeck
Copy link

The documentation indicates these are optional arguments, the type definitions should reflect that.

     * Alternatively, pass an object with the following properties, all of which are optional:
     *
     * {left: LEFT_BOUND, right: RIGHT_BOUND, bottom: BOTTOM_BOUND, top: TOP_BOUND}

@STRML
Copy link
Collaborator

STRML commented Apr 16, 2020

Fixed in #473 for both TS & Flow definitions.

@STRML STRML closed this as completed Apr 16, 2020
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

4 participants