📲
HC Mobile App UI Docs
  • Introduction
  • Foundations
    • Colors
    • Icons
    • Layout Primitives
    • Theming
  • Typography
    • Heading
    • Text
    • Custom Fonts
  • Components
    • Accordion
    • Avatar
    • Bottom Sheet
    • Button
    • Button Group
    • Card List
    • Card List Item
    • Checkbox
    • Chip
    • Date Picker
    • Divider
    • Expandable Card
    • Floater
    • Horizontal List
    • Icon
    • Icon Toggle
    • Link
    • List Header
    • Lower Prompt
    • Nestable List
    • Pill Toggle
    • Radio
    • Select Picker
    • Selectable List
    • Text Input
    • Tiles
  • Utilities
    • Device Utilities
    • Layout Utilities
  • Resources
    • Issues
    • Changelog
    • GitHub
Powered by GitBook
On this page
  1. Utilities

Layout Utilities

PreviousDevice Utilities

Last updated 3 years ago

CtrlK
  • addHitSlop
  • Params
  • Usage

addHitSlop

Returns an object to be used as a value for hitslop

Params

addHitSlop(top: number, right: number, bottom: number, left: number)

Usage

import { LayoutUtils } from 'hc-mobile-app-ui';

// Add 12px to all sides
const touchableArea = LayoutUtils.addHitSlop(12);

// Add 12px to top and 24px to bottom
const touchableArea = LayoutUtils.addHitSlop(12, 0, 24);

// Add 12px to vertical and 24px to horizontal sides
const touchableArea = LayoutUtils.addHitSlop(12, 24);

// Add different sizes to different sides (T, R, D, L)
const touchableArea = LayoutUtils.addHitSlop(12, 13, 14, 15);