react-native-keyboard-controller 1.18.0 → 1.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,6 +22,7 @@ class KeyboardControllerViewManagerImpl {
22
22
 
23
23
  fun invalidate() {
24
24
  listener?.detachListener()
25
+ listener = null
25
26
  }
26
27
 
27
28
  fun setEnabled(
@@ -3,7 +3,6 @@ package com.reactnativekeyboardcontroller.views.background
3
3
  import android.annotation.SuppressLint
4
4
  import android.content.res.Configuration
5
5
  import android.view.WindowInsets
6
- import com.facebook.react.uimanager.BackgroundStyleApplicator
7
6
  import com.facebook.react.uimanager.ThemedReactContext
8
7
  import com.facebook.react.views.view.ReactViewGroup
9
8
 
@@ -14,18 +13,18 @@ class KeyboardBackgroundViewGroup(
14
13
  // view mounted
15
14
  override fun onAttachedToWindow() {
16
15
  super.onAttachedToWindow()
17
- BackgroundStyleApplicator.setBackgroundColor(this, reactContext.getInputMethodColor())
16
+ super.setBackgroundColor(reactContext.getInputMethodColor())
18
17
  }
19
18
 
20
19
  // theme changed
21
20
  override fun onConfigurationChanged(newConfig: Configuration?) {
22
21
  super.onConfigurationChanged(newConfig)
23
- BackgroundStyleApplicator.setBackgroundColor(this, reactContext.getInputMethodColor())
22
+ super.setBackgroundColor(reactContext.getInputMethodColor())
24
23
  }
25
24
 
26
25
  // keyboard changed
27
26
  override fun onApplyWindowInsets(insets: WindowInsets?): WindowInsets {
28
- BackgroundStyleApplicator.setBackgroundColor(this, reactContext.getInputMethodColor())
27
+ super.setBackgroundColor(reactContext.getInputMethodColor())
29
28
  return super.onApplyWindowInsets(insets)
30
29
  }
31
30
 
@@ -39,13 +39,17 @@ extension TextInput {
39
39
  case .light:
40
40
  return "light"
41
41
  case .default:
42
- switch traitCollection.userInterfaceStyle {
43
- case .dark:
44
- return "dark"
45
- case .light, .unspecified:
46
- return "light"
47
- @unknown default:
48
- return "light"
42
+ if #available(iOS 12.0, *) {
43
+ switch traitCollection.userInterfaceStyle {
44
+ case .dark:
45
+ return "dark"
46
+ case .light, .unspecified:
47
+ return "light"
48
+ @unknown default:
49
+ return "light"
50
+ }
51
+ } else {
52
+ return "light" // Default fallback for iOS < 12
49
53
  }
50
54
  @unknown default:
51
55
  return "light"
@@ -165,4 +165,11 @@ RCT_EXPORT_MODULE(KeyboardBackgroundViewManager)
165
165
  }
166
166
  }
167
167
 
168
+ #ifdef RCT_NEW_ARCH_ENABLED
169
+ Class<RCTComponentViewProtocol> KeyboardBackgroundViewCls(void)
170
+ {
171
+ return KeyboardBackgroundView.class;
172
+ }
173
+ #endif
174
+
168
175
  @end
@@ -158,10 +158,9 @@ RCT_EXPORT_VIEW_PROPERTY(visible, BOOL)
158
158
  #ifdef RCT_NEW_ARCH_ENABLED
159
159
  - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
160
160
  {
161
- const auto &oldViewProps = *std::static_pointer_cast<const OverKeyboardViewProps>(_props);
162
161
  const auto &newViewProps = *std::static_pointer_cast<const OverKeyboardViewProps>(props);
163
162
 
164
- if (newViewProps.visible != oldViewProps.visible) {
163
+ if (newViewProps.visible != _visible) {
165
164
  if (newViewProps.visible) {
166
165
  [self show];
167
166
  } else {
@@ -207,13 +206,14 @@ RCT_EXPORT_VIEW_PROPERTY(visible, BOOL)
207
206
  if (_visible) {
208
207
  return;
209
208
  }
209
+
210
+ UIWindow *topWindow = [UIWindow topWindow];
210
211
  _visible = true;
211
- _contentView.frame = self.window.bounds;
212
+ _contentView.frame = topWindow.bounds;
212
213
  _contentView.autoresizingMask =
213
214
  UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
214
- [_touchHandler attachToView:_contentView];
215
215
 
216
- UIWindow *topWindow = [UIWindow topWindow];
216
+ [_touchHandler attachToView:_contentView];
217
217
  [topWindow addSubview:_contentView];
218
218
  }
219
219
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-keyboard-controller",
3
- "version": "1.18.0",
3
+ "version": "1.18.2",
4
4
  "description": "Keyboard manager which works in identical way on both iOS and Android",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",