Commit adafcc8
authored
fix(android): make onConfigurationChanged param non-nullable (#1472)
## Description
Android's `View.onConfigurationChanged(@nonnull Configuration
newConfig)` is now strictly enforced as non-null by Kotlin under the
compileSdk shipped with React Native 0.86. The overrides in
`EdgeToEdgeReactViewGroup` and `KeyboardBackgroundViewGroup` declared
the parameter as `Configuration?`, which no longer matches the parent
signature and breaks the build:
```
e: EdgeToEdgeReactViewGroup.kt:97 'onConfigurationChanged' overrides nothing.
Potential signatures for overriding:
fun onConfigurationChanged(newConfig: Configuration): Unit
e: KeyboardBackgroundViewGroup.kt:20 'onConfigurationChanged' overrides nothing.
e: KeyboardBackgroundViewGroup.kt:21 Argument type mismatch: actual type
is 'Configuration?', but 'Configuration' was expected.
```
Dropping the `?` matches the parent signature. The change is
backwards-compatible with older React Native / compileSdk versions
because the parent method is exposed there as a Kotlin platform type
(`Configuration!`), which accepts a non-nullable override.
## 💡 Motivation and Context
- react-native 0.86 support
## 📢 Changelog
### Android
- Make `onConfigurationChanged` param non-nullable
## 🤔 How Has This Been Tested?
- Android build (`./gradlew
:react-native-keyboard-controller:compileReleaseKotlin`) succeeds
against React Native 0.86
- Android build still succeeds against the previously supported React
Native versions
- Theme change still triggers `setBackgroundColor` /
`reApplyWindowInsets` at runtime
## 📸 Screenshots (if appropriate):
<!-- Add screenshots/video if needed -->
<!-- That would be highly appreciated if you can add how it looked
before and after your changes -->
## 📝 Checklist
- [ ] CI successfully passed
- [ ] I added new mocks and corresponding unit-tests if library API was
changed1 parent ac72bda commit adafcc8
2 files changed
Lines changed: 2 additions & 2 deletions
File tree
- android/src/main/java/com/reactnativekeyboardcontroller/views
- background
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
0 commit comments