File tree Expand file tree Collapse file tree 3 files changed +33
-21
lines changed
Expand file tree Collapse file tree 3 files changed +33
-21
lines changed Original file line number Diff line number Diff line change @@ -179,11 +179,9 @@ export function SomeScreen() {
179179
180180## Types (inputs)
181181
182- | Type | Values |
183- | --------------------- | ----------------------------- |
184- | ` HapticEventType ` | ` 'transient' \| 'continuous' ` |
185- | ` HapticParameterType ` | ` 'intensity' \| 'sharpness' ` |
186- | ` HapticCurveType ` | ` 'intensity' \| 'sharpness' ` |
182+ | Type | Values |
183+ | --------------------- | ---------------------------- |
184+ | ` HapticParameterType ` | ` 'intensity' \| 'sharpness' ` |
187185
188186| ` HapticEventParameter ` | Type |
189187| ---------------------- | --------------------- |
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import type { HybridObject } from 'react-native-nitro-modules';
22
33export type HapticEventType = 'transient' | 'continuous' ;
44export type HapticParameterType = 'intensity' | 'sharpness' ;
5- export type HapticCurveType = 'intensity' | 'sharpness' ;
5+
66export type HapticEventParameter = {
77 type : HapticParameterType ;
88 value : number ;
@@ -12,21 +12,15 @@ export type HapticCurveControlPoint = {
1212 value : number ;
1313} ;
1414
15- export type HapticEvent =
16- | {
17- type : 'transient' ;
18- parameters : HapticEventParameter [ ] ;
19- relativeTime : number ;
20- }
21- | {
22- type : 'continuous' ;
23- parameters : HapticEventParameter [ ] ;
24- relativeTime : number ;
25- duration : number ;
26- } ;
15+ export type HapticEvent = {
16+ type : HapticEventType ;
17+ parameters : HapticEventParameter [ ] ;
18+ relativeTime : number ;
19+ duration ?: number ; // Optional for transient events
20+ } ;
2721
2822export type HapticCurve = {
29- type : HapticCurveType ;
23+ type : HapticParameterType ;
3024 controlPoints : HapticCurveControlPoint [ ] ;
3125 relativeTime : number ;
3226} ;
Original file line number Diff line number Diff line change 11import { useEffect } from 'react' ;
22import { AppState } from 'react-native' ;
33import { NitroModules } from 'react-native-nitro-modules' ;
4- import type { Ahap , HapticCurve , HapticEvent } from './Ahap.nitro' ;
4+ import type {
5+ Ahap ,
6+ HapticCurve ,
7+ HapticEventParameter ,
8+ HapticParameterType ,
9+ } from './Ahap.nitro' ;
10+
11+ export type TransientHapticEvent = {
12+ type : 'transient' ;
13+ parameters : HapticEventParameter [ ] ;
14+ relativeTime : number ;
15+ } ;
16+
17+ export type ContinuousHapticEvent = {
18+ type : 'continuous' ;
19+ parameters : HapticEventParameter [ ] ;
20+ relativeTime : number ;
21+ duration : number ;
22+ } ;
23+
24+ export type HapticEvent = TransientHapticEvent | ContinuousHapticEvent ;
525
626const AhapHybridObject = NitroModules . createHybridObject < Ahap > ( 'Ahap' ) ;
727
@@ -93,4 +113,4 @@ export function HapticProvider({ children }: { children: React.ReactNode }) {
93113}
94114
95115export { AhapHybridObject } ;
96- export type { HapticCurve , HapticEvent } ;
116+ export type { HapticCurve , HapticEventParameter , HapticParameterType } ;
You can’t perform that action at this time.
0 commit comments