Skip to main content
Version: 1.x

Swipe

The Swipe component is a swipeable container for content with left and/or right swipe actions.

Import

import { Swipe } from '@tra-tech/react-native-kitra';

Usage

import { Swipe, Icon } from '@tra-tech/react-native-kitra';
import { TouchableOpacity, Image } from 'react-native';

const App = () => (
<Swipe
variant="radius"
rightActions={[
{
icon: <Icon type="feather" name="send" size={18} color="white" />,
style: {
backgroundColor: '#67A7C1',
width: 82,
},
},
{
text: 'Sil',
style: {
backgroundColor: 'red',
},
},
{
icon: <Icon type="evilicon" name="trash" size={18} color="white" />,
text: 'Diğer',
style: {
backgroundColor: 'orange',
},
},
]}
leftAction={{
icon: <Icon type="evilicon" name="trash" size={18} color="white" />,
text: 'Sil',
style: {
backgroundColor: '#FF3434',
},
}}
>
<TouchableOpacity activeOpacity={1} style={{ backgroundColor: 'white', height: 82 }}>
<Image style={{ height: 82, width: '100%', overflow: 'hidden' }} source={{ uri: 'https://freepngdownload.com/image/thumb/tiger-cat-png.png' }} />
</TouchableOpacity>
</Swipe>
);

export default App;

Props

NameTypeRequiredDescription
childrenReact.ReactNodeNoThe content to be wrapped by the Swipeable component.
variant'radius'|
'no-radius'
NoDetermines whether to use a rounded border radius on the component. Default value: 'no-radius'
rightActionsArray<ActionProps>NoAn array of objects representing the right swipe actions to be rendered. Each object can optionally contain a text string and can optionally contain an icon React component.
leftActionActionPropsNoAn object representing the left swipe action to be rendered. The object can optionally contain a text string and can optionally contain an icon React component.
themeUIThemeNoAn object containing colors and other styling properties used by the component.
typographyUITypographyNoAn object containing font sizes and styles used by the component.

Types

NameType
ActionPropstext?: string, style?: StyleProp<ViewStyle>, icon?: React.ReactNode,
textStyle?: StyleProp<TextStyle>, onPress: (ref:React.RefObject<Swipeable>)=>void