I recently upgraded from React 0.10 to React 0.14. I initially received an error that React.initializeTouchEvents not a function. I read some documentation stating that the need for this initialization disappeared in the most recent version of React, so I ended it up. Now, however, no sensory events are logged in my project. What do I need to do to get them working again?
Below I have included some simple test code that I wrote to try to solve this problem. Currently, no sensory events are logged at all.
My main js file:
var React = require('react'); var ReactDOM = require('react-dom'); var TestButton = require('components/common/testButton'); try { var lander = (<TestButton/>); ReactDOM.render(lander, document.getElementById('myContainer')); } catch (e) { error.errorHandler(e); }
My TestButton component:
var React = require('react'); var TestButton = React.createClass ({ getInitialState: function () { return { text: "Click Here!", }; }, toggle: function () { console.log('in toggle'); if (this.state.text == "Click Here!"){ this.setState({ text: "Good Job!", }); } else { this.setState({ text: "Click Here!", }); } }, render: function () { return ( <div onTouchEnd={this.toggle}> {this.state.text} </div> ); }, }); module.exports = TestButton;
Any ideas would be greatly appreciated.
EDIT: I tried switching to onTouchEnd since onTouchTap is no longer available. However, I still have the same problem.
EDIT: This works great from the mobile device itself. However, I canβt get it to work with the Chrome mobile emulator
source share