Skip to main content

Gesture

安裝Gesture Handler

expo install react-native-gesture-handler

使用Gesture Handler

import React from 'react';
import {View, StyleSheet, Text} from 'react-native';
import Swipeable from 'react-native-gesture-handler/swipeable';

const MyScreen = ({title, subTitle, image, renderRightActions}) => {
return (
<Swipeable renderRightActions={renderRightActions}>
<View style={styles.myView}>
<Image source={image}</>
<Text>{title}</Text>
<Text>{subTitle}</Text>
</View>
<Swipeable>
);
}

const styles = StyleSheet.create({
myView:{
paddingTop: Constants.statuBarHeight,
}
});

export default MyScreen;