Skip to main content

SlideAction

The SlideAction component in our library is an interactive element designed to trigger actions when users perform a sliding gesture.

Usage

Basic usage

import {ProgressBar} from 'rn-inkpad';

const MyComponent = () => {
return <ProgressBar />;
};

Props

NameTypeDefaultDescription
heightnumber56Slider height.
iconstringThumb icon.
iconColorstring#F43F5DThumb icon color.
iconCompletedColorstring#4ADE80Thumb icon color when is completed.
iconOnCompletedstringThumb icon when is completed.
iconSizenumber20Icon size.
isCompletedbooleanfalseIndicates whether the slider is complete or not.
paddingnumber8Padding between thumb and edges.
readonlybooleanfalseIndicates whether the slider is read-only.
styleStyleProp<ViewStyle>Custom styles for your slider container.
textstringSlider text.
textOnCompletedstringSlider text when is completed.
textPosition'center' | 'ends'centerText position.
textStyleStyleProp<TextStyle>Custom styles for your slider.
thumbBorderColorstringThumb border color.
thumbBorderWidthnumberThumb border width.
thumbColorstring#FFFFFFThumb color.
thumbCompletedColorstring#FFFFFFThumb color when is completed.
thumbWidthstring40Thumb width.
tintColorstring#F43F5DSlider background color.
tintCompletedColorstring#4ADE80Slider background color when is completed.
onCompleted() => voidCallback that is called when slide is completed.

Usage props

import React, {useState} from 'react';
import {StyleSheet, Text, View} from 'react-native';

import {SlideAction} from 'rn-inkpad';

const MyComponent = () => {
const [confirmed, setConfirmed] = useState(false);

return (
<View>
<SlideAction
icon="lock-open"
iconOnCompleted="lock-closed"
text="Slide to confirm"
textOnCompleted="Confirmed"
onCompleted={() => setConfirmed(true)}
/>

<Text style={styles.text}>
{confirmed ? 'Confirmed' : 'Not confirmed'}
</Text>
</View>
);
};

const styles = StyleSheet.create({
text: {
fontSize: 18,
fontWeight: '600',
marginTop: 20,
textAlign: 'center',
},
});

Example with props