Skip to content

Commit e250c68

Browse files
committed
Use CollapsibleCode
1 parent aa13ec4 commit e250c68

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

packages/docs-gesture-handler/docs/fundamentals/callbacks-events.mdx

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebar_position: 5
66
---
77

88
import {GestureEventFlowChart, TouchEventFlowChart} from '@site/src/examples/CallbacksFlowCharts'
9-
import CodeWithTypes from '@site/src/components/CodeWithTypes';
9+
import CollapsibleCode from '@site/src/components/CollapsibleCode';
1010

1111
At any given time, each handler instance has an assigned [state](/docs/under-the-hood/state) that can change when new touch events occur or can be forced to change by the touch system in certain circumstances. You can hook into state transitions using specific [gesture callbacks](#callbacks).
1212

@@ -103,30 +103,35 @@ Called when there will be no more information about this pointer. It may be call
103103

104104
### GestureEvent
105105

106-
<CodeWithTypes
107-
srcCode={`
106+
<CollapsibleCode
107+
label="Show composed types definitions"
108+
expandedLabel="Hide composed types definitions"
109+
lineBounds={[0, 4]}
110+
src={`
108111
export type GestureEvent<HandlerData> = {
109112
handlerTag: number;
110113
numberOfPointers: number;
111114
pointerType: PointerType;
112115
} & HandlerData;
113-
`}
114-
srcDetails={`
116+
115117
export enum PointerType {
116118
TOUCH,
117119
STYLUS,
118120
MOUSE,
119121
KEY,
120122
OTHER,
121-
}`}
122-
/>
123+
}
124+
`}/>
123125

124126
`GestureEvent` contains properties common to all gestures (`handlerTag`, `numberOfPointers`, `pointerType`) along with gesture-specific data defined in each gesture's documentation.
125127

126128
### TouchEvent
127129

128-
<CodeWithTypes
129-
srcCode={`
130+
<CollapsibleCode
131+
label="Show composed types definitions"
132+
expandedLabel="Hide composed types definitions"
133+
lineBounds={[0, 8]}
134+
src={`
130135
export type GestureTouchEvent = {
131136
handlerTag: number;
132137
numberOfTouches: number;
@@ -136,8 +141,7 @@ export type GestureTouchEvent = {
136141
changedTouches: TouchData[];
137142
pointerType: PointerType;
138143
};
139-
`}
140-
srcDetails={`
144+
141145
export const State = {
142146
UNDETERMINED: 0,
143147
FAILED: 1,
@@ -170,7 +174,6 @@ export enum PointerType {
170174
KEY,
171175
OTHER,
172176
}
173-
`}
174-
/>
177+
`}/>
175178

176179
`TouchEvent` carries information about raw touch events, like touching the screen or moving the finger.

0 commit comments

Comments
 (0)