Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DroppableScreen<SS>

DroppableScreen represents a preview screen and renders all regions contained within that screen and allows the user to drop elements onto it via drag and drop. A callback then returns the ID of the region that the component has been dropped on. The screen information is passed in through the screenInfo prop. The screen can render at an arbitray size, determined by * the props width and height. Though both are optional, at least one of * them must be defined, otherwise the component does not render anything.

This component also defines a callback assignElementToRegion, which is invoked whenever an element is dropped over a screen region. The callback receives the id of the component as well as the id of the region as params.

param

An object containing data associated with a preview screen

param

The width of the rendered screen. Optional

param

The height of the rendered screen. Optional

param

Callback to assign a component dropped on screen to a region. Optional

Type parameters

  • SS

Hierarchy

Index

Constructors

constructor

  • Parameters

    Returns DroppableScreen

Properties

context

context: any

props

props: Readonly<object> & Readonly<DroppableScreenProps>

refs

refs: object

Type declaration

  • [key: string]: ReactInstance

state

state: Readonly<__type>

Methods

Optional UNSAFE_componentWillMount

  • UNSAFE_componentWillMount(): void

Optional UNSAFE_componentWillReceiveProps

  • UNSAFE_componentWillReceiveProps(nextProps: Readonly<DroppableScreenProps>, nextContext: any): void

Optional UNSAFE_componentWillUpdate

  • UNSAFE_componentWillUpdate(nextProps: Readonly<DroppableScreenProps>, nextState: Readonly<__type>, nextContext: any): void

Optional componentDidCatch

  • componentDidCatch(error: Error, errorInfo: ErrorInfo): void
  • Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.

    Parameters

    • error: Error
    • errorInfo: ErrorInfo

    Returns void

Optional componentDidMount

  • componentDidMount(): void
  • Called immediately after a compoment is mounted. Setting state here will trigger re-rendering.

    Returns void

Optional componentDidUpdate

  • componentDidUpdate(prevProps: Readonly<DroppableScreenProps>, prevState: Readonly<__type>, snapshot?: SS): void
  • Called immediately after updating occurs. Not called for the initial render.

    The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.

    Parameters

    Returns void

Optional componentWillMount

  • componentWillMount(): void

Optional componentWillReceiveProps

Optional componentWillUnmount

  • componentWillUnmount(): void
  • Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as cancelled network requests, or cleaning up any DOM elements created in componentDidMount.

    Returns void

Optional componentWillUpdate

  • componentWillUpdate(nextProps: Readonly<DroppableScreenProps>, nextState: Readonly<__type>, nextContext: any): void

forceUpdate

  • forceUpdate(callBack?: undefined | function): void
  • Parameters

    • Optional callBack: undefined | function

    Returns void

Private getDropRegion

  • getDropRegion(x: number, y: number): ScreenRegion | undefined
  • Returns the topmost region which contains the point [x, y], or undefined if no such region can be found

    Parameters

    • x: number

      X coordinate of the drop location

    • y: number

      Y coordinate of the drop location

    Returns ScreenRegion | undefined

    The region which contains [x, y]

Optional getSnapshotBeforeUpdate

  • getSnapshotBeforeUpdate(prevProps: Readonly<DroppableScreenProps>, prevState: Readonly<__type>): SS | null
  • Runs before React applies the result of render to the document, and returns an object to be given to componentDidUpdate. Useful for saving things such as scroll position before render causes changes to it.

    Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.

    Parameters

    Returns SS | null

Private onComponentDropped

  • onComponentDropped(componentId: string, x: number, y: number): void
  • Callback invoked when an element has been dropped over a screen region.

    Parameters

    • componentId: string

      ID of the component which has been dropped

    • x: number

      X coordinate of the drop location

    • y: number

      Y coordinate of the drop location

    Returns void

render

  • render(): null | Element
  • Renders the component.

    Returns null | Element

setState

  • setState<K>(state: function | null | S | object, callback?: undefined | function): void
  • Type parameters

    • K: keyof __type

    Parameters

    • state: function | null | S | object
    • Optional callback: undefined | function

    Returns void

Optional shouldComponentUpdate

  • shouldComponentUpdate(nextProps: Readonly<DroppableScreenProps>, nextState: Readonly<__type>, nextContext: any): boolean
  • Called to determine whether the change in props and state should trigger a re-render.

    Component always returns true. PureComponent implements a shallow comparison on props and state and returns true if any props or states have changed.

    If false is returned, Component#render, componentWillUpdate and componentDidUpdate will not be called.

    Parameters

    Returns boolean

Generated using TypeDoc