Skip to content

Commit 51d848f

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents a4fb485 + d9cc846 commit 51d848f

File tree

8 files changed

+951
-671
lines changed

8 files changed

+951
-671
lines changed

.all-contributorsrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,17 @@
187187
"contributions": [
188188
"code"
189189
]
190+
},
191+
{
192+
"login": "Gamal-Shaban",
193+
"name": "Gamal Shaban",
194+
"avatar_url": "https://avatars1.githubusercontent.com/u/17288652?v=4",
195+
"profile": "https://github.com/Gamal-Shaban",
196+
"contributions": [
197+
"code",
198+
"doc",
199+
"test"
200+
]
190201
}
191202
],
192203
"contributorsPerLine": 7

.circleci/config.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2.1
22

33

44
orbs:
5-
rn: react-native-community/react-native@3.0.1
5+
rn: react-native-community/react-native@4.1.0
66

77

88
jobs:
@@ -52,12 +52,12 @@ workflows:
5252
- analyze:
5353
requires:
5454
- checkout_code
55-
- release-canary:
56-
requires:
57-
- analyze
58-
filters:
59-
branches:
60-
ignore: master
55+
# - release-canary:
56+
# requires:
57+
# - analyze
58+
# filters:
59+
# branches:
60+
# ignore: master
6161
- release:
6262
requires:
6363
- analyze

CHANGELOG.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,97 @@
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+
49+
# v2.4.8 (Mon Mar 30 2020)
50+
51+
:tada: This release contains work from new contributors! :tada:
52+
53+
Thanks for all your work!
54+
55+
:heart: Gamal Shaban ([@Gamal-Shaban](https://github.com/Gamal-Shaban))
56+
57+
:heart: WhiteSource Renovate ([@renovate-bot](https://github.com/renovate-bot))
58+
59+
#### 🐛 Bug Fix
60+
61+
- Update dependency react-native to v0.62.0 [#105](https://github.com/react-native-community/hooks/pull/105) ([@renovate-bot](https://github.com/renovate-bot) [@renovate[bot]](https://github.com/renovate[bot]))
62+
- fix crash in android when hide keyboard [#117](https://github.com/react-native-community/hooks/pull/117) ([@Gamal-Shaban](https://github.com/Gamal-Shaban))
63+
- Update dependency auto to v9.22.1 [#116](https://github.com/react-native-community/hooks/pull/116) ([@renovate-bot](https://github.com/renovate-bot) [@renovate[bot]](https://github.com/renovate[bot]))
64+
- Update dependency @auto-it/first-time-contributor to v9.21.2 [#112](https://github.com/react-native-community/hooks/pull/112) ([@renovate-bot](https://github.com/renovate-bot))
65+
- Update dependency auto to v9.21.2 [#113](https://github.com/react-native-community/hooks/pull/113) ([@renovate-bot](https://github.com/renovate-bot))
66+
- Update dependency @auto-it/all-contributors to v9.21.2 [#111](https://github.com/react-native-community/hooks/pull/111) ([@renovate-bot](https://github.com/renovate-bot))
67+
- Update dependency @react-native-community/eslint-config to v1 [#109](https://github.com/react-native-community/hooks/pull/109) ([@renovate-bot](https://github.com/renovate-bot) [@renovate[bot]](https://github.com/renovate[bot]))
68+
- Update dependency jest to v25.2.3 [#108](https://github.com/react-native-community/hooks/pull/108) ([@renovate-bot](https://github.com/renovate-bot))
69+
- [META] Stop using default export internally [#106](https://github.com/react-native-community/hooks/pull/106) ([@pvinis](https://github.com/pvinis))
70+
- Update dependency jest to v25.2.4 [#118](https://github.com/react-native-community/hooks/pull/118) ([@renovate-bot](https://github.com/renovate-bot))
71+
- Update dependency jest to v25.2.2 [#104](https://github.com/react-native-community/hooks/pull/104) ([@renovate-bot](https://github.com/renovate-bot))
72+
- Update dependency jest to v25.2.1 [#103](https://github.com/react-native-community/hooks/pull/103) ([@renovate-bot](https://github.com/renovate-bot))
73+
- Update dependency jest to v25.2.0 [#102](https://github.com/react-native-community/hooks/pull/102) ([@renovate-bot](https://github.com/renovate-bot) [@renovate[bot]](https://github.com/renovate[bot]))
74+
- Update dependency @types/react to v16.9.25 [#98](https://github.com/react-native-community/hooks/pull/98) ([@renovate-bot](https://github.com/renovate-bot) [@renovate[bot]](https://github.com/renovate[bot]))
75+
- Update dependency @auto-it/first-time-contributor to v9.20.1 [#93](https://github.com/react-native-community/hooks/pull/93) ([@renovate-bot](https://github.com/renovate-bot))
76+
- Update dependency auto to v9.20.1 [#94](https://github.com/react-native-community/hooks/pull/94) ([@renovate-bot](https://github.com/renovate-bot))
77+
- Update dependency @auto-it/all-contributors to v9.20.1 [#92](https://github.com/react-native-community/hooks/pull/92) ([@renovate-bot](https://github.com/renovate-bot))
78+
- Update react monorepo to v16.13.1 [#91](https://github.com/react-native-community/hooks/pull/91) ([@renovate-bot](https://github.com/renovate-bot))
79+
80+
#### ⚠️ Pushed to `master`
81+
82+
- get rid of some shadowing ([@pvinis](https://github.com/pvinis))
83+
- bump pretteir ([@pvinis](https://github.com/pvinis))
84+
- upg ([@pvinis](https://github.com/pvinis))
85+
86+
#### Authors: 4
87+
88+
- [@renovate[bot]](https://github.com/renovate[bot])
89+
- Gamal Shaban ([@Gamal-Shaban](https://github.com/Gamal-Shaban))
90+
- Pavlos Vinieratos ([@pvinis](https://github.com/pvinis))
91+
- WhiteSource Renovate ([@renovate-bot](https://github.com/renovate-bot))
92+
93+
---
94+
195
# v2.4.7 (Thu Mar 19 2020)
296

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

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
204204
<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>
205205
<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>
206206
<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>
207+
<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>
207208
</tr>
208209
</table>
209210

package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@react-native-community/hooks",
3-
"version": "2.4.7",
3+
"version": "2.4.9",
44
"description": "",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",
@@ -19,24 +19,24 @@
1919
"react-native": ">=0.59"
2020
},
2121
"devDependencies": {
22-
"@auto-it/all-contributors": "9.21.0",
23-
"@auto-it/first-time-contributor": "9.21.0",
24-
"@react-native-community/eslint-config": "0.0.7",
22+
"@auto-it/all-contributors": "9.26.8",
23+
"@auto-it/first-time-contributor": "9.26.8",
24+
"@react-native-community/eslint-config": "1.0.0",
2525
"@testing-library/react-hooks": "3.2.1",
2626
"@testing-library/react-native": "5.0.3",
27-
"@types/jest": "25.1.4",
28-
"@types/react": "16.9.25",
29-
"@types/react-native": "0.61.23",
30-
"all-contributors-cli": "6.14.0",
31-
"auto": "9.21.0",
27+
"@types/jest": "25.2.1",
28+
"@types/react": "16.9.34",
29+
"@types/react-native": "0.62.2",
30+
"all-contributors-cli": "6.14.1",
31+
"auto": "9.26.8",
3232
"eslint": "6.8.0",
33-
"eslint-plugin-prettier": "3.1.2",
34-
"jest": "25.2.2",
35-
"prettier": "2.0.2",
33+
"eslint-plugin-prettier": "3.1.3",
34+
"jest": "25.3.0",
35+
"prettier": "2.0.4",
3636
"react": "16.13.1",
37-
"react-native": "0.62.0",
37+
"react-native": "0.62.2",
3838
"react-test-renderer": "16.13.1",
39-
"ts-jest": "25.2.1",
39+
"ts-jest": "25.3.1",
4040
"typescript": "3.8.3"
4141
},
4242
"author": "Nader Dabit",

src/useKeyboard.ts

Lines changed: 18 additions & 6 deletions
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) => {
@@ -25,8 +33,12 @@ export function useKeyboard() {
2533
}
2634
const handleKeyboardDidHide: KeyboardEventListener = (e) => {
2735
setShown(false)
28-
setCoordinates({start: e.startCoordinates, end: e.endCoordinates})
29-
setKeyboardHeight(0)
36+
if (e) {
37+
setCoordinates({start: e.startCoordinates, end: e.endCoordinates})
38+
} else {
39+
setCoordinates(initialValue)
40+
setKeyboardHeight(0)
41+
}
3042
}
3143

3244
useEffect(() => {

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
2222
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
2323
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
24+
"skipLibCheck": true,
2425

2526
/* Strict Type-Checking Options */
2627
"strict": true, /* Enable all strict type-checking options. */

0 commit comments

Comments
 (0)