Open sourced more instrumentation tests

Reviewed By: avaly

Differential Revision: D3373926

fbshipit-source-id: da520b61c5e74d515b853cf1d9548ed3e671aa50
This commit is contained in:
Konstantin Raev
2016-06-02 07:05:39 -07:00
committed by Facebook Github Bot 6
parent aaf557da52
commit 75c6bf5723
8 changed files with 2079 additions and 0 deletions
@@ -0,0 +1,64 @@
/**
* 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
*/
'use strict';
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;