Skip to content

Commit 71d3467

Browse files
sgnyMoOx
authored andcommitted
Revise documentation for PanResponder API (#529)
1 parent 344537b commit 71d3467

1 file changed

Lines changed: 19 additions & 21 deletions

File tree

‎reason-react-native/src/apis/PanResponder.md‎

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ handlers are extended to also depend upon the `gestureState`.
1414
## Types
1515

1616
### `Event.pressEvent`
17-
see [`Event`](../Event/#pressEvent)
17+
see [`Event`](../Event/#pressevent)
1818

1919
### `gestureState`
2020
`gestureState` contains additional information on the state of the \_Gesture
@@ -66,7 +66,7 @@ config:
6666
=?,
6767
~onShouldBlockNativeResponder: (Event.pressEvent, gestureState) => bool=?,
6868
unit
69-
)
69+
) => config
7070
```
7171

7272
### `panHandlers`
@@ -89,112 +89,110 @@ where `'a` is either `bool` or `unit`
8989
`create` allows creation of a `PanResponder` given a `config`
9090

9191
```reason
92-
create(config)
92+
create: config => t
9393
```
9494

9595
### `panHandlers`
96-
`panHandlers` is a getter method to access `panHandlers` within a
97-
98-
`PanResponder`
96+
`panHandlers` is a getter method to access `panHandlers` within a `PanResponder`
9997

10098
```reason
101-
panHandlers(t)
99+
panHandlers: t => panHandlers
102100
```
103101

104102
### `onMoveShouldSetResponder`
105103
`onMoveShouldSetResponder` is a getter method to access the
106104
`onMoveShouldSetResponder` callback of a `panHandlers` object
107105

108106
```reason
109-
onMoveShouldSetResponder(panHandlers)
107+
onMoveShouldSetResponder: panHandlers => callback(bool)
110108
```
111109

112110
### `onMoveShouldSetResponderCapture`
113111
`onMoveShouldSetResponderCapture` is a getter method to access the
114112
`onMoveShouldSetResponderCapture` callback of a `panHandlers` object
115113

116114
```reason
117-
onMoveShouldSetResponderCapture(panHandlers)
115+
onMoveShouldSetResponderCapture: panHandlers => callback(bool)
118116
```
119117

120118
### `onStartShouldSetResponder`
121119
`onStartShouldSetResponder` is a getter method to access the
122120
`onStartShouldSetResponder` callback of a `panHandlers` object
123121

124122
```reason
125-
onStartShouldSetResponder(panHandlers)
123+
onStartShouldSetResponder: panHandlers => callback(bool)
126124
```
127125

128126
### `onStartShouldSetResponderCapture`
129127
`onStartShouldSetResponderCapture` is a getter method to access the
130128
`onStartShouldSetResponderCapture` callback of a `panHandlers` object
131129

132130
```reason
133-
onStartShouldSetResponderCapture(panHandlers)
131+
onStartShouldSetResponderCapture: panHandlers => callback(bool)
134132
```
135133

136134
### `onResponderReject`
137135
`onResponderReject` is a getter method to access the `onResponderReject`
138136
callback of a `panHandlers` object
139137

140138
```reason
141-
onResponderReject(panHandlers)
139+
onResponderReject: panHandlers => callback(unit)
142140
```
143141

144142
### `onResponderGrant`
145143
`onResponderGrant` is a getter method to access the `onResponderGrant`
146144
callback of a `panHandlers` object
147145

148146
```reason
149-
onResponderGrant(panHandlers)
147+
onResponderGrant: panHandlers => callback(unit)
150148
```
151149

152150
### `onResponderRelease`
153151
`onResponderRelease` is a getter method to access the `onResponderRelease`
154152
callback of a `panHandlers` object
155153

156154
```reason
157-
onResponderRelease(panHandlers)
155+
onResponderRelease: panHandlers => callback(unit)
158156
```
159157

160158
### `onResponderMove`
161159
`onResponderMove` is a getter method to access the `onResponderMove` callback
162160
of a `panHandlers` object
163161

164162
```reason
165-
onResponderMove(panHandlers)
163+
onResponderMove: panHandlers => callback(unit)
166164
```
167165

168166
### `onResponderTerminate`
169167
`onResponderTerminate` is a getter method to access the `onResponderTerminate`
170168
callback of a `panHandlers` object
171169

172170
```reason
173-
onResponderTerminate(panHandlers)
171+
onResponderTerminate: panHandlers => callback(unit)
174172
```
175173

176174
### `onResponderStart`
177175
`onResponderStart` is a getter method to access the `onResponderStart`
178176
callback of a `panHandlers` object
179177

180178
```reason
181-
onResponderStart(panHandlers)
179+
onResponderStart: panHandlers => callback(unit)
182180
```
183181

184182
### `onResponderTerminationRequest`
185183
`onResponderTerminationRequest` is a getter method to access the
186184
`onResponderTerminationRequest` callback of a `panHandlers` object
187185

188186
```reason
189-
onResponderTerminationRequest(panHandlers)
187+
onResponderTerminationRequest: panHandlers => callback(bool)
190188
```
191189

192190
### `onResponderEnd`
193191
`onResponderEnd` is a getter method to access the `onResponderEnd` callback of
194192
a `panHandlers` object
195193

196194
```reason
197-
onResponderEnd(panHandlers)
195+
onResponderEnd: panHandlers => callback(unit)
198196
```
199197

200198
## Example
@@ -236,8 +234,8 @@ Then, the custom `PanResponder` can be used as below:
236234
```reason
237235
open ReactNative;
238236
239-
let windowHeight = Dimensions.get(`window)##height->float_of_int;
240-
let windowWidth = Dimensions.get(`window)##width->float_of_int;
237+
let windowHeight = Dimensions.get(`window)##height;
238+
let windowWidth = Dimensions.get(`window)##width;
241239
242240
let containerStyle =
243241
Style.(

0 commit comments

Comments
 (0)