react-native-loading-placeholder icon indicating copy to clipboard operation
react-native-loading-placeholder copied to clipboard

Animation direction

Open harikrishnanng opened this issue 6 years ago • 1 comments

Do you have a prop to change animation direction? I did the following because I didn't see any.

type PlaceholderContainerProps = { duration: number, delay: number, style: Object, animatedComponent: React.Element<*>, loader: Function, replace: boolean, rtl: boolean };

and

_setAnimationPositions = (): void => {
    const {
      ContainerComponent,
      AnimatedComponent,
      isContainerComponentMeasured,
      isAnimatedComponentMeasured
    } = this.state;
    const {rtl} = this.props;
    if (!isContainerComponentMeasured || !isAnimatedComponentMeasured) {
      return;
    }
    const startPosition = rtl ? (ContainerComponent.x + ContainerComponent.width + AnimatedComponent.width) : -(ContainerComponent.x + AnimatedComponent.width);
    const stopPosition = rtl ? -(ContainerComponent.x + AnimatedComponent.width) : (ContainerComponent.x + ContainerComponent.width + AnimatedComponent.width);
    this.setState(
      () => ({
        startPosition,
        stopPosition
      }),
      () => {
        this.position.setValue(startPosition);
        this._startAndRepeat();
      }
    );

  };

I don't know whether this is right but got my job done

harikrishnanng avatar May 05 '19 15:05 harikrishnanng

Currently, there is no option for it. Feel free to create PR.

Thanks

zeljkoX avatar May 07 '19 20:05 zeljkoX