How to use the react-native-gesture-handler.State.UNDETERMINED function in react-native-gesture-handler

To help you get started, we’ve selected a few react-native-gesture-handler 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 mattermost / mattermost-mobile / app / components / channel_keyboard_accessory / recorder / recorder.js View on Github external
onPanHandlerStateChange = ({nativeEvent}) => {
        switch (nativeEvent.state) {
        case GestureState.UNDETERMINED:
            console.log('PAN undetermined', nativeEvent.state); // eslint-disable-line no-console
            break;
        case GestureState.FAILED:
            console.log('PAN failed', nativeEvent.state); // eslint-disable-line no-console
            break;
        case GestureState.BEGAN:
            console.log('PAN began', nativeEvent.state); // eslint-disable-line no-console
            break;
        case GestureState.CANCELLED:
            console.log('PAN cancelled', nativeEvent.state); // eslint-disable-line no-console
            break;
        case GestureState.ACTIVE:
            console.log('PAN active', nativeEvent.state); // eslint-disable-line no-console
            break;
        case GestureState.END:
            console.log('PAN end', nativeEvent.state); // eslint-disable-line no-console
github react-navigation / navigation-ex / packages / drawer / src / views / Drawer.tsx View on Github external
}

  private clock = new Clock();

  private isDrawerTypeFront = new Value(
    this.props.drawerType === 'front' ? TRUE : FALSE
  );
  private isGestureEnabled = new Value(
    this.props.gestureEnabled ? TRUE : FALSE
  );

  private isOpen = new Value(this.props.open ? TRUE : FALSE);
  private nextIsOpen = new Value(UNSET);
  private isSwiping = new Value(FALSE);

  private gestureState = new Value(State.UNDETERMINED);
  private touchX = new Value(0);
  private velocityX = new Value(0);
  private gestureX = new Value(0);
  private offsetX = new Value(0);
  private position = new Value(0);

  private containerWidth = new Value(0);
  private drawerWidth = new Value(0);
  private drawerOpacity = new Value(0);
  private drawerPosition = new Value(
    this.props.drawerPosition === 'right' ? DIRECTION_RIGHT : DIRECTION_LEFT
  );

  // Comment stolen from react-native-gesture-handler/DrawerLayout
  //
  // While closing the drawer when user starts gesture outside of its area (in greyed
github wcandillon / can-it-be-done-in-react-native / season3 / src / LiquidSwipe / LiquidSwipe.tsx View on Github external
export default () => {
  const y = new Value(initialWaveCenter);
  const translationX = new Value(0);
  const velocityX = new Value(0);
  const state = new Value(State.UNDETERMINED);
  const gestureHandler = onGestureEvent({
    translationX,
    velocityX,
    y,
    state
  });
  const isBack = new Value(0);
  const gestureProgress = cond(
    isBack,
    interpolate(translationX, {
      inputRange: [0, width - initialSideWidth],
      outputRange: [1, 0]
    }),
    interpolate(translationX, {
      inputRange: [-width, initialSideWidth],
      outputRange: [0.4, 0]
github wcandillon / can-it-be-done-in-react-native / season2 / safari-tabs / components / Tap.tsx View on Github external
export default ({ onPress, children }: TapProps) => {
  const state = new Value(State.UNDETERMINED);
  const onGestureEvent = event([
    {
      nativeEvent: {
        state
      }
    }
  ]);
  useCode(block([cond(eq(state, State.END), onPress)]), [onPress]);
  return (
    
      {children}
    
  );
github wcandillon / can-it-be-done-in-react-native / season2 / spotify-player / components / BottomTab.tsx View on Github external
export default () => {
  const translationY = new Value(0);
  const velocityY = new Value(0);
  const state = new Value(State.UNDETERMINED);
  const offset = new Value(SNAP_BOTTOM);
  const goUp: Animated.Value<0 | 1> = new Value(0);
  const goDown: Animated.Value<0 | 1> = new Value(0);
  const gestureHandler = onGestureEvent({
    state,
    translationY,
    velocityY
  });
  const translateY = withSpring({
    value: translationY,
    velocity: velocityY,
    offset,
    state,
    snapPoints: [SNAP_TOP, SNAP_BOTTOM],
    config
  });
github software-mansion / react-native-reanimated / Example / directManipulation / ControlledScrollView.js View on Github external
  const panState = useMemo(() => new Value(State.UNDETERMINED), []);
  const onPan = useMemo(() =>
github wcandillon / react-native-redash / Example / src / Gestures / withOffset.tsx View on Github external
const { dragX, dragY, panState, translateY, translateX } = useState(() => {
    const dragX = new Value(0)
    const dragY = new Value(0)
    const panState = new Value(GestureState.UNDETERMINED)

    return {
      dragX,
      dragY,
      panState,
      translateX: withOffset(dragX, panState),
      translateY: withOffset(dragY, panState)
    }
  })
github software-mansion / react-native-reanimated / Example / directManipulation / TimePicker.js View on Github external
  const animState = useMemo(() => new Value(State.UNDETERMINED), []);
  const appState = useMemo(() => new Value("initialAppState"), []);
github iyegoroff / react-native-reanimated-color-picker / src / HueSaturationValuePicker.tsx View on Github external
readonly thumbSize?: number
  readonly initialHue?: number
  readonly initialSaturation?: number
  readonly initialValue?: number
}

type State = {
  readonly value: Animated.Node
  readonly valueGestureState: Animated.Node
}

export class HueSaturationValuePicker extends React.PureComponent {

  state: State = {
    value: new Animated.Value(1),
    valueGestureState: new Animated.Value(GestureState.UNDETERMINED)
  }

  render() {
    const {
      wheelStyle,
      sliderStyle,
      thumbSize,
      snapToCenter,
      initialHue,
      initialValue,
      initialSaturation,
      onColorChange,
      onColorChangeComplete
    } = this.props
    const { value, valueGestureState } = this.state
github brentvatne / swipe-action-gesture-handler-experiment / SwipeActions.js View on Github external
function gestureStateFromEnum(s) {
  switch (s) {
    case State.UNDETERMINED:
      return 'UNDETERMINED';
    case State.BEGAN:
      return 'BEGAN';
    case State.FAILED:
      return 'FAILED';
    case State.CANCELLED:
      return 'CANCELLED';
    case State.ACTIVE:
      return 'ACTIVE';
    case State.END:
      return 'END';
    default:
      return `Invalid gesture state: ${s}`;
  }
}