Modifiers
createModifier
Factory function to create modifier configuration objects. This is used by all built-in modifier functions and can be used by 3rd party libraries to create custom modifiers.
createModifier(type, params)
| Parameter | Type | Description |
|---|---|---|
type | string | The modifier type string that maps to a registered native modifier. |
params(optional) | Record<string, any> | Additional parameters to pass to the modifier. Default: {} |
Factory function to create modifier configuration objects. This is used by all built-in modifier functions and can be used by 3rd party libraries to create custom modifiers.
Returns: ModifierConfig
A ModifierConfig object that can be passed in the modifiers prop array.
Example
// In a 3rd party package
import { createModifier } from '@expo/ui/swift-ui/modifiers';
export const blurEffect = (params: { radius: number; style?: string }) =>
createModifier('blurEffect', params);Works with
This modifier works with any view. These components accept it:
- VStack
- HStack
- ZStack
- LazyVStack
- LazyHStack
- Group
- Spacer
- Divider
- Overlay
- ScrollView
- Button
- Toggle
- Checkbox
- Slider
- Picker
- DatePicker
- ColorPicker
- Link
- ControlGroup
- Menu
- ContextMenu
- TextField
- SecureField
- Text
- Label
- Image
- List
- Form
- Section
- DisclosureGroup
- SwipeActions
- BottomSheet
- Alert
- ConfirmationDialog
- Popover
- ProgressView
- Gauge
- TabView
- AccessoryWidgetBackground
Sources
The original Expo docs for this page:
- createModifier (Modifiers) (
source-of-truth/versions/v57.0.0/sdk/ui/swift-ui/modifiers.md)