Skip to content

Commit d9c9cf5

Browse files
authored
Improve <FocusManager /> types (#130)
1 parent 6ea136d commit d9c9cf5

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

src/index.js.flow

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@ type FocusManagerChange = (focused: boolean) => void
6262
type FocusManagerRender = ({|
6363
focused: boolean,
6464
blur: () => void,
65-
bind: {| tabIndex: number, onFocus: () => void, onBlur: () => void |},
65+
bind: {|
66+
tabIndex: number,
67+
onFocus: () => void,
68+
onBlur: () => void,
69+
onMouseDown: () => void,
70+
onMouseUp: () => void,
71+
|},
6672
|}) => React.Node
6773

6874
declare export var FocusManager: React.ComponentType<

tests/test_flow.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,18 @@ const noop = () => null
187187
;(blur: Function)
188188
;(bind.onFocus: Function)
189189
;(bind.onBlur: Function)
190+
;(bind.onMouseDown: Function)
191+
;(bind.onMouseUp: Function)
190192
// $FlowFixMe
191193
;(focused: number)
192194
// $FlowFixMe
193195
;(bind.onFocus: number)
194196
// $FlowFixMe
195197
;(bind.onBlur: number)
198+
// $FlowFixMe
199+
;(bind.onMouseDown: number)
200+
// $FlowFixMe
201+
;(bind.onMouseUp: number)
196202
return null
197203
}
198204
const onChange = focused => {

types/index.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,13 @@ export type FocusManagerChange = Callback<boolean>
6666
export type FocusManagerRender = RenderFn<{
6767
focused: boolean
6868
blur: () => void
69-
bind: { tabIndex: number; onFocus: () => void; onBlur: () => void }
69+
bind: {
70+
tabIndex: number
71+
onFocus: () => void
72+
onBlur: () => void
73+
onMouseDown: () => void
74+
onMouseUp: () => void
75+
}
7076
}>
7177

7278
export const FocusManager: React.ComponentType<

0 commit comments

Comments
 (0)