Since

3.1.3

This class provides an easy way to add a shimmer effect to any view. It is useful as an unobtrusive loading indicator.

Example

import FlexLayout from '@smartface/native/ui/flexlayout';
import Color from '@smartface/native/ui/color';

const flex = new FlexLayout();
flex.flexGrow = 1;
flex.flexDirection = FlexLayout.FlexDirection.ROW;
var flexImage = new FlexLayout();
flexImage.flexGrow = 0.5;
flexImage.margin = 20;
flexImage.marginRight = 10;
flexImage.borderRadius = 10;
flexImage.backgroundColor = Color.LIGHTGRAY;

flex.addChild(flexImage);

const flexLabels = new FlexLayout();
flexLabels.flexGrow = 1;

const labelTop = new FlexLayout();
labelTop.height = 20;
labelTop.margin = 20;
labelTop.marginBottom = 10;
labelTop.borderRadius = 10;
labelTop.backgroundColor = Color.LIGHTGRAY;
flexLabels.addChild(labelTop);

const labelCenter = new FlexLayout();
labelCenter.height = 20;
labelCenter.margin = 20;
labelCenter.marginTop = 0;
labelCenter.borderRadius = 10;
labelCenter.marginRight = 100;
labelCenter.backgroundColor = Color.LIGHTGRAY;
flexLabels.addChild(labelCenter);

const labelBottom = new FlexLayout();
labelBottom.positionType = FlexLayout.PositionType.ABSOLUTE;
labelBottom.bottom = 20;
labelBottom.left = 20;
labelBottom.height = 20;
labelBottom.right = 40;
labelBottom.borderRadius = 10;
labelBottom.backgroundColor = Color.LIGHTGRAY;

flexLabels.addChild(labelBottom);

flex.addChild(flexLabels);

const shimmer = new ShimmerFlexLayout();
shimmer.height = 200;

shimmer.ios.animationAlpha = 0.2;
shimmer.baseAlpha = 0.5;
shimmer.pauseDuration = 500;
shimmer.android.highlightAlpha = 1;

shimmer.android.build(ShimmerFlexLayout.Android.Shimmer.AlphaHighlight);
shimmer.contentLayout = flex
myPage.layout.addChild(shimmer);
shimmer.startShimmering();

Hierarchy

Methods

  • Builds the shimmer based on your assigned properties by given UI.ShimmerFlexLayout.Android.Shimmer. This method must be used after all other propertis of ShimmerFlexLayout is assigned.

    Method

    build

    Android

    Since

    3.1.3

    Parameters

    Returns void

Properties

duration: number

Sets the animation duration.

Property

Android

Since

3.1.3

intensity: number

Controls the brightness of the highlight at the center.

Property

= 0]

Android

Since

3.1.3

repeatCount: number

Set animation repeat count.

Property

Android

Since

3.1.3

tilt: number

Angle at which the highlight is tilted, measured in degrees.

Property

= 20]

Android

Since

3.1.3

highlightColor: IColor

Set the shimmer's highlight color. This property must be used if given shimmer type is UI.ShimmerFlexLayout.Android.Shimmer.ColorHighlight

Property

Android

Since

3.1.3

baseColor: IColor

Set base color of content. This property must be used if given shimmer type is UI.ShimmerFlexLayout.Android.Shimmer.ColorHighlight

Property

Android

Since

3.1.3

highlightAlpha: IColor

Set the alpha of the shimmer highlight.

Property

Android

Since

3.1.3

yogaNode: any
overScrollMode: number

Gets/sets over-scroll mode for this view.

Property

= UI.Android.OverScrollMode.ALWAYS]

Android

Since

3.0.2

useForeground: boolean

Gets/sets foreground of the view for ripple effect. This property should be set before rippleColor. This property only supported for api level 23 and above.

Property

= false]

Android

Member

UI.View

Since

4.0.2

rippleEnabled: boolean

Gets/sets ripple effect enabled for view. You should set UI.View#rippleColor rippleColor to see the effect.

Property

= false]

Android

Member

UI.View

Since

3.2.1

rippleColor: IColor

Gets/sets ripple effect color for view.

Property

Android

Member

UI.View

Since

3.2.1

elevation: number

Gets/Sets the elevation of the view. For the views that has StateListAnimator natively like Button, will lost its own StateListAnimation when elevation value changed. For details : https://developer.android.com/training/material/shadows-clipping.html

Property

Android

Member

UI.View

See

Since

1.1.12

zIndex: number

Gets/sets the depth location of the view relative to its elevation. To put view over button, you have to change zIndex value after Android Lollipop. On android, default elevation value of button is bigger than other view. This property affects after Android Lollipop. No-op before api level 21.

Property

Android

Member

UI.View

Since

2.0.8

borderTopLeftRadius: number

Sets/gets top-left corner radius of a view.

Property

= 0]

Android

Since

5.1.1

borderTopRightRadius: number

Sets/gets top-right corner radius of a view.

Property

= 0]

Android

Since

5.1.1

borderTopStartRadius: number

Sets/gets top-start corner radius of a view.

Property

= -1]

Android

Since

5.1.1

borderTopEndRadius: number

Sets/gets top-end corner radius of a view.

Property

= -1]

Android

Since

5.1.1

borderBottomLeftRadius: number

Sets/gets bottom-left corner radius of a view.

Property

= 0]

Android

Since

5.1.1

borderBottomRightRadius: number

Sets/gets bottom-right corner radius of a view.

Property

= 0]

Android

Since

5.1.1

borderBottomStartRadius: number

Sets/gets bottom-start corner radius of a view.

Property

= -1]

Android

Since

5.1.1

borderBottomEndRadius: number

Sets/gets bottom-end corner radius of a view.

Property

= -1]

Android

Since

5.1.1

updateRippleEffectIfNeeded: (() => void)

Type declaration

    • (): void
    • Returns void

Generated using TypeDoc