mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-24 23:25:40 +00:00
[fix] ScrollView to use 'touch-action' to disable scroll
The recommendation from the Chrome team is to use 'touch-action' to disable scrolling (via touch modality) when passive event listeners are in use. Close #563
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import React, { PureComponent } from 'react';
|
||||
import { Button, ScrollView, StyleSheet, Text, View } from 'react-native';
|
||||
import { Button, ScrollView, StyleSheet, Text, TouchableHighlight, View } from 'react-native';
|
||||
|
||||
export default class ScrollToExample extends PureComponent {
|
||||
render() {
|
||||
@@ -20,11 +20,15 @@ export default class ScrollToExample extends PureComponent {
|
||||
style={styles.scrollViewStyle}
|
||||
>
|
||||
{Array.from({ length: 50 }).map((item, i) =>
|
||||
<View key={i} style={[styles.box, styles.horizontalBox]}>
|
||||
<TouchableHighlight
|
||||
key={i}
|
||||
onPress={() => {}}
|
||||
style={[styles.box, styles.horizontalBox]}
|
||||
>
|
||||
<Text>
|
||||
{i}
|
||||
</Text>
|
||||
</View>
|
||||
</TouchableHighlight>
|
||||
)}
|
||||
</ScrollView>
|
||||
<Button
|
||||
|
||||
@@ -671,6 +671,11 @@ const stylePropTypes = [
|
||||
name: 'shadowRadius',
|
||||
typeInfo: 'number | string'
|
||||
},
|
||||
{
|
||||
label: 'web',
|
||||
name: 'touchAction',
|
||||
typeInfo: 'string'
|
||||
},
|
||||
{
|
||||
name: 'top',
|
||||
typeInfo: 'number | string'
|
||||
|
||||
Reference in New Issue
Block a user