JindongProvider
Provider component that enables haptic feedback in the composition tree
JindongProvider
Module: jindong-compose | Package: io.github.compose.jindong
Provider component that creates and provides a HapticExecutor to the composition tree.
Signature
Parameters
| Parameter | Type | Description |
|---|---|---|
content | @Composable () -> Unit | The composable content to provide the executor to |
Description
JindongProvider is a wrapper component that:
- Creates a platform-specific
HapticExecutor - Makes it available via
LocalHapticExecutorCompositionLocal - Handles executor lifecycle (creation and disposal)
Platform Context
The provider automatically obtains the platform context:
- Android: Uses
LocalContext.current - iOS: No context needed
Usage
Basic Usage
Wrap your app content with JindongProvider:
With Other Providers
JindongProvider can be nested with other providers:
Typical Setup
Lifecycle
The provider manages the HapticExecutor lifecycle:
- Creation: Executor created when provider enters composition
- Disposal:
executor.release()called when provider leaves composition
Requirements
Android
Ensure the VIBRATE permission is declared:
iOS
No additional requirements. Core Haptics available on iOS 13+.
Notes
- Place at the root of your app or feature module
- Only one provider needed per composition tree
- Nested providers will create separate executors (usually not desired)
- The executor is automatically cleaned up when the provider is disposed