Split Button with Reanimated and Gesture Handler 🪀
Wednesday, September 6, 2023
demos
split-button
An ongoing collection of React Native animations crafted with Reanimated, Gesture Handler, and Skia.
TypeScript
3.2k
296
A customizable split button with icon support and gesture handling.
What's This About?
This component creates an interactive split button that can display different icons on each side. It features gesture handling for smooth interactions and supports custom icon integration from Expo's vector icons library. The implementation is perfect for social login buttons, toggle switches, or any interface requiring a dual-state button.
Technical Implementation
The component uses:
Gesture handling
Icon integration
Split states
Custom styling
Touch feedback
Usage
// Basic usage
<SplitButton />
// With custom icons
<SplitButton
rightIcon={
<AntDesign
name="apple1"
size={21}
color={colors.background}
/>
}
leftIcon={
<AntDesign
name="google"
size={22}
color={colors.almostBlack}
/>
}
/>
// Full implementation
<GestureHandlerRootView style={{ flex: 1 }}>
<View style={styles.container}>
<SplitButton
rightIcon={rightIcon}
leftIcon={leftIcon}
/>
</View>
</GestureHandlerRootView>
// Color theming
const colors = {
background: '#FFFFFF',
almostBlack: '#1A1A1A'
};
Unlock the beauty of React Native animations
Learn Reanimated, Gesture Handler & Skia with Reanimate.dev
Feedback on Split Button
Ideas, bugs, or anything that felt off: I read every message. For anything else, write to hello@reactiive.io.
Send feedback