react-native
Version:
A framework for building native apps using React
65 lines (59 loc) • 1.79 kB
JavaScript
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule MultitouchHandlingTestAppModule
*/
;
var React = require('React');
var Recording = require('NativeModules').Recording;
var StyleSheet = require('StyleSheet');
var TouchEventUtils = require('fbjs/lib/TouchEventUtils');
var View = require('View');
var TouchTestApp = React.createClass({
handleStartShouldSetResponder: function(e) {
return true;
},
handleOnResponderMove: function(e) {
e = TouchEventUtils.extractSingleTouch(e.nativeEvent);
Recording.record('move;' + e.touches.length);
},
handleResponderStart: function(e) {
e = TouchEventUtils.extractSingleTouch(e.nativeEvent);
if (e.touches) {
Recording.record('start;' + e.touches.length);
} else {
Recording.record('start;ExtraPointer');
}
},
handleResponderEnd: function(e) {
e = TouchEventUtils.extractSingleTouch(e.nativeEvent);
if (e.touches) {
Recording.record('end;' + e.touches.length);
} else {
Recording.record('end;ExtraPointer');
}
},
render: function() {
return (
<View
style={styles.container}
onStartShouldSetResponder={this.handleStartShouldSetResponder}
onResponderMove={this.handleOnResponderMove}
onResponderStart={this.handleResponderStart}
onResponderEnd={this.handleResponderEnd}
collapsable={false}
/>
);
},
});
var styles = StyleSheet.create({
container: {
flex: 1,
},
});
module.exports = TouchTestApp;