<Replace this line with a title. Use 1 line only, 67 chars or less>

Reviewed By: matryoshcow

Differential Revision: D3432084

fbshipit-source-id: fa94b1aca40c931cc273a5561adf37f458aaa0ff
This commit is contained in:
Konstantin Raev
2016-06-15 03:01:29 -07:00
committed by Facebook Github Bot 6
parent 503fdc6699
commit 58881fc57f
10 changed files with 511 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
/**
* 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 InitialPropsTestApp
*/
'use strict';
var React = require('React');
var RecordingModule = require('NativeModules').InitialPropsRecordingModule;
var Text = require('Text');
var InitialPropsTestApp = React.createClass({
componentDidMount: function() {
RecordingModule.recordProps(this.props);
},
render: function() {
return <Text>dummy</Text>;
}
});
module.exports = InitialPropsTestApp;

View File

@@ -0,0 +1,63 @@
/**
* 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 JSResponderTestApp
*/
'use strict';
var React = require('React');
var StyleSheet = require('StyleSheet');
var View = require('View');
var Text = require('Text');
var PanResponder = require('PanResponder');
var ScrollView = require('ScrollView');
var JSResponderTestApp = React.createClass({
_handleMoveShouldSetPanResponder: function(e, gestureState) {
return Math.abs(gestureState.dx) > 30;
},
componentWillMount: function() {
this.panGesture = PanResponder.create({
onMoveShouldSetPanResponder: this._handleMoveShouldSetPanResponder,
});
},
render: function() {
var views = [];
for (var i = 0; i < 100; i++) {
views[i] = (
<View key={i} style={styles.row} collapsable={false}>
<Text>I am row {i}</Text>
</View>
);
}
return (
<View
style={styles.container}
{...this.panGesture.panHandlers}
collapsable={false}>
<ScrollView style={styles.scrollview} testID="scroll_view">
{views}
</ScrollView>
</View>
);
},
});
var styles = StyleSheet.create({
container: {
flex: 1,
},
scrollview: {
flex: 1,
},
row: {
height: 30,
}
});
module.exports = JSResponderTestApp;

View File

@@ -0,0 +1,35 @@
/**
* 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 LayoutEventsTestApp
*/
'use strict';
var React = require('React');
var View = require('View');
var RecordingModule = require('NativeModules').Recording;
var LayoutEventsTestApp = React.createClass({
handleOnLayout: function(e) {
var layout = e.nativeEvent.layout;
RecordingModule.record(layout.x + ',' + layout.y + '-' + layout.width + 'x' + layout.height);
},
render: function() {
return (
<View
onLayout={this.handleOnLayout}
testID="container"
style={{left: 10, top: 10, width: 100, height: 100}}/>
);
},
});
module.exports = LayoutEventsTestApp;

View File

@@ -16,6 +16,7 @@ console.disableYellowBox = true;
require('ProgressBarTestModule');
require('ViewRenderingTestModule');
require('TestJavaToJSArgumentsModule');
require('TestJSLocaleModule');
require('TestJSToJavaParametersModule');
require('CatalystRootViewTestModule');
@@ -40,10 +41,22 @@ var apps = [
appKey: 'DatePickerDialogTestApp',
component: () => require('DatePickerDialogTestModule').DatePickerDialogTestApp
},
{
appKey: 'JSResponderTestApp',
component: () => require('JSResponderTestApp'),
},
{
appKey: 'HorizontalScrollViewTestApp',
component: () => require('ScrollViewTestModule').HorizontalScrollViewTestApp,
},
{
appKey: 'InitialPropsTestApp',
component: () => require('InitialPropsTestApp'),
},
{
appKey: 'LayoutEventsTestApp',
component: () => require('LayoutEventsTestApp'),
},
{
appKey: 'MeasureLayoutTestApp',
component: () => require('MeasureLayoutTestModule').MeasureLayoutTestApp

View File

@@ -0,0 +1,31 @@
/**
* 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 TestJSLocaleModule
*/
'use strict';
var BatchedBridge = require('BatchedBridge');
var Recording = require('NativeModules').Recording;
var TestJSLocaleModule = {
toUpper: function(s) {
Recording.record(s.toUpperCase());
},
toLower: function(s) {
Recording.record(s.toLowerCase());
},
};
BatchedBridge.registerCallableModule(
'TestJSLocaleModule',
TestJSLocaleModule
);
module.exports = TestJSLocaleModule;