Skip to content

react-dom: "^16.4.0" (&& "16.4.2") PanResponder bug #13504

Closed
@English3000

Description

@English3000

Steps to reproduce:

create-react-native-app test --with-web-support (defaults to [email protected])
cd test && npm install

Copy into App.js:

import React from "react"
import { Animated, PanResponder } from "react-native"

export default class App extends React.Component {
  constructor(){
    super()
    this.state = { pan: new Animated.ValueXY() }
    this.panResponder = {}
  }

  render() {
    return (
      <Animated.View {...this.panResponder.panHandlers}
        style={{transform: this.state.pan.getTranslateTransform(), borderWidth: "1"}}>
        <Animated.Text>Open up src/App.js to start working on your app!</Animated.Text>
        <Animated.Text>Changes you make will automatically reload.</Animated.Text>
        <Animated.Text>Shake your phone to open the developer menu.</Animated.Text>
      </Animated.View>
    )
  }

  componentDidMount(){
    this.panResponder = PanResponder.create({
      onStartShouldSetPanResponder: () => true,
      onPanResponderMove: Animated.event([ null, { dx: this.state.pan.x,
                                                   dy: this.state.pan.y } ])
    })
    this.forceUpdate()
  }
}

yarn web

You have a draggable (albeit slightly buggy) textbox!

npm i -S [email protected]

yarn web

It doesn't move!

npm i -S [email protected]

It still doesn't move!

npm i -S [email protected]

And behold, it moves!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions