react-native-keyboard-controller 1.0.0-alpha.1 → 1.0.0-beta.0

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.
Files changed (52) hide show
  1. package/README.md +4 -7
  2. package/android/build.gradle +1 -1
  3. package/android/gradle.properties +2 -0
  4. package/android/src/main/java/com/reactnativekeyboardcontroller/EdgeToEdgeReactViewGroup.kt +2 -0
  5. package/android/src/main/java/com/reactnativekeyboardcontroller/KeyboardControllerPackage.kt +6 -6
  6. package/android/src/main/java/com/reactnativekeyboardcontroller/KeyboardControllerViewManager.kt +14 -3
  7. package/android/src/main/java/com/reactnativekeyboardcontroller/StatusBarManagerCompatModule.kt +81 -0
  8. package/android/src/main/java/com/reactnativekeyboardcontroller/TranslateDeferringInsetsAnimationCallback.kt +41 -41
  9. package/ios/.swift-version +1 -0
  10. package/ios/.swiftformat +5 -0
  11. package/ios/.swiftlint.yml +5 -0
  12. package/ios/KeyboardControllerModule.m +2 -2
  13. package/ios/KeyboardControllerModule.swift +17 -17
  14. package/ios/KeyboardControllerViewManager.m +1 -1
  15. package/ios/KeyboardControllerViewManager.swift +86 -54
  16. package/ios/KeyboardMoveEvent.swift +31 -27
  17. package/lib/commonjs/animated.js +19 -14
  18. package/lib/commonjs/animated.js.map +1 -1
  19. package/lib/commonjs/index.js +2 -0
  20. package/lib/commonjs/index.js.map +1 -1
  21. package/lib/commonjs/monkey-patch.js +44 -0
  22. package/lib/commonjs/monkey-patch.js.map +1 -0
  23. package/lib/commonjs/native.js.map +1 -1
  24. package/lib/module/animated.js +18 -15
  25. package/lib/module/animated.js.map +1 -1
  26. package/lib/module/index.js +1 -0
  27. package/lib/module/index.js.map +1 -1
  28. package/lib/module/monkey-patch.js +36 -0
  29. package/lib/module/monkey-patch.js.map +1 -0
  30. package/lib/module/native.js.map +1 -1
  31. package/lib/typescript/animated.d.ts +18 -2
  32. package/lib/typescript/index.d.ts +1 -0
  33. package/lib/typescript/monkey-patch.d.ts +1 -0
  34. package/lib/typescript/native.d.ts +3 -5
  35. package/package.json +6 -3
  36. package/src/animated.tsx +34 -14
  37. package/src/index.ts +2 -0
  38. package/src/monkey-patch.tsx +36 -0
  39. package/src/native.ts +4 -5
  40. package/android/.gradle/6.8/executionHistory/executionHistory.lock +0 -0
  41. package/android/.gradle/6.8/fileChanges/last-build.bin +0 -0
  42. package/android/.gradle/6.8/fileHashes/fileHashes.lock +0 -0
  43. package/android/.gradle/6.8/gc.properties +0 -0
  44. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  45. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  46. package/android/.gradle/checksums/checksums.lock +0 -0
  47. package/android/.gradle/configuration-cache/gc.properties +0 -0
  48. package/android/.gradle/vcs-1/gc.properties +0 -0
  49. package/ios/KeyboardController.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  50. package/ios/KeyboardController.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  51. package/ios/KeyboardController.xcodeproj/project.xcworkspace/xcuserdata/kiryl.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  52. package/ios/KeyboardController.xcodeproj/xcuserdata/kiryl.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
@@ -0,0 +1,36 @@
1
+ import { NativeModules, Platform } from 'react-native';
2
+ // @ts-expect-error because there is no corresponding type definition
3
+ import * as NativeAndroidManager from 'react-native/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid';
4
+
5
+ const getConstants = NativeAndroidManager.default.getConstants;
6
+
7
+ const RCTStatusBarManagerCompat = NativeModules.StatusBarManagerCompat;
8
+
9
+ // On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so
10
+ // in order to use library on all available platforms we have to monkey patch
11
+ // default RN implementation and use modern `WindowInsetsControllerCompat`.
12
+ if (Platform.OS === 'android') {
13
+ NativeAndroidManager.default = {
14
+ getConstants,
15
+ setColor(color: number, animated: boolean): void {
16
+ RCTStatusBarManagerCompat.setColor(color, animated);
17
+ },
18
+
19
+ setTranslucent(translucent: boolean): void {
20
+ RCTStatusBarManagerCompat.setTranslucent(translucent);
21
+ },
22
+
23
+ /**
24
+ * - statusBarStyles can be:
25
+ * - 'default'
26
+ * - 'dark-content'
27
+ */
28
+ setStyle(statusBarStyle?: string): void {
29
+ RCTStatusBarManagerCompat.setStyle(statusBarStyle);
30
+ },
31
+
32
+ setHidden(hidden: boolean): void {
33
+ RCTStatusBarManagerCompat.setHidden(hidden);
34
+ },
35
+ };
36
+ }
package/src/native.ts CHANGED
@@ -1,12 +1,12 @@
1
- import React, { useEffect } from 'react';
1
+ import { useEffect } from 'react';
2
2
  import {
3
3
  requireNativeComponent,
4
4
  UIManager,
5
5
  Platform,
6
- ViewStyle,
7
6
  NativeModules,
8
7
  NativeEventEmitter,
9
8
  NativeSyntheticEvent,
9
+ ViewProps,
10
10
  } from 'react-native';
11
11
 
12
12
  const LINKING_ERROR =
@@ -30,14 +30,13 @@ export type EventWithName<T> = {
30
30
  eventName: string;
31
31
  } & T;
32
32
  export type KeyboardControllerProps = {
33
- style?: ViewStyle;
34
- children: React.ReactNode;
35
33
  onKeyboardMove: (e: NativeSyntheticEvent<EventWithName<NativeEvent>>) => void;
36
34
  // fake prop used to activate reanimated bindings
37
35
  onKeyboardMoveReanimated: (
38
36
  e: NativeSyntheticEvent<EventWithName<NativeEvent>>
39
37
  ) => void;
40
- };
38
+ statusBarTranslucent?: boolean;
39
+ } & ViewProps;
41
40
  type KeyboardController = {
42
41
  // android only
43
42
  setDefaultMode: () => void;
File without changes
@@ -1,2 +0,0 @@
1
- #Fri Apr 22 19:15:51 MSK 2022
2
- gradle.version=6.8
File without changes
File without changes
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Workspace
3
- version = "1.0">
4
- <FileRef
5
- location = "self:">
6
- </FileRef>
7
- </Workspace>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>IDEDidComputeMac32BitWarning</key>
6
- <true/>
7
- </dict>
8
- </plist>
@@ -1,14 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>SchemeUserState</key>
6
- <dict>
7
- <key>KeyboardController.xcscheme_^#shared#^_</key>
8
- <dict>
9
- <key>orderHint</key>
10
- <integer>0</integer>
11
- </dict>
12
- </dict>
13
- </dict>
14
- </plist>