Commit a57fa4b
feat:
## 📜 Description
Added `KeyboardBackgroundView` - component designed to match keyboard
backdrop UI.
## 💡 Motivation and Context
This component can be useful when you want to continue keyboard surface
and embed advanced elements (such as `TextInput` inside it). Using this
component you can achieve a similar UI to Photos app or Safari app
search on iOS. Additioanlly this component will be used as a polyfill
implementation for `KeyboardExtender` on Android (just because
`KeyboardExtender` can not be implemented natively on Android).
> [!WARNING]
> This component only matches default keyboard UI background. If user
customizes it -> it will look differently and will not match keyboard
design. There is no way to check displayed keyboard color on a native
side, but some apps still use this approach, so I thought to export that
possibility from `keyboard-controller` too.
On iOS we can use system class `UIKBBackdropView` to match the keyboard
background. On Android keyboard is a 3rd party process so there is no
API at all, so I kind of reverse-engineered it: we have an access to
keyboard package name and then based on pacakge name and phone
preferences we can "guess" keyboard color. In reality it may vary from
OS version o OS version and may be even dynamic and depend on wallpaper
generic color. To solve it I Added a class that has a basic color (can
be dynamic too) and then we have additional property called `tone`,
which can slightly adjust the color. The idea is that color like
`#3c3c3c` with tone `+2` will become `#3e3e3e`. For now it works and we
can successfully match default keyboard color.
## 📢 Changelog
<!-- High level overview of important changes -->
<!-- For example: fixed status bar manipulation; added new types
declarations; -->
<!-- If your changes don't affect one of platform/language below - then
remove this platform/language -->
### E2E
- cover `KeyboardBackgroundView` by e2e tests;
### Docs
- mention new feature in README;
- new docs page `KeyboardBackgroundView`;
- new chapter in Components Overview guide.
### JS
- added `KeyboardBackgroundView`;
- added unit-tests for `KeyboardBackgroundView`.
### iOS
- added `KeyboardBackgroundView`;
### Android
- added `KeyboardBackgroundView`;
- move `isSystemDarkMode` extensions to `Context`;
- create new `currentImePackage` extension;
- create resource files;
## 🤔 How Has This Been Tested?
Tested manually on:
- Pixel 7 Pro (API 35, API 36 - real device);
- Pixel 9 Pro (API 31, API 33, API 34, API 35, API 36 - emulator);
- Xiaomi Redmi Note 5 Pro (API 28 - real device);
- iPhone 11 (iOS 18.5 - real device);
- iPhone 6s (iOS 15.8 - real device);
- iPhone 14 Pro (iOS 18.4 - real device).
- iPhone 16 Pro (iOS 18.5, 26.0 - simulator)
- iPhone 15 Pro (iOS 17.5 - simulator)
plus tested on all e2e devices (via e2e tests).
## 📸 Screenshots (if appropriate):
### Shared surface
|Android|iOS|
|--------|---|
|<img width="300" alt="android"
src="https://github.com/user-attachments/assets/1bbbbdf3-17af-4277-a33a-390a413c50e5"
/>|<img width="300" alt="android"
src="https://github.com/user-attachments/assets/489ace49-8a68-4fdf-a98a-bd4bdc0a0418">|
### "Meatball"/Ask AI/Liquid keyboard
|Android|iOS|
|--------|---|
|<video
src="https://github.com/user-attachments/assets/ac3efba6-2a6a-43a1-b0ee-501e2b5be361">|<video
src="https://github.com/user-attachments/assets/2f7d5c3e-4e32-43d9-b2d4-9658accc757a">|
## 📝 Checklist
- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changed
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>KeyboardBackgroundView (#981)1 parent c2c40aa commit a57fa4b
File tree
65 files changed
+1403
-17
lines changed- FabricExample
- __tests__
- __snapshots__
- ios/KeyboardControllerFabricExample
- src
- constants
- screens/Examples
- LiquidKeyboard
- Main
- android/src
- base/java/com/reactnativekeyboardcontroller
- fabric/java/com/reactnativekeyboardcontroller
- main
- java/com/reactnativekeyboardcontroller
- extensions
- managers
- views/background
- jni
- res
- values-v29
- values-v30
- values-v33
- values-v34
- values-v35
- values
- paper/java/com/reactnativekeyboardcontroller
- common/cpp/react/renderer/components/reactnativekeyboardcontroller
- docs/docs
- api/keyboard-background-view
- guides
- e2e/kit
- assets
- android
- e2e_emulator_28
- e2e_emulator_31
- ios
- iPhone 13 Pro
- iPhone 14 Pro
- iPhone 15 Pro
- iPhone 16 Pro
- example
- __tests__
- __snapshots__
- ios/KeyboardControllerExample
- src
- constants
- screens/Examples
- LiquidKeyboard
- Main
- ios/views
- jest
- src
- specs
- types
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
65 files changed
+1403
-17
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
77 | 82 | | |
78 | 83 | | |
79 | 84 | | |
| |||
102 | 107 | | |
103 | 108 | | |
104 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
105 | 114 | | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
50 | | - | |
51 | | - | |
52 | 52 | | |
53 | 53 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
27 | 29 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| 53 | + | |
| 54 | + | |
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
| |||
120 | 124 | | |
121 | 125 | | |
122 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
123 | 135 | | |
124 | 136 | | |
125 | 137 | | |
| |||
234 | 246 | | |
235 | 247 | | |
236 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
237 | 259 | | |
238 | 260 | | |
239 | 261 | | |
| |||
Lines changed: 85 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
Lines changed: 138 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
138 | 150 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
0 commit comments