@symbiot.dev/react-native-swipeday v1.0.0
react-native-swipeday is a horizontally swipeable React Native component that displays individual days. It enables smooth left and right swiping to navigate between days, making it ideal for daily planners, calendars, habit trackers, and similar apps. Unlike a timeline, each slide focuses on a single full day, giving you complete control over the day's content. The component is built with full support for iOS, Android, Web, Expo, and Expo Go, making it highly versatile and easy to integrate across platforms.
๐ฑ Demo
โจ Key Features
๐
Swipeable Day View โ Navigate horizontally through days with optional snapping.
๐ฅ Group-Based Layout โ Organize your day view by teams, rooms, users, etc.
๐จ Custom Renderers โ Inject your own headers, day content, or group layout via render props.
๐ฑ Cross-Platform Support โ Works seamlessly across:
- iOS & Android
- Web via React Native Web
- Expo & Expo Go
๐ง Minimal & Extensible โ Lightweight core with deep customization hooks.
๐ Performance Friendly โ Virtualized scrolling and render control for optimal responsiveness.
๐ง Ideal For
- ๐ฅ Employee shift planners
- ๐๏ธ Booking views by room, therapist, stylist, etc.
- ๐ Grouped daily timelines
- ๐งโ๐ซ Class schedules split by instructor or location
- ๐ฆ Delivery or service assignments by region
- ๐ Field service or technician dispatch views
- ๐งญ Any multi-entity day-based scheduling need
๐ฆ Installation
npm install @symbiot.dev/react-native-swipeday date-fns react-native-reanimated react-native-gesture-handler
# or
yarn add @symbiot.dev/react-native-swipeday date-fns react-native-reanimated react-native-gesture-handler
# for web support
npm i react-native-web
# or
yarn add react-native-web
import { SwipeDay } from '@symbiot.dev/react-native-swipeday';
// ... and voilร ๐ซ
<SwipeDay />
๐จ SwipeDayThemeProps
โ Theming & Appearance
You can customize the look and feel of SwipeDay
using the theme
prop. It supports both global styles and scheme-based overrides for 'light'
and 'dark'
modes.
๐งฉ Structure
The SwipeDayThemeProps
type supports three layers:
- Global Styling (applies to all schemes unless overridden)
- Per-scheme Overrides โ Use
light
anddark
keys to define specific values - Theme Scheme Selector โ Control active theme using
scheme
type SwipeDayThemeProps = SwipeDayStyle & {
scheme?: 'light' | 'dark';
light?: SwipeDayStyle;
dark?: SwipeDayStyle;
};
๐งฑ Available Styling Props
Prop Name | Description | iOS | Android | Web | Default Value |
---|---|---|---|---|---|
backgroundColor | Main background color of the grid view | โ | โ | โ | light: #FFFFFF , dark: #000000 |
dayHeaderBackgroundColor | Background for the day-of-week header bar | โ | โ | โ | light: #FFFFFF , dark: #000000 |
dayHeaderTextColor | Text color for day-of-week labels | โ | โ | โ | light: #000000 , dark: #FFFFFF |
groupHeaderBackgroundColor | Background for the group header bar | โ | โ | โ | light: #FFFFFF , dark: #000000 |
groupHeaderTextColor | Text color for group labels | โ | โ | โ | light: #000000 , dark: #FFFFFF |
verticalLineColor | Color of vertical grid lines | โ | โ | โ | light: #F1F1F1 , dark: #303030 |
horizontalLineColor | Color of horizontal grid lines | โ | โ | โ | light: #F1F1F1 , dark: #303030 |
<SwipeDay
//...
theme={{
backgroundColor: '#f0f0f0', // for light and dark mode
}}
/>
// ----
<SwipeDay
//...
theme={{
backgroundColor: '#f0f0f0', // only applies to light mode
dark: {
backgroundColor: '#020202',
},
}}
/>
๐ SwipeDayDimensionsProps
โ Layout & Dimensions
Control the physical dimensions of key areas inside the SwipeDay
. All values are in pixels and optional โ sensible defaults are provided.
๐งฑ Available Dimension Props
Prop Name | Description | iOS | Android | Web | Default Value |
---|---|---|---|---|---|
width | SwipeDay width | โ | โ | โ | system |
dayHeaderHeight | Height of the day header (weekday labels) | โ | โ | โ | 50 |
groupHeaderHeight | Height of the group header (group labels) | โ | โ | โ | 30 |
horizontalLineSize | Height of horizontal divider lines | โ | โ | โ | 0.5 |
<SwipeDay
//...
width={300}
/>;
๐
SwipeDayDatetimeProps
โ Date & Time Configuration
Set the visible time range, number of days, start date, and other calendar-related behaviors.
These props give you precise control over how the SwipeDay
renders days and time slots.
๐งฑ Available Datetime Props
Prop Name | Description | iOS | Android | Web | Default Value |
---|---|---|---|---|---|
startDate | The starting datetime for the initial calendar state | โ | โ | โ | new Date() |
weekStartsOn | Day the week starts on (0=Sun, 1=Mon, etc.) | โ | โ | โ | 0 (Sunday) |
hiddenDays | Days of the week to hide (e.g., [0, 6] to hide Sun & Sat) | โ | โ | โ | [] |
numberOfDays | Number of days to render in the view | โ | โ | โ | 1 |
minDate | Earliest date to allow navigation | โ | โ | โ | โ |
maxDate | Latest date to allow navigation | โ | โ | โ | โ |
<SwipeDay
//...
weekStartsOn={1} // starts on Monday
numberOfDays={3}
hiddenDays={[0, 6]} // exclude weekends (Sun,Sut)
/>;
๐ฎ SwipeDayControllerProps
โ Interaction & Display Toggles
Control user interaction features like swiping, snapping, and visibility of UI components like the headers.
๐งฑ Available Controller Props
Prop Name | Description | iOS | Android | Web | Default Value |
---|---|---|---|---|---|
swipeable | Enable swiping between days or weeks | โ | โ | โ | false |
snappable | Snap scroll/drag to the nearest date(or group in groupable mode) | โ | โ | โ | false |
debounceable | Delays date change handler to avoid rapid successive triggers. | โ | โ | โ | false |
rtl | Enable right-to-left layout (for RTL languages) | โ | โ | โ | false |
isDayHeaderVisible | Toggle visibility of the top day-of-week header | โ | โ | โ | true |
isGroupHeaderVisible | Toggle visibility of the top group header | โ | โ | โ | true |
<SwipeDay
//...
swipeable // swipe actions turned on
scrollable // user can scroll
snappable // date/group snapping enabled
/>
๐ง SwipeDayScrollProps
โ Scroll and Refresh Control
These types control the scroll and refresh behavior for day-based components, allowing flexible configuration either globally, per group, or per specific date.
๐ SwipeDayScrollProp
Defines the scroll or refresh state and can be one of the following:
boolean
โ enable or disable scrolling/refreshing globally.Record<string, boolean>
โ keyed by group IDs to enable or disable per group.Array<{ groupId: string; date: string; value: boolean }>
โ fine-grained control by group and date.
๐งฑ SwipeDayScrollProps
Props that manage scroll and refresh capabilities:
Prop Name | Description | iOS | Android | Web | Default Value |
---|---|---|---|---|---|
scrollable | Controls if day scrolling is enabled, with flexible options. | โ | โ | โ | false |
refreshable | Controls if pull-to-refresh is enabled, with flexible options. | โ | โ | โ | false |
refreshing | Indicates the refreshing state, useful for UI feedback. | โ | โ | โ | false |
๐ฆ Example Usage
<SwipeDay
//...
scrollable // enable scroll for all days
/>
๐ฆ SwipeGayGroupProps
โ Groups
Configure how groups are handled in the SwipeGay component.
๐งฑ Available Props
Prop Name | Description | iOS | Android | Web | Default Value |
---|---|---|---|---|---|
groupable | Controls days splitting by groups | โ | โ | โ | false |
numberOfGroups | Optional number of groups to display | โ | โ | โ | groups size |
groups | Optional array of group objects (SwipeGayGroup[] ) | โ | โ | โ | [] |
Example Usage
const groups = [
{ id: 1, name: 'Group A' },
{ id: 2, name: 'Group B' },
];
<SwipeGayComponent
//...
numberOfGroups={2}
groups={groups}
/>
โฑ SwipeDayFormatterProps
โ Text Formatting
Customize how dates and times appear within the SwipeDay component using format strings (e.g., dd
, HH:mm
, EEE
).
These follow date-fns formatting syntax.
๐งฑ Available Formatter Props
Prop Name | Description | iOS | Android | Web | Default Value |
---|---|---|---|---|---|
dayHeaderTextFormat | Format for the day header labels (e.g., Mon , Apr 20 ) | โ | โ | โ | EEEEEE dd |
locale | Locale object from date-fns for internationalized formatting | โ | โ | โ | en |
import { zhCN } from 'date-fns/locale/zh-CN';
<SwipeDay
//...
locale={zhCN} // Chinese localization
/>;
๐งญ SwipeDayActionsProps
โ User Interaction Callbacks
Callbacks to handle user interactions within a swipeable day grid, such as taps, long presses, header presses, and data refreshes.
๐งฑ Available Action Callbacks
Prop Name | Description | iOS | Android | Web |
---|---|---|---|---|
onLoad | Called once the component is initialized and ready | โ | โ | โ |
onChangeDate | Triggered when the selected date changes | โ | โ | โ |
onRefresh | Called when the grid requests a manual refresh of data | โ | โ | โ |
onGroupHeaderPress | Triggered when a group header is tapped | โ | โ | โ |
onDayHeaderPress | Called when the day header is tapped | โ | โ | โ |
onDayPress | Triggered when a day cell is tapped | โ | โ | โ |
onDayLongPress | Triggered on a long press of a day cell | โ | โ | โ |
import { useState } from 'react';
//...
const [selectedDate, setSelectedDate] = useState(new Date());
<SwipeDay
//...
onChangeDate={setSelectedDate} // Update selected date on swipe or tap
onRefresh={({ date }) => console.log('Refreshing data for:', date)}
onGroupHeaderPress={({ groupId }) => console.log('Group pressed:', groupId)}
onDayLongPress={({ date }) => console.log('Long pressed:', date)}
/>
๐ง SwipeDayRef
โ Imperative Control API
Control and interact with the SwipeDay instance programmatically using a React ref.
Great for custom toolbars, buttons, or dynamic navigation.
๐งฑ Available Ref Methods
Method | Description | Returns |
---|---|---|
getPrevDate() | Returns the previous valid date range (optionally ignoring minDate /maxDate ) | Date \| undefined |
getNextDate() | Returns the next valid date range (optionally ignoring minDate /maxDate ) | Date \| undefined |
prevDate() | Navigate to the previous available date | void |
nextDate() | Navigate to the next available date | void |
back() | Navigate backward through a specified number of days (numberOfDays ) | void |
forward() | Navigate forward through a specified number of days (numberOfDays ) | void |
import { useRef } from 'react';
import { SwipeDay, SwipeDayRef } from '@symbiot.dev/react-native-swipeday';
const swipeDayRef = useRef<SwipeDayRef>(null);
<SwipeDay
//...
ref={swipeDayRef}
/>
//...
<Pressable onPress={() => swipeDayRef.current?.forward()}>{/*...*/}</Pressable>
๐ Platform Support
- โ iOS
- โ Android
- โ Web
- โ Expo & Expo Go
๐ฆ Bundle Size
Lightweight and fast โ see actual size on Bundlephobia.
๐ฌ Contributing
Contributions welcome! Feel free to open issues, discussions, or suggestions.
๐ Who's Using This?
Using react-native-swipeday
in your app or product?
Feel free to share your project โ it might be featured in this section!
โ๏ธ Open pull request, or reach out directly to get included.
๐ Got Ideas or Gaps to Fill?
Know of existing libraries or functionality that could be improved?
Have an idea for something completely new?
Symbiot is ready to take on the challenge โ feedback, feature requests, or collaboration ideas are always welcome!
๐ง Letโs build better tools together. Start the conversation or contact via email.
๐งพ License
MIT โ Made with โค๏ธ by Symbiot
23 days ago