How to use the react-swipeable-views-core.getDisplaySameSlide function in react-swipeable-views-core

To help you get started, we’ve selected a few react-swipeable-views-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oliviertassinari / react-swipeable-views / packages / react-swipeable-views / src / SwipeableViews.js View on Github external
componentWillReceiveProps(nextProps) {
    const { index } = nextProps;

    if (typeof index === 'number' && index !== this.props.index) {
      if (process.env.NODE_ENV !== 'production') {
        checkIndexBounds(nextProps);
      }

      this.setIndexCurrent(index);
      this.setState({
        // If true, we are going to change the children. We shoudn't animate it.
        displaySameSlide: getDisplaySameSlide(this.props, nextProps),
        indexLatest: index,
      });
    }
  }
github oliviertassinari / react-swipeable-views / native / packages / react-swipeable-views-native / src / SwipeableViews.scroll.tsx View on Github external
componentWillReceiveProps(nextProps) {
    const { index } = nextProps;

    if (typeof index === 'number' && index !== this.props.index) {
      if (process.env.NODE_ENV !== 'production') {
        checkIndexBounds(nextProps);
      }

      // If true, we are going to change the children. We shoudn't animate it.
      const displaySameSlide = getDisplaySameSlide(this.props, nextProps);

      this.setState(
        {
          displaySameSlide,
          indexLatest: index,
        },
        () => {
          if (this.scrollViewNode) {
            this.scrollViewNode.scrollTo({
              x: this.state.viewWidth * index,
              y: 0,
              animated: this.props.animateTransitions && !displaySameSlide,
            });
          }
        },
      );
github oliviertassinari / react-swipeable-views / native / packages / react-swipeable-views-native / src / SwipeableViews.animated.tsx View on Github external
componentWillReceiveProps(nextProps) {
    const { index, animateTransitions } = nextProps;

    if (typeof index === 'number' && index !== this.props.index) {
      if (process.env.NODE_ENV !== 'production') {
        checkIndexBounds(nextProps);
      }

      // If true, we are going to change the children. We shoudn't animate it.
      const displaySameSlide = getDisplaySameSlide(this.props, nextProps);

      if (animateTransitions && !displaySameSlide) {
        this.setState(
          {
            indexLatest: index,
          },
          () => {
            this.animateIndexCurrent(index);
          },
        );
      } else {
        this.setState({
          indexLatest: index,
          indexCurrent: new Animated.Value(index),
        });
      }
github oliviertassinari / react-swipeable-views / packages / react-swipeable-views / src / SwipeableViews.js View on Github external
UNSAFE_componentWillReceiveProps(nextProps) {
    const { index } = nextProps;

    if (typeof index === 'number' && index !== this.props.index) {
      if (process.env.NODE_ENV !== 'production') {
        checkIndexBounds(nextProps);
      }

      this.setIndexCurrent(index);
      this.setState({
        // If true, we are going to change the children. We shoudn't animate it.
        displaySameSlide: getDisplaySameSlide(this.props, nextProps),
        indexLatest: index,
      });
    }
  }

react-swipeable-views-core

react-swipeable-views core modules

MIT
Latest version published 4 years ago

Package Health Score

62 / 100
Full package analysis

Similar packages