How to use the react-native-web.Animated.spring function in react-native-web

To help you get started, we’ve selected a few react-native-web 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 taofed / react-web / src / ViewPager / ViewPager.web.js View on Github external
setPage(index) {
    if (index < 0) {
      index = 0;
    } else if (index >= this.state.pageCount) {
      index = this.state.pageCount - 1;
    }

    this._scrolling = true;

    Animated.spring(this.state.offsetLeft, {
      toValue: index,
      bounciness: 0,
      restSpeedThreshold: 1
    }).start(() => {

      this._onPageScroll({
        nativeEvent: {
          position: index,
          offset: 0
        }
      });

      this._scrolling = false;

      this.setState({
        selectedPage: index
github taofed / react-web / src / DrawerLayout / DrawerLayout.web.js View on Github external
open(options = {}) {
    this._emitStateChanged(SETTLING);
    Animated.spring(this.state.openValue, {toValue: 1, bounciness: 0, restSpeedThreshold: 0.1, ...options}).start(() => {
      this.props.onDrawerOpen && this.props.onDrawerOpen();
      this._emitStateChanged(IDLE);
    });
  }
github taofed / react-web / src / DrawerLayout / DrawerLayout.web.js View on Github external
close(options = {}) {
    this._emitStateChanged(SETTLING);
    Animated.spring(this.state.openValue, {toValue: 0, bounciness: 0, restSpeedThreshold: 1, ...options}).start(() => {
      this.props.onDrawerClose && this.props.onDrawerClose();
      this._emitStateChanged(IDLE);
    });
  }