Closed
Description
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
Labels
No labels