Skip to content

Commit d9cc846

Browse files
committed
Merge branch 'master' of github.com:react-native-community/hooks
2 parents bf8ee03 + 13de2fd commit d9cc846

File tree

5 files changed

+68
-8
lines changed

5 files changed

+68
-8
lines changed

.all-contributorsrc

+3-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@
194194
"avatar_url": "https://avatars1.githubusercontent.com/u/17288652?v=4",
195195
"profile": "https://github.com/Gamal-Shaban",
196196
"contributions": [
197-
"code"
197+
"code",
198+
"doc",
199+
"test"
198200
]
199201
}
200202
],

CHANGELOG.md

+48
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,51 @@
1+
# v2.4.9 (Mon Apr 13 2020)
2+
3+
:tada: This release contains work from a new contributor! :tada:
4+
5+
Thank you, WhiteSource Renovate ([@renovate-bot](https://github.com/renovate-bot)), for all your work!
6+
7+
#### 🐛 Bug Fix
8+
9+
- Update dependency @auto-it/first-time-contributor to v9.26.4 [#134](https://github.com/react-native-community/hooks/pull/134) ([@renovate-bot](https://github.com/renovate-bot))
10+
- add value to Coordinates when hide [#120](https://github.com/react-native-community/hooks/pull/120) ([@Gamal-Shaban](https://github.com/Gamal-Shaban) [@pvinis](https://github.com/pvinis))
11+
- Update dependency @auto-it/all-contributors to v9.26.8 [#114](https://github.com/react-native-community/hooks/pull/114) ([@renovate-bot](https://github.com/renovate-bot) [@renovate[bot]](https://github.com/renovate[bot]))
12+
- Update dependency ts-jest to v25.3.1 [#119](https://github.com/react-native-community/hooks/pull/119) ([@renovate-bot](https://github.com/renovate-bot) [@renovate[bot]](https://github.com/renovate[bot]))
13+
- Update dependency @types/react-native to v0.62.2 [#110](https://github.com/react-native-community/hooks/pull/110) ([@renovate-bot](https://github.com/renovate-bot) [@renovate[bot]](https://github.com/renovate[bot]))
14+
- Update dependency auto to v9.26.8 [#123](https://github.com/react-native-community/hooks/pull/123) ([@renovate-bot](https://github.com/renovate-bot) [@renovate[bot]](https://github.com/renovate[bot]))
15+
- Update dependency jest to v25.3.0 [#138](https://github.com/react-native-community/hooks/pull/138) ([@renovate-bot](https://github.com/renovate-bot) [@renovate[bot]](https://github.com/renovate[bot]))
16+
- Update rn orb to v4 [#141](https://github.com/react-native-community/hooks/pull/141) ([@renovate-bot](https://github.com/renovate-bot) [@renovate[bot]](https://github.com/renovate[bot]))
17+
- Update dependency eslint-plugin-prettier to v3.1.3 [#142](https://github.com/react-native-community/hooks/pull/142) ([@renovate-bot](https://github.com/renovate-bot))
18+
- Update dependency @auto-it/first-time-contributor to v9.26.8 [#137](https://github.com/react-native-community/hooks/pull/137) ([@renovate-bot](https://github.com/renovate-bot))
19+
- Update dependency react-native to v0.62.2 [#139](https://github.com/react-native-community/hooks/pull/139) ([@renovate-bot](https://github.com/renovate-bot))
20+
- Update dependency @auto-it/first-time-contributor to v9.26.6 [#136](https://github.com/react-native-community/hooks/pull/136) ([@renovate-bot](https://github.com/renovate-bot))
21+
- Update dependency @auto-it/first-time-contributor to v9.26.5 [#135](https://github.com/react-native-community/hooks/pull/135) ([@renovate-bot](https://github.com/renovate-bot))
22+
- Update dependency @types/jest to v25.2.1 [#129](https://github.com/react-native-community/hooks/pull/129) ([@renovate-bot](https://github.com/renovate-bot) [@renovate[bot]](https://github.com/renovate[bot]))
23+
- Update dependency @auto-it/first-time-contributor to v9.26.3 [#133](https://github.com/react-native-community/hooks/pull/133) ([@renovate-bot](https://github.com/renovate-bot))
24+
- Update dependency @auto-it/first-time-contributor to v9.26.2 [#132](https://github.com/react-native-community/hooks/pull/132) ([@renovate-bot](https://github.com/renovate-bot))
25+
- Update dependency prettier to v2.0.4 [#131](https://github.com/react-native-community/hooks/pull/131) ([@renovate-bot](https://github.com/renovate-bot))
26+
- Update dependency @auto-it/first-time-contributor to v9.26.1 [#115](https://github.com/react-native-community/hooks/pull/115) ([@renovate-bot](https://github.com/renovate-bot) [@renovate[bot]](https://github.com/renovate[bot]))
27+
- Update dependency prettier to v2.0.3 [#130](https://github.com/react-native-community/hooks/pull/130) ([@renovate-bot](https://github.com/renovate-bot))
28+
- Update dependency react-native to v0.62.1 [#128](https://github.com/react-native-community/hooks/pull/128) ([@renovate-bot](https://github.com/renovate-bot))
29+
- Update dependency jest to v25.2.7 [#127](https://github.com/react-native-community/hooks/pull/127) ([@renovate-bot](https://github.com/renovate-bot))
30+
- Update dependency @types/jest to v25.1.5 [#126](https://github.com/react-native-community/hooks/pull/126) ([@renovate-bot](https://github.com/renovate-bot))
31+
- Update dependency all-contributors-cli to v6.14.1 [#125](https://github.com/react-native-community/hooks/pull/125) ([@renovate-bot](https://github.com/renovate-bot))
32+
- Update dependency jest to v25.2.6 [#124](https://github.com/react-native-community/hooks/pull/124) ([@renovate-bot](https://github.com/renovate-bot))
33+
- Update dependency auto to v9.22.4 [#122](https://github.com/react-native-community/hooks/pull/122) ([@renovate-bot](https://github.com/renovate-bot))
34+
- Update dependency auto to v9.22.2 [#121](https://github.com/react-native-community/hooks/pull/121) ([@renovate-bot](https://github.com/renovate-bot))
35+
36+
#### ⚠️ Pushed to `master`
37+
38+
- dont worry about canary, since we cant publish from forks ([@pvinis](https://github.com/pvinis))
39+
40+
#### Authors: 4
41+
42+
- [@renovate[bot]](https://github.com/renovate[bot])
43+
- Gamal Shaban ([@Gamal-Shaban](https://github.com/Gamal-Shaban))
44+
- Pavlos Vinieratos ([@pvinis](https://github.com/pvinis))
45+
- WhiteSource Renovate ([@renovate-bot](https://github.com/renovate-bot))
46+
47+
---
48+
149
# v2.4.8 (Mon Mar 30 2020)
250

351
:tada: This release contains work from new contributors! :tada:

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
186186
<td align="center"><a href="https://dylanvann.com/"><img src="https://avatars0.githubusercontent.com/u/1537615?v=4" width="100px;" alt=""/><br /><sub><b>Dylan Vann</b></sub></a><br /><a href="https://github.com/react-native-community/hooks/commits?author=DylanVann" title="Code">💻</a></td>
187187
<td align="center"><a href="https://github.com/thinklinux"><img src="https://avatars1.githubusercontent.com/u/326949?v=4" width="100px;" alt=""/><br /><sub><b>Tihomir Valkanov</b></sub></a><br /><a href="https://github.com/react-native-community/hooks/commits?author=thinklinux" title="Documentation">📖</a></td>
188188
<td align="center"><a href="http://twitter.com/pistoudev"><img src="https://avatars1.githubusercontent.com/u/6703711?v=4" width="100px;" alt=""/><br /><sub><b>Pierre Skowron</b></sub></a><br /><a href="https://github.com/react-native-community/hooks/commits?author=pistou" title="Code">💻</a></td>
189-
<td align="center"><a href="https://github.com/Gamal-Shaban"><img src="https://avatars1.githubusercontent.com/u/17288652?v=4" width="100px;" alt=""/><br /><sub><b>Gamal Shaban</b></sub></a><br /><a href="https://github.com/react-native-community/hooks/commits?author=Gamal-Shaban" title="Code">💻</a></td>
189+
<td align="center"><a href="https://github.com/Gamal-Shaban"><img src="https://avatars1.githubusercontent.com/u/17288652?v=4" width="100px;" alt=""/><br /><sub><b>Gamal Shaban</b></sub></a><br /><a href="https://github.com/react-native-community/hooks/commits?author=Gamal-Shaban" title="Code">💻</a> <a href="https://github.com/react-native-community/hooks/commits?author=Gamal-Shaban" title="Documentation">📖</a> <a href="https://github.com/react-native-community/hooks/commits?author=Gamal-Shaban" title="Tests">⚠️</a></td>
190190
</tr>
191191
</table>
192192

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@react-native-community/hooks",
3-
"version": "2.4.8",
3+
"version": "2.4.9",
44
"description": "",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",

src/useKeyboard.ts

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
import {useEffect, useState} from 'react'
22
import {Keyboard, KeyboardEventListener, ScreenRect} from 'react-native'
33

4+
const emptyCoordinates = Object.freeze({
5+
screenX: 0,
6+
screenY: 0,
7+
width: 0,
8+
height: 0,
9+
})
10+
const initialValue = {
11+
start: emptyCoordinates,
12+
end: emptyCoordinates,
13+
}
14+
415
export function useKeyboard() {
516
const [shown, setShown] = useState(false)
617
const [coordinates, setCoordinates] = useState<{
718
start: ScreenRect
819
end: ScreenRect
9-
}>({
10-
start: {screenX: 0, screenY: 0, width: 0, height: 0},
11-
end: {screenX: 0, screenY: 0, width: 0, height: 0},
12-
})
20+
}>(initialValue)
1321
const [keyboardHeight, setKeyboardHeight] = useState<number>(0)
1422

1523
const handleKeyboardWillShow: KeyboardEventListener = (e) => {
@@ -27,8 +35,10 @@ export function useKeyboard() {
2735
setShown(false)
2836
if (e) {
2937
setCoordinates({start: e.startCoordinates, end: e.endCoordinates})
38+
} else {
39+
setCoordinates(initialValue)
40+
setKeyboardHeight(0)
3041
}
31-
setKeyboardHeight(0)
3242
}
3343

3444
useEffect(() => {

0 commit comments

Comments
 (0)