- SpaceProps
- className
- id
- innerDivClassName
- innerDivStyle
- onCreate
- onDecideHowToHandlePress
- onHover
- onContextMenu
- onUpdated
- pollForElementResizing
- style
- treatTwoFingerTrackPadGesturesLikeTouch
• className? : undefined | string
Optional CSS class to use on the outer div
that the Space renders.
• id? : undefined | string
Optional id to use on the outer div
that the Space renders.
• innerDivClassName? : undefined | string
DEPRECATED Optional CSS class to use on the inner div
that the Space scales and
transforms.
This is deprecated and may be removed at some point. Some styles may mess up the CSS transforms applied to the inner div so it is safer to avoid this and style your children a different way.
• innerDivStyle? : React.CSSProperties
DEPRECATED Optional styles class to use on the inner div
that the Space scales
and transforms.
This is deprecated and may be removed at some point. Some styles may mess up the CSS transforms applied to the inner div so it is safer to avoid this and style your children a different way.
• onCreate? : undefined | function
Called when the Space
first creates the outer div
and sets up the
ViewPort, but before the inner div
and the Space
's children have
been rendered. This can be used, for example, to make the
ViewPort focus on a certain portion of the virtual space.
• onDecideHowToHandlePress? : DecidePressHandlingCallback
Optional callback to be called when a press is initiated in the space.
Generally you should prefer to use Pressable to handle presses, but
this can be used as a lower level alternative. The result of the callback
is a PressHandlingOptions (or undefined
) that describes how the
press should be handled.
If the callback returns a PressHandlingOptions it will take precedence over Pressable and NoPanArea components (even if the press was on one of those).
• onHover? : undefined | function
Called when a mouse hover event happens anywhere in the Space.
• onContextMenu? : undefined | function
Called when a right click event happens anywhere in the Space.
returns
Whether to prevent (true
) a Pressable from also handling
this event (if it was also the target).
• onUpdated? : undefined | function
Called whenever the ViewPort is updated.
• pollForElementResizing? : undefined | false | true
If set, the Space
will poll every 500ms for changes to its parent element's size. This only has to be used if the
parent element can resize for reasons other than the window resizing, and if the updateSize is not used.
• style? : React.CSSProperties
Optional styles to set on the outer div
that the Space renders.
• treatTwoFingerTrackPadGesturesLikeTouch? : undefined | boolean
By default two finger trackpad gestures are always handled as a zoom in/zoom out, like with Google Maps. If this is set to true, then only pinch/spread gestures will be handled like that, and pan style two finger gestures will be handled as a pan.
However, this will cause mouse wheel interactions to behave like vertical panning rather than zoom in/zoom out. There is sadly no great way around this, but there are some techniques you can use to guess whether the user is using a mouse or a trackpad.
Note that this prop is only read during initial mounting. Updates will be ignored.