How to use the react-swipeable-views-core.checkIndexBounds 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
constructor(props) {
    super(props);

    if (process.env.NODE_ENV !== 'production') {
      checkIndexBounds(props);
    }

    this.state = {
      indexLatest: props.index,
      // Set to true as soon as the component is swiping.
      // It's the state counter part of this.isSwiping.
      isDragging: false,
      // Help with SSR logic and lazy loading logic.
      renderOnlyActive: !props.disableLazyLoading,
      heightLatest: 0,
      // Let the render method that we are going to display the same slide than previously.
      displaySameSlide: true,
    };
    this.setIndexCurrent(props.index);
  }
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({
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,
      });
    }
  }
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
componentWillMount() {
    if (process.env.NODE_ENV !== 'production') {
      checkIndexBounds(this.props);
    }

    const { index = 0 } = this.props;

    this.setState({
      indexLatest: index,
      indexCurrent: new Animated.Value(index),
      viewLength: Dimensions.get('window').width,
    });

    this.panResponder = PanResponder.create({
      // So it's working inside a Modal
      onStartShouldSetPanResponder: () => true,
      // Claim responder if it's a horizontal pan
      onMoveShouldSetPanResponder: (event, gestureState) => {
        const dx = Math.abs(gestureState.dx);
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
componentWillMount() {
    if (process.env.NODE_ENV !== 'production') {
      checkIndexBounds(this.props);
    }

    const { index = 0 } = this.props;

    this.setState({
      indexLatest: index,
      viewWidth: windowWidth,
      offset: {
        x: windowWidth * index,
        y: 0,
      },
    });

    if (this.props.animateHeight !== undefined) {
      console.warn('react-swipeable-view-native: The animateHeight property is not implement yet.')
    }

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