Docyrus

Check In

Location-based check-in/check-out system with timer, option selection, and check-out form.

iOSAndroid
Preview Check In on your device

Scan with Expo Go

Download Expo Go, then scan the QR code to preview native components.

Installation

pnpm dlx @docyrus/cli add @docyrus/rn-checkin

Overview

The Check In system is a multi-component feature for location-based check-in/check-out workflows. It consists of:

  • CheckInProvider — Context provider that manages state (session, timer, sheets)
  • DocyCheckInButton — Floating action button that toggles check-in/check-out
  • DocyCheckInSheet — ActionSheet for selecting a check-in location/option
  • DocyCheckOutSheet — ActionSheet with notes/outcome form for completing check-out

The system is form-library-agnostic and geolocation-library-agnostic — you provide getLocation and optionally requestLocationPermission callbacks.

Usage

import {
  CheckInProvider,
  DocyCheckInButton,
  DocyCheckInSheet,
  DocyCheckOutSheet
} from '@/components/docyrus-native/checkin';

function App() {
  const getLocation = async () => {
    // Use any geolocation library
    return { latitude: 41.0082, longitude: 28.9784 };
  };

  return (
    <CheckInProvider
      getLocation={getLocation}
      defaultOptions={[
        { id: '1', label: 'Office', icon: 'building-01', color: '#3b82f6' },
        { id: '2', label: 'Client Site', icon: 'user-group', color: '#22c55e' },
      ]}
      onCheckOut={async ({ session, formData, endLocation }) => {
        console.log('Checked out:', session, formData, endLocation);
      }}>
      <DocyCheckInButton size="md" />
      <DocyCheckInSheet />
      <DocyCheckOutSheet />
    </CheckInProvider>
  );
}

API Reference

CheckInProvider

PropTypeDefaultDescription
childrenReactNode—Child components
getLocation() => Promise<{ latitude: number; longitude: number }>—Required. Returns current device location
requestLocationPermission() => Promise<'granted' | 'denied'>—Request location permission before check-in
defaultOptionsCheckInOption[][]Default check-in options if onCheckIn is not provided
onCheckIn(location) => Promise<CheckInOption[]>—Called on check-in, returns available options
onCheckOut(data) => Promise<void>—Called on check-out with session data, form data, and end location

DocyCheckInButton

PropTypeDefaultDescription
size'sm' | 'md' | 'lg''sm'Button size
bottomnumber20Bottom position offset
topnumber—Top position offset
leftnumber—Left position offset
rightnumber20Right position offset
onCheckInStart() => void—Called when check-in starts
onCheckInComplete() => void—Called when check-in completes
onCheckOutStart() => void—Called when check-out starts
onCheckOutComplete() => void—Called when check-out completes

DocyCheckInSheet

No additional props. Uses CheckInProvider context internally.

DocyCheckOutSheet

No additional props. Uses CheckInProvider context internally. Displays session info, notes textarea, outcome input, and submit/cancel buttons.

Components

ComponentDescription
CheckInProviderContext provider for check-in state
DocyCheckInButtonFloating action button (location icon → timer)
DocyCheckInSheetLocation/option selection sheet
DocyCheckOutSheetCheck-out form sheet with notes and outcome

Hooks

HookReturnsDescription
useCheckIn()CheckInContextTypeAccess check-in state and actions

Translation Keys

Built-in copy is read through useUiTranslation() — provide these keys via <UiTranslationProvider>. Without a provider the English fallback is shown.

KeyEnglish fallbackUsed for
ui.checkin.titleCheck InCheck-in sheet title
ui.checkin.tabAllAllTab
ui.checkin.tabRecentRecentTab
ui.checkin.tabFavoritesFavoritesTab
ui.checkin.emptyNo locations foundEmpty options list
ui.checkout.titleCheck OutCheck-out sheet title
ui.checkout.sessionLabelCurrent SessionSession card label
ui.checkout.startedAtStarted atSession start label
ui.checkout.notesLabelNotesNotes field label
ui.checkout.notesPlaceholderAdd any notes about this check-in...Notes placeholder
ui.checkout.outcomeLabelOutcomeOutcome field label
ui.checkout.outcomePlaceholderEnter outcomeOutcome placeholder
ui.checkout.submitComplete Check OutSubmit button
ui.common.cancelCancelCancel button
ui.checkout.locationInfoLocation will be captured on check-outLocation hint

Type Exports

TypeDescription
CheckInProviderPropsProps for CheckInProvider
DocyCheckInButtonPropsProps for DocyCheckInButton
CheckInOptionCheck-in option ({ id, label, icon?, color? })
CheckInSessionActive session ({ id, optionId, optionLabel, startTime, elapsedSeconds, location })

On this page