react-native-keyboard-controller 1.11.6 → 1.12.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 (86) hide show
  1. package/android/src/main/java/com/reactnativekeyboardcontroller/events/FocusedInputLayoutChangedEvent.kt +1 -1
  2. package/android/src/main/java/com/reactnativekeyboardcontroller/events/FocusedInputSelectionChangedEvent.kt +51 -0
  3. package/android/src/main/java/com/reactnativekeyboardcontroller/events/FocusedInputTextChangedEvent.kt +1 -1
  4. package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/EditText.kt +79 -0
  5. package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/ThemedReactContext.kt +1 -2
  6. package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/View.kt +1 -1
  7. package/android/src/main/java/com/reactnativekeyboardcontroller/interactive/interpolators/IosInterpolator.kt +1 -1
  8. package/android/src/main/java/com/reactnativekeyboardcontroller/listeners/FocusedInputObserver.kt +32 -0
  9. package/android/src/main/java/com/reactnativekeyboardcontroller/listeners/KeyboardAnimationCallback.kt +1 -1
  10. package/android/src/main/java/com/reactnativekeyboardcontroller/managers/KeyboardControllerViewManagerImpl.kt +2 -0
  11. package/android/src/main/java/com/reactnativekeyboardcontroller/ui/FrameScheduler.kt +40 -0
  12. package/android/src/main/java/com/reactnativekeyboardcontroller/views/EdgeToEdgeReactViewGroup.kt +1 -1
  13. package/ios/KeyboardController-Bridging-Header.h +1 -0
  14. package/ios/core/KeyboardAnimation.swift +77 -0
  15. package/ios/core/SpringAnimation.swift +60 -0
  16. package/ios/core/UIUtils.swift +11 -0
  17. package/ios/delegates/KCTextInputCompositeDelegate.swift +148 -0
  18. package/ios/events/FocusedInputSelectionChangedEvent.h +15 -0
  19. package/ios/events/FocusedInputSelectionChangedEvent.m +76 -0
  20. package/ios/objc/RCTUITextView+DelegateManager.h +14 -0
  21. package/ios/objc/RCTUITextView+DelegateManager.m +26 -0
  22. package/ios/observers/FocusedInputObserver.swift +74 -13
  23. package/ios/observers/KeyboardMovementObserver.swift +39 -2
  24. package/ios/views/KeyboardControllerView.mm +45 -8
  25. package/ios/views/KeyboardControllerViewManager.mm +1 -0
  26. package/ios/views/KeyboardControllerViewManager.swift +10 -2
  27. package/lib/commonjs/animated.js +8 -0
  28. package/lib/commonjs/animated.js.map +1 -1
  29. package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
  30. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +5 -5
  31. package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
  32. package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
  33. package/lib/commonjs/components/KeyboardToolbar/index.js +25 -7
  34. package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
  35. package/lib/commonjs/components/KeyboardToolbar/types.js.map +1 -1
  36. package/lib/commonjs/components/index.js.map +1 -1
  37. package/lib/commonjs/index.js.map +1 -1
  38. package/lib/commonjs/reanimated.js +2 -1
  39. package/lib/commonjs/reanimated.js.map +1 -1
  40. package/lib/commonjs/reanimated.native.js +18 -1
  41. package/lib/commonjs/reanimated.native.js.map +1 -1
  42. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
  43. package/lib/commonjs/types.js.map +1 -1
  44. package/lib/module/animated.js +9 -1
  45. package/lib/module/animated.js.map +1 -1
  46. package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
  47. package/lib/module/components/KeyboardAwareScrollView/index.js +5 -5
  48. package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
  49. package/lib/module/components/KeyboardStickyView/index.js.map +1 -1
  50. package/lib/module/components/KeyboardToolbar/index.js +26 -8
  51. package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
  52. package/lib/module/components/KeyboardToolbar/types.js.map +1 -1
  53. package/lib/module/components/index.js.map +1 -1
  54. package/lib/module/index.js.map +1 -1
  55. package/lib/module/reanimated.js +1 -0
  56. package/lib/module/reanimated.js.map +1 -1
  57. package/lib/module/reanimated.native.js +16 -0
  58. package/lib/module/reanimated.native.js.map +1 -1
  59. package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
  60. package/lib/module/types.js.map +1 -1
  61. package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +20 -0
  62. package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +8 -0
  63. package/lib/typescript/components/KeyboardStickyView/index.d.ts +15 -0
  64. package/lib/typescript/components/KeyboardToolbar/index.d.ts +21 -1
  65. package/lib/typescript/components/KeyboardToolbar/types.d.ts +3 -1
  66. package/lib/typescript/components/index.d.ts +3 -0
  67. package/lib/typescript/index.d.ts +1 -1
  68. package/lib/typescript/reanimated.d.ts +2 -1
  69. package/lib/typescript/reanimated.native.d.ts +7 -4
  70. package/lib/typescript/specs/KeyboardControllerViewNativeComponent.d.ts +16 -0
  71. package/lib/typescript/types.d.ts +21 -0
  72. package/package.json +4 -3
  73. package/src/animated.tsx +12 -0
  74. package/src/components/KeyboardAvoidingView/index.tsx +5 -2
  75. package/src/components/KeyboardAwareScrollView/index.tsx +81 -81
  76. package/src/components/KeyboardStickyView/index.tsx +1 -1
  77. package/src/components/KeyboardToolbar/index.tsx +47 -7
  78. package/src/components/KeyboardToolbar/types.ts +25 -1
  79. package/src/components/index.ts +3 -0
  80. package/src/index.ts +6 -1
  81. package/src/reanimated.native.ts +30 -3
  82. package/src/reanimated.ts +6 -0
  83. package/src/specs/KeyboardControllerViewNativeComponent.ts +17 -0
  84. package/src/types.ts +31 -0
  85. package/ios/KeyboardController.xcodeproj/project.pbxproj +0 -387
  86. package/ios/observers/TextChangeObserver.swift +0 -41
@@ -4,14 +4,18 @@ import type {
4
4
  EventWithName,
5
5
  FocusedInputLayoutChangedEvent,
6
6
  FocusedInputLayoutHandlerHook,
7
+ FocusedInputSelectionChangedEvent,
8
+ FocusedInputSelectionHandlerHook,
7
9
  FocusedInputTextChangedEvent,
8
10
  FocusedInputTextHandlerHook,
9
11
  KeyboardHandlerHook,
10
12
  NativeEvent,
11
13
  } from "./types";
12
14
 
15
+ type EventContext = Record<string, unknown>;
16
+
13
17
  export const useAnimatedKeyboardHandler: KeyboardHandlerHook<
14
- Record<string, unknown>,
18
+ EventContext,
15
19
  EventWithName<NativeEvent>
16
20
  > = (handlers, dependencies) => {
17
21
  const { context, doDependenciesDiffer } = useHandler(handlers, dependencies);
@@ -59,7 +63,7 @@ export const useAnimatedKeyboardHandler: KeyboardHandlerHook<
59
63
  };
60
64
 
61
65
  export const useFocusedInputLayoutHandler: FocusedInputLayoutHandlerHook<
62
- Record<string, unknown>,
66
+ EventContext,
63
67
  EventWithName<FocusedInputLayoutChangedEvent>
64
68
  > = (handlers, dependencies) => {
65
69
  const { context, doDependenciesDiffer } = useHandler(handlers, dependencies);
@@ -82,7 +86,7 @@ export const useFocusedInputLayoutHandler: FocusedInputLayoutHandlerHook<
82
86
  };
83
87
 
84
88
  export const useFocusedInputTextHandler: FocusedInputTextHandlerHook<
85
- Record<string, unknown>,
89
+ EventContext,
86
90
  EventWithName<FocusedInputTextChangedEvent>
87
91
  > = (handlers, dependencies) => {
88
92
  const { context, doDependenciesDiffer } = useHandler(handlers, dependencies);
@@ -103,3 +107,26 @@ export const useFocusedInputTextHandler: FocusedInputTextHandlerHook<
103
107
  doDependenciesDiffer,
104
108
  );
105
109
  };
110
+
111
+ export const useFocusedInputSelectionHandler: FocusedInputSelectionHandlerHook<
112
+ EventContext,
113
+ EventWithName<FocusedInputSelectionChangedEvent>
114
+ > = (handlers, dependencies) => {
115
+ const { context, doDependenciesDiffer } = useHandler(handlers, dependencies);
116
+
117
+ return useEvent(
118
+ (event) => {
119
+ "worklet";
120
+ const { onFocusedInputSelectionChanged } = handlers;
121
+
122
+ if (
123
+ onFocusedInputSelectionChanged &&
124
+ event.eventName.endsWith("onFocusedInputSelectionChanged")
125
+ ) {
126
+ onFocusedInputSelectionChanged(event, context);
127
+ }
128
+ },
129
+ ["onFocusedInputSelectionChanged"],
130
+ doDependenciesDiffer,
131
+ );
132
+ };
package/src/reanimated.ts CHANGED
@@ -2,6 +2,8 @@ import type {
2
2
  EventWithName,
3
3
  FocusedInputLayoutChangedEvent,
4
4
  FocusedInputLayoutHandlerHook,
5
+ FocusedInputSelectionChangedEvent,
6
+ FocusedInputSelectionHandlerHook,
5
7
  FocusedInputTextChangedEvent,
6
8
  FocusedInputTextHandlerHook,
7
9
  KeyboardHandlerHook,
@@ -21,3 +23,7 @@ export const useFocusedInputTextHandler: FocusedInputTextHandlerHook<
21
23
  Record<string, unknown>,
22
24
  EventWithName<FocusedInputTextChangedEvent>
23
25
  > = NOOP;
26
+ export const useFocusedInputSelectionHandler: FocusedInputSelectionHandlerHook<
27
+ Record<string, unknown>,
28
+ EventWithName<FocusedInputSelectionChangedEvent>
29
+ > = NOOP;
@@ -32,6 +32,22 @@ type FocusedInputTextChangedEvent = Readonly<{
32
32
  text: string;
33
33
  }>;
34
34
 
35
+ type FocusedInputSelectionChangedEvent = Readonly<{
36
+ target: Int32;
37
+ selection: {
38
+ start: {
39
+ x: Double;
40
+ y: Double;
41
+ position: Int32;
42
+ };
43
+ end: {
44
+ x: Double;
45
+ y: Double;
46
+ position: Int32;
47
+ };
48
+ };
49
+ }>;
50
+
35
51
  export interface NativeProps extends ViewProps {
36
52
  // props
37
53
  enabled?: boolean;
@@ -46,6 +62,7 @@ export interface NativeProps extends ViewProps {
46
62
  /// focused input
47
63
  onFocusedInputLayoutChanged?: DirectEventHandler<FocusedInputLayoutChangedEvent>;
48
64
  onFocusedInputTextChanged?: DirectEventHandler<FocusedInputTextChangedEvent>;
65
+ onFocusedInputSelectionChanged?: DirectEventHandler<FocusedInputSelectionChangedEvent>;
49
66
  }
50
67
 
51
68
  export default codegenNativeComponent<NativeProps>(
package/src/types.ts CHANGED
@@ -26,6 +26,21 @@ export type FocusedInputLayoutChangedEvent = {
26
26
  export type FocusedInputTextChangedEvent = {
27
27
  text: string;
28
28
  };
29
+ export type FocusedInputSelectionChangedEvent = {
30
+ target: number;
31
+ selection: {
32
+ start: {
33
+ x: number;
34
+ y: number;
35
+ position: number;
36
+ };
37
+ end: {
38
+ x: number;
39
+ y: number;
40
+ position: number;
41
+ };
42
+ };
43
+ };
29
44
  export type EventWithName<T> = {
30
45
  eventName: string;
31
46
  } & T;
@@ -51,6 +66,9 @@ export type KeyboardControllerProps = {
51
66
  onFocusedInputTextChanged?: (
52
67
  e: NativeSyntheticEvent<EventWithName<FocusedInputTextChangedEvent>>,
53
68
  ) => void;
69
+ onFocusedInputSelectionChanged?: (
70
+ e: NativeSyntheticEvent<EventWithName<FocusedInputSelectionChangedEvent>>,
71
+ ) => void;
54
72
  // fake props used to activate reanimated bindings
55
73
  onKeyboardMoveReanimated?: (
56
74
  e: NativeSyntheticEvent<EventWithName<NativeEvent>>,
@@ -61,6 +79,9 @@ export type KeyboardControllerProps = {
61
79
  onFocusedInputTextChangedReanimated?: (
62
80
  e: NativeSyntheticEvent<EventWithName<FocusedInputTextChangedEvent>>,
63
81
  ) => void;
82
+ onFocusedInputSelectionChangedReanimated?: (
83
+ e: NativeSyntheticEvent<EventWithName<FocusedInputSelectionChangedEvent>>,
84
+ ) => void;
64
85
  // props
65
86
  statusBarTranslucent?: boolean;
66
87
  navigationBarTranslucent?: boolean;
@@ -153,6 +174,15 @@ export type FocusedInputTextHandlerHook<TContext, Event> = (
153
174
  },
154
175
  dependencies?: unknown[],
155
176
  ) => (e: NativeSyntheticEvent<Event>) => void;
177
+ export type FocusedInputSelectionHandlerHook<TContext, Event> = (
178
+ handlers: {
179
+ onFocusedInputSelectionChanged?: (
180
+ e: FocusedInputSelectionChangedEvent,
181
+ context: TContext,
182
+ ) => void;
183
+ },
184
+ dependencies?: unknown[],
185
+ ) => (e: NativeSyntheticEvent<Event>) => void;
156
186
 
157
187
  // package types
158
188
  export type Handlers<T> = Record<string, T | undefined>;
@@ -165,5 +195,6 @@ export type KeyboardHandler = Partial<{
165
195
  export type KeyboardHandlers = Handlers<KeyboardHandler>;
166
196
  export type FocusedInputHandler = Partial<{
167
197
  onChangeText: (e: FocusedInputTextChangedEvent) => void;
198
+ onSelectionChange: (e: FocusedInputSelectionChangedEvent) => void;
168
199
  }>;
169
200
  export type FocusedInputHandlers = Handlers<FocusedInputHandler>;
@@ -1,387 +0,0 @@
1
- // !$*UTF8*$!
2
- {
3
- archiveVersion = 1;
4
- classes = {
5
- };
6
- objectVersion = 46;
7
- objects = {
8
-
9
- /* Begin PBXBuildFile section */
10
- 0800511C2B65548600928E51 /* FocusedInputHolder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0800511B2B65548600928E51 /* FocusedInputHolder.swift */; };
11
- 0800511E2B65558800928E51 /* TextInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0800511D2B65558800928E51 /* TextInput.swift */; };
12
- 0807071E2A34807B00C05A19 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0807071D2A34807B00C05A19 /* Extensions.swift */; };
13
- 083FB9852B15171600C0EFF0 /* TextChangeObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 083FB9842B15171600C0EFF0 /* TextChangeObserver.swift */; };
14
- 083FB9872B15174C00C0EFF0 /* FocusedInputTextChangedEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 083FB9862B15174C00C0EFF0 /* FocusedInputTextChangedEvent.m */; };
15
- 084AEEC62ACF49A8001A3069 /* FocusedInputLayoutChangedEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 084AEEC52ACF49A8001A3069 /* FocusedInputLayoutChangedEvent.m */; };
16
- 084AEEC82ACF4AB2001A3069 /* FocusedInputObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 084AEEC72ACF4AB2001A3069 /* FocusedInputObserver.swift */; };
17
- 089BA5DC2B3E0C9D000A9A90 /* ViewHierarchyNavigator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 089BA5DB2B3E0C9D000A9A90 /* ViewHierarchyNavigator.swift */; };
18
- 08C47AFC2BA9AF7100DB93BB /* KeyboardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08C47AFB2BA9AF7100DB93BB /* KeyboardView.swift */; };
19
- 08DF17B32BB1838D00279890 /* RCTUIManager+LayoutAnimationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 08DF17B22BB1838D00279890 /* RCTUIManager+LayoutAnimationManager.m */; };
20
- F333F8D428996B8D0015B05F /* KeyboardControllerView.mm in Sources */ = {isa = PBXBuildFile; fileRef = F333F8D228996B8D0015B05F /* KeyboardControllerView.mm */; };
21
- F359D34F28133C26000B6AFE /* KeyboardControllerModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = F359D34E28133C26000B6AFE /* KeyboardControllerModule.mm */; };
22
- F3626A0728B3FE760021B2D9 /* KeyboardMovementObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3626A0628B3FE760021B2D9 /* KeyboardMovementObserver.swift */; };
23
- F3F50669289E653B003091D6 /* KeyboardMoveEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = F3F50668289E653B003091D6 /* KeyboardMoveEvent.m */; };
24
- F4FF95D7245B92E800C19C63 /* KeyboardControllerViewManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* KeyboardControllerViewManager.swift */; };
25
- /* End PBXBuildFile section */
26
-
27
- /* Begin PBXCopyFilesBuildPhase section */
28
- 58B511D91A9E6C8500147676 /* CopyFiles */ = {
29
- isa = PBXCopyFilesBuildPhase;
30
- buildActionMask = 2147483647;
31
- dstPath = "include/$(PRODUCT_NAME)";
32
- dstSubfolderSpec = 16;
33
- files = (
34
- );
35
- runOnlyForDeploymentPostprocessing = 0;
36
- };
37
- /* End PBXCopyFilesBuildPhase section */
38
-
39
- /* Begin PBXFileReference section */
40
- 0800511B2B65548600928E51 /* FocusedInputHolder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FocusedInputHolder.swift; sourceTree = "<group>"; };
41
- 0800511D2B65558800928E51 /* TextInput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextInput.swift; sourceTree = "<group>"; };
42
- 0807071D2A34807B00C05A19 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = "<group>"; };
43
- 083FB9842B15171600C0EFF0 /* TextChangeObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextChangeObserver.swift; sourceTree = "<group>"; };
44
- 083FB9862B15174C00C0EFF0 /* FocusedInputTextChangedEvent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FocusedInputTextChangedEvent.m; sourceTree = "<group>"; };
45
- 083FB9892B15177C00C0EFF0 /* FocusedInputTextChangedEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FocusedInputTextChangedEvent.h; sourceTree = "<group>"; };
46
- 084AEEC22ACF479A001A3069 /* FocusedInputLayoutChangedEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FocusedInputLayoutChangedEvent.h; sourceTree = "<group>"; };
47
- 084AEEC52ACF49A8001A3069 /* FocusedInputLayoutChangedEvent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FocusedInputLayoutChangedEvent.m; sourceTree = "<group>"; };
48
- 084AEEC72ACF4AB2001A3069 /* FocusedInputObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FocusedInputObserver.swift; sourceTree = "<group>"; };
49
- 089BA5DB2B3E0C9D000A9A90 /* ViewHierarchyNavigator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewHierarchyNavigator.swift; sourceTree = "<group>"; };
50
- 08C47AFB2BA9AF7100DB93BB /* KeyboardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardView.swift; sourceTree = "<group>"; };
51
- 08DF17B22BB1838D00279890 /* RCTUIManager+LayoutAnimationManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "RCTUIManager+LayoutAnimationManager.m"; sourceTree = "<group>"; };
52
- 08DF17B52BB1845500279890 /* RCTUIManager+LayoutAnimationManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RCTUIManager+LayoutAnimationManager.h"; sourceTree = "<group>"; };
53
- 134814201AA4EA6300B7C361 /* libKeyboardController.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKeyboardController.a; sourceTree = BUILT_PRODUCTS_DIR; };
54
- B3E7B5891CC2AC0600A0062D /* KeyboardControllerViewManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KeyboardControllerViewManager.mm; sourceTree = "<group>"; };
55
- F333F8D128996B1C0015B05F /* KeyboardControllerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeyboardControllerView.h; sourceTree = "<group>"; };
56
- F333F8D228996B8D0015B05F /* KeyboardControllerView.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KeyboardControllerView.mm; sourceTree = "<group>"; };
57
- F359D34E28133C26000B6AFE /* KeyboardControllerModule.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KeyboardControllerModule.mm; sourceTree = "<group>"; };
58
- F359D35028133C6F000B6AFE /* KeyboardControllerModule-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "KeyboardControllerModule-Header.h"; sourceTree = "<group>"; };
59
- F3626A0628B3FE760021B2D9 /* KeyboardMovementObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardMovementObserver.swift; sourceTree = "<group>"; };
60
- F3F50667289E653B003091D6 /* KeyboardMoveEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeyboardMoveEvent.h; sourceTree = "<group>"; };
61
- F3F50668289E653B003091D6 /* KeyboardMoveEvent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KeyboardMoveEvent.m; sourceTree = "<group>"; };
62
- F4FF95D5245B92E700C19C63 /* KeyboardController-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "KeyboardController-Bridging-Header.h"; sourceTree = "<group>"; };
63
- F4FF95D6245B92E800C19C63 /* KeyboardControllerViewManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardControllerViewManager.swift; sourceTree = "<group>"; };
64
- /* End PBXFileReference section */
65
-
66
- /* Begin PBXFrameworksBuildPhase section */
67
- 58B511D81A9E6C8500147676 /* Frameworks */ = {
68
- isa = PBXFrameworksBuildPhase;
69
- buildActionMask = 2147483647;
70
- files = (
71
- );
72
- runOnlyForDeploymentPostprocessing = 0;
73
- };
74
- /* End PBXFrameworksBuildPhase section */
75
-
76
- /* Begin PBXGroup section */
77
- 084AEEBF2ACDFBF1001A3069 /* events */ = {
78
- isa = PBXGroup;
79
- children = (
80
- F3F50667289E653B003091D6 /* KeyboardMoveEvent.h */,
81
- F3F50668289E653B003091D6 /* KeyboardMoveEvent.m */,
82
- 084AEEC22ACF479A001A3069 /* FocusedInputLayoutChangedEvent.h */,
83
- 084AEEC52ACF49A8001A3069 /* FocusedInputLayoutChangedEvent.m */,
84
- 083FB9892B15177C00C0EFF0 /* FocusedInputTextChangedEvent.h */,
85
- 083FB9862B15174C00C0EFF0 /* FocusedInputTextChangedEvent.m */,
86
- );
87
- path = events;
88
- sourceTree = "<group>";
89
- };
90
- 084AEEC02ACDFC2A001A3069 /* observers */ = {
91
- isa = PBXGroup;
92
- children = (
93
- F3626A0628B3FE760021B2D9 /* KeyboardMovementObserver.swift */,
94
- 084AEEC72ACF4AB2001A3069 /* FocusedInputObserver.swift */,
95
- 083FB9842B15171600C0EFF0 /* TextChangeObserver.swift */,
96
- );
97
- path = observers;
98
- sourceTree = "<group>";
99
- };
100
- 084AEEC12ACF405C001A3069 /* views */ = {
101
- isa = PBXGroup;
102
- children = (
103
- F333F8D228996B8D0015B05F /* KeyboardControllerView.mm */,
104
- F333F8D128996B1C0015B05F /* KeyboardControllerView.h */,
105
- F4FF95D6245B92E800C19C63 /* KeyboardControllerViewManager.swift */,
106
- B3E7B5891CC2AC0600A0062D /* KeyboardControllerViewManager.mm */,
107
- );
108
- path = views;
109
- sourceTree = "<group>";
110
- };
111
- 089BA5DD2B3EC978000A9A90 /* traversal */ = {
112
- isa = PBXGroup;
113
- children = (
114
- 089BA5DB2B3E0C9D000A9A90 /* ViewHierarchyNavigator.swift */,
115
- 0800511B2B65548600928E51 /* FocusedInputHolder.swift */,
116
- 0800511D2B65558800928E51 /* TextInput.swift */,
117
- 08C47AFB2BA9AF7100DB93BB /* KeyboardView.swift */,
118
- );
119
- path = traversal;
120
- sourceTree = "<group>";
121
- };
122
- 08DF17B12BB1834400279890 /* objc */ = {
123
- isa = PBXGroup;
124
- children = (
125
- 08DF17B22BB1838D00279890 /* RCTUIManager+LayoutAnimationManager.m */,
126
- 08DF17B52BB1845500279890 /* RCTUIManager+LayoutAnimationManager.h */,
127
- );
128
- path = objc;
129
- sourceTree = "<group>";
130
- };
131
- 134814211AA4EA7D00B7C361 /* Products */ = {
132
- isa = PBXGroup;
133
- children = (
134
- 134814201AA4EA6300B7C361 /* libKeyboardController.a */,
135
- );
136
- name = Products;
137
- sourceTree = "<group>";
138
- };
139
- 58B511D21A9E6C8500147676 = {
140
- isa = PBXGroup;
141
- children = (
142
- 08DF17B12BB1834400279890 /* objc */,
143
- 089BA5DD2B3EC978000A9A90 /* traversal */,
144
- 084AEEC12ACF405C001A3069 /* views */,
145
- 084AEEC02ACDFC2A001A3069 /* observers */,
146
- 084AEEBF2ACDFBF1001A3069 /* events */,
147
- 0807071D2A34807B00C05A19 /* Extensions.swift */,
148
- F359D35028133C6F000B6AFE /* KeyboardControllerModule-Header.h */,
149
- F359D34E28133C26000B6AFE /* KeyboardControllerModule.mm */,
150
- F4FF95D5245B92E700C19C63 /* KeyboardController-Bridging-Header.h */,
151
- 134814211AA4EA7D00B7C361 /* Products */,
152
- );
153
- sourceTree = "<group>";
154
- };
155
- /* End PBXGroup section */
156
-
157
- /* Begin PBXNativeTarget section */
158
- 58B511DA1A9E6C8500147676 /* KeyboardController */ = {
159
- isa = PBXNativeTarget;
160
- buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "KeyboardController" */;
161
- buildPhases = (
162
- 58B511D71A9E6C8500147676 /* Sources */,
163
- 58B511D81A9E6C8500147676 /* Frameworks */,
164
- 58B511D91A9E6C8500147676 /* CopyFiles */,
165
- );
166
- buildRules = (
167
- );
168
- dependencies = (
169
- );
170
- name = KeyboardController;
171
- productName = RCTDataManager;
172
- productReference = 134814201AA4EA6300B7C361 /* libKeyboardController.a */;
173
- productType = "com.apple.product-type.library.static";
174
- };
175
- /* End PBXNativeTarget section */
176
-
177
- /* Begin PBXProject section */
178
- 58B511D31A9E6C8500147676 /* Project object */ = {
179
- isa = PBXProject;
180
- attributes = {
181
- LastUpgradeCheck = 0920;
182
- ORGANIZATIONNAME = Facebook;
183
- TargetAttributes = {
184
- 58B511DA1A9E6C8500147676 = {
185
- CreatedOnToolsVersion = 6.1.1;
186
- };
187
- };
188
- };
189
- buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "KeyboardController" */;
190
- compatibilityVersion = "Xcode 3.2";
191
- developmentRegion = English;
192
- hasScannedForEncodings = 0;
193
- knownRegions = (
194
- English,
195
- en,
196
- );
197
- mainGroup = 58B511D21A9E6C8500147676;
198
- productRefGroup = 58B511D21A9E6C8500147676;
199
- projectDirPath = "";
200
- projectRoot = "";
201
- targets = (
202
- 58B511DA1A9E6C8500147676 /* KeyboardController */,
203
- );
204
- };
205
- /* End PBXProject section */
206
-
207
- /* Begin PBXSourcesBuildPhase section */
208
- 58B511D71A9E6C8500147676 /* Sources */ = {
209
- isa = PBXSourcesBuildPhase;
210
- buildActionMask = 2147483647;
211
- files = (
212
- 084AEEC62ACF49A8001A3069 /* FocusedInputLayoutChangedEvent.m in Sources */,
213
- F3626A0728B3FE760021B2D9 /* KeyboardMovementObserver.swift in Sources */,
214
- 0800511C2B65548600928E51 /* FocusedInputHolder.swift in Sources */,
215
- 0807071E2A34807B00C05A19 /* Extensions.swift in Sources */,
216
- F359D34F28133C26000B6AFE /* KeyboardControllerModule.mm in Sources */,
217
- 084AEEC82ACF4AB2001A3069 /* FocusedInputObserver.swift in Sources */,
218
- F4FF95D7245B92E800C19C63 /* KeyboardControllerViewManager.swift in Sources */,
219
- F333F8D428996B8D0015B05F /* KeyboardControllerView.mm in Sources */,
220
- 0800511E2B65558800928E51 /* TextInput.swift in Sources */,
221
- 08DF17B32BB1838D00279890 /* RCTUIManager+LayoutAnimationManager.m in Sources */,
222
- 08C47AFC2BA9AF7100DB93BB /* KeyboardView.swift in Sources */,
223
- F3F50669289E653B003091D6 /* KeyboardMoveEvent.m in Sources */,
224
- 083FB9852B15171600C0EFF0 /* TextChangeObserver.swift in Sources */,
225
- 089BA5DC2B3E0C9D000A9A90 /* ViewHierarchyNavigator.swift in Sources */,
226
- 083FB9872B15174C00C0EFF0 /* FocusedInputTextChangedEvent.m in Sources */,
227
- );
228
- runOnlyForDeploymentPostprocessing = 0;
229
- };
230
- /* End PBXSourcesBuildPhase section */
231
-
232
- /* Begin XCBuildConfiguration section */
233
- 58B511ED1A9E6C8500147676 /* Debug */ = {
234
- isa = XCBuildConfiguration;
235
- buildSettings = {
236
- ALWAYS_SEARCH_USER_PATHS = NO;
237
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
238
- CLANG_CXX_LIBRARY = "libc++";
239
- CLANG_ENABLE_MODULES = YES;
240
- CLANG_ENABLE_OBJC_ARC = YES;
241
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
242
- CLANG_WARN_BOOL_CONVERSION = YES;
243
- CLANG_WARN_COMMA = YES;
244
- CLANG_WARN_CONSTANT_CONVERSION = YES;
245
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
246
- CLANG_WARN_EMPTY_BODY = YES;
247
- CLANG_WARN_ENUM_CONVERSION = YES;
248
- CLANG_WARN_INFINITE_RECURSION = YES;
249
- CLANG_WARN_INT_CONVERSION = YES;
250
- CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
251
- CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
252
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
253
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
254
- CLANG_WARN_STRICT_PROTOTYPES = YES;
255
- CLANG_WARN_SUSPICIOUS_MOVE = YES;
256
- CLANG_WARN_UNREACHABLE_CODE = YES;
257
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
258
- COPY_PHASE_STRIP = NO;
259
- ENABLE_STRICT_OBJC_MSGSEND = YES;
260
- ENABLE_TESTABILITY = YES;
261
- GCC_C_LANGUAGE_STANDARD = gnu99;
262
- GCC_DYNAMIC_NO_PIC = NO;
263
- GCC_NO_COMMON_BLOCKS = YES;
264
- GCC_OPTIMIZATION_LEVEL = 0;
265
- GCC_PREPROCESSOR_DEFINITIONS = (
266
- "DEBUG=1",
267
- "$(inherited)",
268
- );
269
- GCC_SYMBOLS_PRIVATE_EXTERN = NO;
270
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
271
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
272
- GCC_WARN_UNDECLARED_SELECTOR = YES;
273
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
274
- GCC_WARN_UNUSED_FUNCTION = YES;
275
- GCC_WARN_UNUSED_VARIABLE = YES;
276
- IPHONEOS_DEPLOYMENT_TARGET = 11.0;
277
- MTL_ENABLE_DEBUG_INFO = YES;
278
- ONLY_ACTIVE_ARCH = YES;
279
- SDKROOT = iphoneos;
280
- };
281
- name = Debug;
282
- };
283
- 58B511EE1A9E6C8500147676 /* Release */ = {
284
- isa = XCBuildConfiguration;
285
- buildSettings = {
286
- ALWAYS_SEARCH_USER_PATHS = NO;
287
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
288
- CLANG_CXX_LIBRARY = "libc++";
289
- CLANG_ENABLE_MODULES = YES;
290
- CLANG_ENABLE_OBJC_ARC = YES;
291
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
292
- CLANG_WARN_BOOL_CONVERSION = YES;
293
- CLANG_WARN_COMMA = YES;
294
- CLANG_WARN_CONSTANT_CONVERSION = YES;
295
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
296
- CLANG_WARN_EMPTY_BODY = YES;
297
- CLANG_WARN_ENUM_CONVERSION = YES;
298
- CLANG_WARN_INFINITE_RECURSION = YES;
299
- CLANG_WARN_INT_CONVERSION = YES;
300
- CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
301
- CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
302
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
303
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
304
- CLANG_WARN_STRICT_PROTOTYPES = YES;
305
- CLANG_WARN_SUSPICIOUS_MOVE = YES;
306
- CLANG_WARN_UNREACHABLE_CODE = YES;
307
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
308
- COPY_PHASE_STRIP = YES;
309
- ENABLE_NS_ASSERTIONS = NO;
310
- ENABLE_STRICT_OBJC_MSGSEND = YES;
311
- GCC_C_LANGUAGE_STANDARD = gnu99;
312
- GCC_NO_COMMON_BLOCKS = YES;
313
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
314
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
315
- GCC_WARN_UNDECLARED_SELECTOR = YES;
316
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
317
- GCC_WARN_UNUSED_FUNCTION = YES;
318
- GCC_WARN_UNUSED_VARIABLE = YES;
319
- IPHONEOS_DEPLOYMENT_TARGET = 11.0;
320
- MTL_ENABLE_DEBUG_INFO = NO;
321
- SDKROOT = iphoneos;
322
- VALIDATE_PRODUCT = YES;
323
- };
324
- name = Release;
325
- };
326
- 58B511F01A9E6C8500147676 /* Debug */ = {
327
- isa = XCBuildConfiguration;
328
- buildSettings = {
329
- HEADER_SEARCH_PATHS = (
330
- "$(inherited)",
331
- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
332
- "$(SRCROOT)/../../../React/**",
333
- "$(SRCROOT)/../../react-native/React/**",
334
- );
335
- LIBRARY_SEARCH_PATHS = "$(inherited)";
336
- OTHER_LDFLAGS = "-ObjC";
337
- PRODUCT_NAME = KeyboardController;
338
- SKIP_INSTALL = YES;
339
- SWIFT_OBJC_BRIDGING_HEADER = "KeyboardController-Bridging-Header.h";
340
- SWIFT_OPTIMIZATION_LEVEL = "-Onone";
341
- SWIFT_VERSION = 5.0;
342
- };
343
- name = Debug;
344
- };
345
- 58B511F11A9E6C8500147676 /* Release */ = {
346
- isa = XCBuildConfiguration;
347
- buildSettings = {
348
- HEADER_SEARCH_PATHS = (
349
- "$(inherited)",
350
- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
351
- "$(SRCROOT)/../../../React/**",
352
- "$(SRCROOT)/../../react-native/React/**",
353
- );
354
- LIBRARY_SEARCH_PATHS = "$(inherited)";
355
- OTHER_LDFLAGS = "-ObjC";
356
- PRODUCT_NAME = KeyboardController;
357
- SKIP_INSTALL = YES;
358
- SWIFT_OBJC_BRIDGING_HEADER = "KeyboardController-Bridging-Header.h";
359
- SWIFT_VERSION = 5.0;
360
- };
361
- name = Release;
362
- };
363
- /* End XCBuildConfiguration section */
364
-
365
- /* Begin XCConfigurationList section */
366
- 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "KeyboardController" */ = {
367
- isa = XCConfigurationList;
368
- buildConfigurations = (
369
- 58B511ED1A9E6C8500147676 /* Debug */,
370
- 58B511EE1A9E6C8500147676 /* Release */,
371
- );
372
- defaultConfigurationIsVisible = 0;
373
- defaultConfigurationName = Release;
374
- };
375
- 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "KeyboardController" */ = {
376
- isa = XCConfigurationList;
377
- buildConfigurations = (
378
- 58B511F01A9E6C8500147676 /* Debug */,
379
- 58B511F11A9E6C8500147676 /* Release */,
380
- );
381
- defaultConfigurationIsVisible = 0;
382
- defaultConfigurationName = Release;
383
- };
384
- /* End XCConfigurationList section */
385
- };
386
- rootObject = 58B511D31A9E6C8500147676 /* Project object */;
387
- }
@@ -1,41 +0,0 @@
1
- //
2
- // TextChangeObserver.swift
3
- // KeyboardController
4
- //
5
- // Created by Kiryl Ziusko on 27/11/2023.
6
- // Copyright © 2023 Facebook. All rights reserved.
7
- //
8
-
9
- public class TextChangeObserver {
10
- private var observer: Any?
11
-
12
- func observeTextChanges(for input: UIResponder?, handler: @escaping (String?) -> Void) {
13
- if input == nil {
14
- return
15
- }
16
- if let textField = input as? UITextField {
17
- observer = NotificationCenter.default.addObserver(
18
- forName: UITextField.textDidChangeNotification,
19
- object: textField,
20
- queue: nil
21
- ) { _ in
22
- handler(textField.text)
23
- }
24
- } else if let textView = input as? UITextView {
25
- observer = NotificationCenter.default.addObserver(
26
- forName: UITextView.textDidChangeNotification,
27
- object: textView,
28
- queue: nil
29
- ) { _ in
30
- handler(textView.text)
31
- }
32
- }
33
- }
34
-
35
- func removeObserver() {
36
- if let observer = observer {
37
- NotificationCenter.default.removeObserver(observer)
38
- self.observer = nil
39
- }
40
- }
41
- }