mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-06-12 10:18:06 +08:00
Summary: I removed var in ReactAndroid/src/androidTest. - [x] npm run prettier - [x] npm run flow-check-ios - [x] npm run flow-check-android [GENERAL] [ReactAndroid/src/androidTest] - remove var Pull Request resolved: https://github.com/facebook/react-native/pull/22137 Differential Revision: D12921228 Pulled By: TheSavior fbshipit-source-id: d3b7380b6047fc304265d0f47a53cb1170a6aea6
65 lines
1.4 KiB
JavaScript
65 lines
1.4 KiB
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
const React = require('React');
|
|
const StyleSheet = require('StyleSheet');
|
|
const View = require('View');
|
|
const Text = require('Text');
|
|
const PanResponder = require('PanResponder');
|
|
const ScrollView = require('ScrollView');
|
|
|
|
class JSResponderTestApp extends React.Component {
|
|
_handleMoveShouldSetPanResponder = (e, gestureState) => {
|
|
return Math.abs(gestureState.dx) > 30;
|
|
};
|
|
|
|
UNSAFE_componentWillMount() {
|
|
this.panGesture = PanResponder.create({
|
|
onMoveShouldSetPanResponder: this._handleMoveShouldSetPanResponder,
|
|
});
|
|
}
|
|
|
|
render() {
|
|
const views = [];
|
|
for (let 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>
|
|
);
|
|
}
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
},
|
|
scrollview: {
|
|
flex: 1,
|
|
},
|
|
row: {
|
|
height: 30,
|
|
},
|
|
});
|
|
|
|
module.exports = JSResponderTestApp;
|