我正在尝试复制此视频中显示的效果: https://youtu.be/V8maYc4R2G0?t=825 显示在13:45
如何将触摸事件通过ScrollView元素传递给地图?
请看一下代码,除了透明元素中的触摸事件被ScrollView捕获之外,它的工作原理还不错。
import React from 'react';
import { StyleSheet, Text, View, ScrollView, Dimensions } from 'react-native';
export default class App extends React.Component {
render() {
return (
<View style={styles.outerContainer}>
<View style={styles.container}>
<ScrollView contentContainerStyle={styles.contentContainer} stickyHeaderIndices={[1]}>
<Text style={styles.transparent}>
</Text>
<Text>
Pull here!
</Text>
<Text>
Hello
</Text>
<Text>
Hello
</Text>
<Text>
Hello
</Text>
<Text>
Hello
</Text>
</ScrollView>
</View>
</View>
);
}
}
var width = Dimensions.get('window').width; //full width
var height = Dimensions.get('window').height; //full height
const styles = StyleSheet.create({
container: {
height: height/2,
position: "absolute",
bottom: 0,
backgroundColor: '#fff',
},
outerContainer: {
height: height
},
contentContainer: {
width: width,
},
transparent: {
backgroundColor: 'rgba(255, 255, 255, 0)',
height: height/2-15
}
});