Skip to content

Animation direction #11

@harikrishnanng

Description

@harikrishnanng

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions