Class Layoutmanager<TNative>Abstract

Since

3.0.2 Layout calculation class for GridView. It behaves iOS’s UICollectionViewFlowLayout and Android’s StaggeredGridLayout.

spanCount and scrollDirection are 2 important parameters of this class.

If user sets scrollDirection to “vertical”, spanCount represents count of colons. For example; scrollDirection: vertical, spanCount: 2 means user can scroll vertically, object has 2 colons and width property of items are fixed numbers depends on colon count. If user sets scrollDirection to “horizontal”, spanCount represents count of rows. For example; scrollDirection: horizontal, spanCount : 2 means user can scroll horizontally, object has 2 rows and height property of items are fixed numbers depends on row count

Example

var layoutManager = new LayoutManager({
spanCount: 2,
scrollDirection: LayoutManager.ScrollDirection.VERTICAL
});

Type Parameters

  • TNative = any

Hierarchy

Implements

Properties

_nativeObject: any
ScrollDirection: typeof ScrollDirection

Accessors

  • get nativeObject(): any
  • Returns any

  • set nativeObject(value: any): void
  • Parameters

    • value: any

    Returns void

  • get ios(): TProps["ios"]
  • Returns TProps["ios"]

  • get android(): TProps["android"]
  • Returns TProps["android"]

  • get itemSpacing(): number
  • Returns number

  • set itemSpacing(value: number): void
  • Parameters

    • value: number

    Returns void

  • get lineSpacing(): number
  • Returns number

  • set lineSpacing(value: number): void
  • Parameters

    • value: number

    Returns void

  • get spanCount(): number
  • Gets/sets colon or row count depends on scrolling direction of layout. If vertical it represents colon, if horizontal it represent row count.

    Property

    = 1]

    Android

    Ios

    Since

    3.0.2

    Returns number

  • set spanCount(value: number): void
  • Gets/sets colon or row count depends on scrolling direction of layout. If vertical it represents colon, if horizontal it represent row count.

    Property

    = 1]

    Android

    Ios

    Since

    3.0.2

    Parameters

    • value: number

    Returns void

  • get contentInset(): Boundary
  • Gets/sets the custom distance that the content view is inset from the scroll view edges.

    Property

    = {top:0, left:0, bottom:0, right:0}]

    Android

    Ios

    Since

    3.0.2

    Returns Boundary

  • set contentInset(value: Boundary): void
  • Gets/sets the custom distance that the content view is inset from the scroll view edges.

    Property

    = {top:0, left:0, bottom:0, right:0}]

    Android

    Ios

    Since

    3.0.2

    Parameters

    Returns void

  • get onFullSpan(): null | ((type: number) => number)
  • This event used to define specified gridview item to fully occupy width/height based on direction. According to direction return value must be either desired height or width of gridview item. If the direction is UI.LayoutManager.ScrollDirection#VERTICAL VERTICAL then return value must be height or vice versa. Returning undefined indicates that the gridview item will not modified.

    onFullSpan

    Android

    Ios

    Since

    4.0.1

    Example

    import LayoutManager from '@smartface/native/ui/layoutmanager';

    const layoutManager = new LayoutManager();
    layoutManager.on(LayoutManager.Events.FullSpan, (params) => {
    console.info('onFullSpan', params);
    });

    Returns null | ((type: number) => number)

  • set onFullSpan(value: null | ((type: number) => number)): void
  • This event used to define specified gridview item to fully occupy width/height based on direction. According to direction return value must be either desired height or width of gridview item. If the direction is UI.LayoutManager.ScrollDirection#VERTICAL VERTICAL then return value must be height or vice versa. Returning undefined indicates that the gridview item will not modified.

    onFullSpan

    Android

    Ios

    Since

    4.0.1

    Example

    import LayoutManager from '@smartface/native/ui/layoutmanager';

    const layoutManager = new LayoutManager();
    layoutManager.on(LayoutManager.Events.FullSpan, (params) => {
    console.info('onFullSpan', params);
    });

    Parameters

    • value: null | ((type: number) => number)

    Returns void

  • get onItemLength(): null | ((length: number) => number)
  • User must return a length value for scrollDirection that user lays out the objects. If vertical, length value will be height of item. If horizontal, length value will be width of item.

    onItemLength

    Android

    Ios

    Since

    3.0.2

    Example

    import LayoutManager from '@smartface/native/ui/layoutmanager';

    const layoutManager = new LayoutManager();
    layoutManager.on(LayoutManager.Events.ItemLength, (params) => {
    console.info('onItemLength', params);
    });

    Returns null | ((length: number) => number)

  • set onItemLength(value: null | ((length: number) => number)): void
  • User must return a length value for scrollDirection that user lays out the objects. If vertical, length value will be height of item. If horizontal, length value will be width of item.

    onItemLength

    Android

    Ios

    Since

    3.0.2

    Example

    import LayoutManager from '@smartface/native/ui/layoutmanager';

    const layoutManager = new LayoutManager();
    layoutManager.on(LayoutManager.Events.ItemLength, (params) => {
    console.info('onItemLength', params);
    });

    Parameters

    • value: null | ((length: number) => number)

    Returns void

Methods

  • Executed before everything. This should return nativeObject since it will be assinged directly to nativeObject.

    Parameters

    • Optional params: Partial<Record<string, any>>

    Returns any

  • Parameters

    • Optional params: Partial<Record<string, any>>

    Returns void

  • Parameters

    • props: Partial<{ [key: string]: any }>

    Returns void

  • Parameters

    • props: Partial<{ [key: string]: any }>

    Returns void

Constructors

  • Type Parameters

    • TNative = any

    Parameters

    Returns Layoutmanager<TNative>

Generated using TypeDoc