mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Open sourced more instrumentation tests
Reviewed By: avaly Differential Revision: D3373926 fbshipit-source-id: da520b61c5e74d515b853cf1d9548ed3e671aa50
This commit is contained in:
committed by
Facebook Github Bot 6
parent
aaf557da52
commit
75c6bf5723
@@ -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;
|
||||
Reference in New Issue
Block a user