mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-04-30 05:14:53 +08:00
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { storiesOf, action } from '@kadira/storybook';
|
import { storiesOf, action } from '@kadira/storybook';
|
||||||
import { ScrollView, StyleSheet, Text, View } from 'react-native'
|
import { ScrollView, StyleSheet, Text, TouchableHighlight, View } from 'react-native'
|
||||||
|
|
||||||
storiesOf('component: ScrollView', module)
|
storiesOf('component: ScrollView', module)
|
||||||
.add('vertical', () => (
|
.add('vertical', () => (
|
||||||
@@ -13,7 +13,7 @@ storiesOf('component: ScrollView', module)
|
|||||||
>
|
>
|
||||||
{Array.from({ length: 50 }).map((item, i) => (
|
{Array.from({ length: 50 }).map((item, i) => (
|
||||||
<View key={i} style={styles.box}>
|
<View key={i} style={styles.box}>
|
||||||
<Text>{i}</Text>
|
<TouchableHighlight onPress={() => {}}><Text>{i}</Text></TouchableHighlight>
|
||||||
</View>
|
</View>
|
||||||
))}
|
))}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
@@ -39,7 +39,6 @@ storiesOf('component: ScrollView', module)
|
|||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
box: {
|
box: {
|
||||||
alignItems: 'center',
|
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
borderWidth: 1
|
borderWidth: 1
|
||||||
|
|||||||
@@ -124,10 +124,10 @@ class View extends Component {
|
|||||||
|
|
||||||
_normalizeEventForHandler(handler, handlerName) {
|
_normalizeEventForHandler(handler, handlerName) {
|
||||||
// Browsers fire mouse events after touch events. This causes the
|
// Browsers fire mouse events after touch events. This causes the
|
||||||
// ResponderEvents and their handlers to fire twice for Touchables.
|
// 'onResponderRelease' handler to be called twice for Touchables.
|
||||||
// Auto-fix this issue by calling 'preventDefault' to cancel the mouse
|
// Auto-fix this issue by calling 'preventDefault' to cancel the mouse
|
||||||
// events.
|
// events.
|
||||||
const shouldCancelEvent = handlerName.indexOf('onResponder') === 0;
|
const shouldCancelEvent = handlerName === 'onResponderRelease';
|
||||||
|
|
||||||
return (e) => {
|
return (e) => {
|
||||||
e.nativeEvent = normalizeNativeEvent(e.nativeEvent);
|
e.nativeEvent = normalizeNativeEvent(e.nativeEvent);
|
||||||
|
|||||||
Reference in New Issue
Block a user