@react-native-ohos/react-native-keyboard-controller 1.12.8-rc.1
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.
- package/LICENSE +21 -0
- package/README.OpenSource +11 -0
- package/README.md +19 -0
- package/harmony/keyboard_controller/BuildProfile.ets +17 -0
- package/harmony/keyboard_controller/Index.ets +9 -0
- package/harmony/keyboard_controller/ResourceTable.txt +9 -0
- package/harmony/keyboard_controller/build-profile.json5 +31 -0
- package/harmony/keyboard_controller/consumer-rules.txt +0 -0
- package/harmony/keyboard_controller/hvigorfile.ts +6 -0
- package/harmony/keyboard_controller/obfuscation-rules.txt +18 -0
- package/harmony/keyboard_controller/oh-package.json5 +11 -0
- package/harmony/keyboard_controller/src/main/cpp/CMakeLists.txt +7 -0
- package/harmony/keyboard_controller/src/main/cpp/EventEmitters.cpp +96 -0
- package/harmony/keyboard_controller/src/main/cpp/EventEmitters.h +90 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentDescriptor.h +77 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +158 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.h +74 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewJSIBinder.h +43 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentDescriptor.h +64 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +89 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.h +63 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaJSIBinder.h +39 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.cpp +25 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.h +27 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.cpp +43 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.h +56 -0
- package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.cpp +24 -0
- package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.h +28 -0
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.cpp +43 -0
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.h +56 -0
- package/harmony/keyboard_controller/src/main/ets/Logger.ts +46 -0
- package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerPackage.ets +46 -0
- package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerTurboModule.ts +210 -0
- package/harmony/keyboard_controller/src/main/ets/RNStatusBarManagerCompatTurboModule.ts +98 -0
- package/harmony/keyboard_controller/src/main/ets/Type.ts +41 -0
- package/harmony/keyboard_controller/src/main/module.json +29 -0
- package/harmony/keyboard_controller/src/main/module.json5 +11 -0
- package/harmony/keyboard_controller/src/main/resources/base/element/string.json +8 -0
- package/harmony/keyboard_controller/src/main/resources/en_US/element/string.json +8 -0
- package/harmony/keyboard_controller/src/main/resources/zh_CN/element/string.json +8 -0
- package/harmony/keyboard_controller/ts.ets +9 -0
- package/harmony/keyboard_controller.har +0 -0
- package/lib/commonjs/animated.js +174 -0
- package/lib/commonjs/animated.js.map +1 -0
- package/lib/commonjs/bindings.js +38 -0
- package/lib/commonjs/bindings.js.map +1 -0
- package/lib/commonjs/bindings.native.js +37 -0
- package/lib/commonjs/bindings.native.js.map +1 -0
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js +66 -0
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -0
- package/lib/commonjs/components/KeyboardAvoidingView/index.js +102 -0
- package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js +255 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +110 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/utils.js +37 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/utils.js.map +1 -0
- package/lib/commonjs/components/KeyboardStickyView/index.js +40 -0
- package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/Arrow.js +76 -0
- package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/Button.js +70 -0
- package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/colors.js +21 -0
- package/lib/commonjs/components/KeyboardToolbar/colors.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/colors.native.js +40 -0
- package/lib/commonjs/components/KeyboardToolbar/colors.native.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/index.js +152 -0
- package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/types.js +6 -0
- package/lib/commonjs/components/KeyboardToolbar/types.js.map +1 -0
- package/lib/commonjs/components/hooks/useColorScheme.js +10 -0
- package/lib/commonjs/components/hooks/useColorScheme.js.map +1 -0
- package/lib/commonjs/components/index.js +42 -0
- package/lib/commonjs/components/index.js.map +1 -0
- package/lib/commonjs/constants.js +25 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/context.js +42 -0
- package/lib/commonjs/context.js.map +1 -0
- package/lib/commonjs/hooks/index.js +104 -0
- package/lib/commonjs/hooks/index.js.map +1 -0
- package/lib/commonjs/hooks/useWindowDimensions/index.android.js +29 -0
- package/lib/commonjs/hooks/useWindowDimensions/index.android.js.map +1 -0
- package/lib/commonjs/hooks/useWindowDimensions/index.js +13 -0
- package/lib/commonjs/hooks/useWindowDimensions/index.js.map +1 -0
- package/lib/commonjs/index.js +116 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/internal.js +73 -0
- package/lib/commonjs/internal.js.map +1 -0
- package/lib/commonjs/monkey-patch.android.js +57 -0
- package/lib/commonjs/monkey-patch.android.js.map +1 -0
- package/lib/commonjs/monkey-patch.js +11 -0
- package/lib/commonjs/monkey-patch.js.map +1 -0
- package/lib/commonjs/reanimated.js +12 -0
- package/lib/commonjs/reanimated.js.map +1 -0
- package/lib/commonjs/reanimated.native.js +88 -0
- package/lib/commonjs/reanimated.native.js.map +1 -0
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js +10 -0
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js +12 -0
- package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/NativeKeyboardController.js +9 -0
- package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -0
- package/lib/commonjs/specs/NativeStatusBarManagerCompat.js +9 -0
- package/lib/commonjs/specs/NativeStatusBarManagerCompat.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils.js +9 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/module/animated.js +166 -0
- package/lib/module/animated.js.map +1 -0
- package/lib/module/bindings.js +32 -0
- package/lib/module/bindings.js.map +1 -0
- package/lib/module/bindings.native.js +31 -0
- package/lib/module/bindings.native.js.map +1 -0
- package/lib/module/components/KeyboardAvoidingView/hooks.js +59 -0
- package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -0
- package/lib/module/components/KeyboardAvoidingView/index.js +95 -0
- package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -0
- package/lib/module/components/KeyboardAwareScrollView/index.js +248 -0
- package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -0
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +103 -0
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -0
- package/lib/module/components/KeyboardAwareScrollView/utils.js +29 -0
- package/lib/module/components/KeyboardAwareScrollView/utils.js.map +1 -0
- package/lib/module/components/KeyboardStickyView/index.js +33 -0
- package/lib/module/components/KeyboardStickyView/index.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/Arrow.js +68 -0
- package/lib/module/components/KeyboardToolbar/Arrow.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/Button.js +62 -0
- package/lib/module/components/KeyboardToolbar/Button.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/colors.js +15 -0
- package/lib/module/components/KeyboardToolbar/colors.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/colors.native.js +34 -0
- package/lib/module/components/KeyboardToolbar/colors.native.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/index.js +140 -0
- package/lib/module/components/KeyboardToolbar/index.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/types.js +2 -0
- package/lib/module/components/KeyboardToolbar/types.js.map +1 -0
- package/lib/module/components/hooks/useColorScheme.js +4 -0
- package/lib/module/components/hooks/useColorScheme.js.map +1 -0
- package/lib/module/components/index.js +5 -0
- package/lib/module/components/index.js.map +1 -0
- package/lib/module/constants.js +19 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/context.js +35 -0
- package/lib/module/context.js.map +1 -0
- package/lib/module/hooks/index.js +68 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/useWindowDimensions/index.android.js +22 -0
- package/lib/module/hooks/useWindowDimensions/index.android.js.map +1 -0
- package/lib/module/hooks/useWindowDimensions/index.js +2 -0
- package/lib/module/hooks/useWindowDimensions/index.js.map +1 -0
- package/lib/module/index.js +10 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/internal.js +66 -0
- package/lib/module/internal.js.map +1 -0
- package/lib/module/monkey-patch.android.js +47 -0
- package/lib/module/monkey-patch.android.js.map +1 -0
- package/lib/module/monkey-patch.js +5 -0
- package/lib/module/monkey-patch.js.map +1 -0
- package/lib/module/reanimated.js +6 -0
- package/lib/module/reanimated.js.map +1 -0
- package/lib/module/reanimated.native.js +78 -0
- package/lib/module/reanimated.native.js.map +1 -0
- package/lib/module/specs/KeyboardControllerViewNativeComponent.js +3 -0
- package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -0
- package/lib/module/specs/KeyboardGestureAreaNativeComponent.js +5 -0
- package/lib/module/specs/KeyboardGestureAreaNativeComponent.js.map +1 -0
- package/lib/module/specs/NativeKeyboardController.js +3 -0
- package/lib/module/specs/NativeKeyboardController.js.map +1 -0
- package/lib/module/specs/NativeStatusBarManagerCompat.js +3 -0
- package/lib/module/specs/NativeStatusBarManagerCompat.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils.js +2 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/typescript/animated.d.ts +31 -0
- package/lib/typescript/bindings.d.ts +12 -0
- package/lib/typescript/bindings.native.d.ts +12 -0
- package/lib/typescript/components/KeyboardAvoidingView/hooks.d.ts +6 -0
- package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +50 -0
- package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +25 -0
- package/lib/typescript/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.d.ts +6 -0
- package/lib/typescript/components/KeyboardAwareScrollView/utils.d.ts +2 -0
- package/lib/typescript/components/KeyboardStickyView/index.d.ts +35 -0
- package/lib/typescript/components/KeyboardToolbar/Arrow.d.ts +9 -0
- package/lib/typescript/components/KeyboardToolbar/Button.d.ts +15 -0
- package/lib/typescript/components/KeyboardToolbar/colors.d.ts +2 -0
- package/lib/typescript/components/KeyboardToolbar/colors.native.d.ts +2 -0
- package/lib/typescript/components/KeyboardToolbar/index.d.ts +50 -0
- package/lib/typescript/components/KeyboardToolbar/types.d.ts +18 -0
- package/lib/typescript/components/hooks/useColorScheme.d.ts +2 -0
- package/lib/typescript/components/index.d.ts +8 -0
- package/lib/typescript/constants.d.ts +16 -0
- package/lib/typescript/context.d.ts +23 -0
- package/lib/typescript/hooks/index.d.ts +17 -0
- package/lib/typescript/hooks/useWindowDimensions/index.android.d.ts +2 -0
- package/lib/typescript/hooks/useWindowDimensions/index.d.ts +1 -0
- package/lib/typescript/index.d.ts +8 -0
- package/lib/typescript/internal.d.ts +30 -0
- package/lib/typescript/monkey-patch.android.d.ts +2 -0
- package/lib/typescript/monkey-patch.d.ts +2 -0
- package/lib/typescript/reanimated.d.ts +5 -0
- package/lib/typescript/reanimated.native.d.ts +7 -0
- package/lib/typescript/specs/KeyboardControllerViewNativeComponent.d.ts +53 -0
- package/lib/typescript/specs/KeyboardGestureAreaNativeComponent.d.ts +10 -0
- package/lib/typescript/specs/NativeKeyboardController.d.ts +12 -0
- package/lib/typescript/specs/NativeStatusBarManagerCompat.d.ts +10 -0
- package/lib/typescript/types.d.ts +133 -0
- package/lib/typescript/utils.d.ts +1 -0
- package/package.json +177 -0
- package/react-native-keyboard-controller.podspec +61 -0
- package/src/animated.tsx +246 -0
- package/src/bindings.native.ts +57 -0
- package/src/bindings.ts +38 -0
- package/src/components/KeyboardAvoidingView/hooks.ts +58 -0
- package/src/components/KeyboardAvoidingView/index.tsx +156 -0
- package/src/components/KeyboardAwareScrollView/index.tsx +373 -0
- package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +133 -0
- package/src/components/KeyboardAwareScrollView/utils.ts +41 -0
- package/src/components/KeyboardStickyView/index.tsx +57 -0
- package/src/components/KeyboardToolbar/Arrow.tsx +80 -0
- package/src/components/KeyboardToolbar/Button.tsx +98 -0
- package/src/components/KeyboardToolbar/colors.native.ts +37 -0
- package/src/components/KeyboardToolbar/colors.ts +16 -0
- package/src/components/KeyboardToolbar/index.tsx +211 -0
- package/src/components/KeyboardToolbar/types.ts +40 -0
- package/src/components/hooks/useColorScheme.ts +5 -0
- package/src/components/index.ts +11 -0
- package/src/constants.ts +19 -0
- package/src/context.ts +65 -0
- package/src/hooks/index.ts +90 -0
- package/src/hooks/useWindowDimensions/index.android.ts +33 -0
- package/src/hooks/useWindowDimensions/index.ts +1 -0
- package/src/index.ts +21 -0
- package/src/internal.ts +84 -0
- package/src/monkey-patch.android.ts +44 -0
- package/src/monkey-patch.ts +4 -0
- package/src/reanimated.native.ts +132 -0
- package/src/reanimated.ts +29 -0
- package/src/specs/KeyboardControllerViewNativeComponent.ts +70 -0
- package/src/specs/KeyboardGestureAreaNativeComponent.ts +15 -0
- package/src/specs/NativeKeyboardController.ts +19 -0
- package/src/specs/NativeStatusBarManagerCompat.ts +14 -0
- package/src/types.ts +211 -0
- package/src/utils.ts +1 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Platform } from "react-native";
|
|
2
|
+
import { Easing, useAnimatedReaction, useSharedValue, withTiming } from "react-native-reanimated";
|
|
3
|
+
import { useKeyboardHandler } from "../../hooks";
|
|
4
|
+
const IS_ANDROID_ELEVEN_OR_HIGHER = Platform.OS === "android" && Platform.Version >= 30;
|
|
5
|
+
// on these platforms keyboard transitions will be smooth
|
|
6
|
+
const IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS = IS_ANDROID_ELEVEN_OR_HIGHER || Platform.OS === "ios" || Platform.OS === 'harmony';
|
|
7
|
+
// on Android Telegram is not using androidx.core values and uses custom interpolation
|
|
8
|
+
// duration is taken from here: https://github.com/DrKLO/Telegram/blob/e9a35cea54c06277c69d41b8e25d94b5d7ede065/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/AdjustPanLayoutHelper.java#L39
|
|
9
|
+
// and bezier is taken from: https://github.com/DrKLO/Telegram/blob/e9a35cea54c06277c69d41b8e25d94b5d7ede065/TMessagesProj/src/main/java/androidx/recyclerview/widget/ChatListItemAnimator.java#L40
|
|
10
|
+
const TELEGRAM_ANDROID_TIMING_CONFIG = {
|
|
11
|
+
duration: 250,
|
|
12
|
+
easing: Easing.bezier(0.19919472913616398, 0.010644531250000006, 0.27920937042459737, 0.91025390625)
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Hook that uses default transitions for iOS and Android > 11, and uses
|
|
17
|
+
* custom interpolation on Android < 11 to achieve more smooth animation
|
|
18
|
+
*/
|
|
19
|
+
export const useSmoothKeyboardHandler = (handler, deps) => {
|
|
20
|
+
const target = useSharedValue(-1);
|
|
21
|
+
const height = useSharedValue(0);
|
|
22
|
+
const persistedHeight = useSharedValue(0);
|
|
23
|
+
const animatedKeyboardHeight = useSharedValue(0);
|
|
24
|
+
useAnimatedReaction(() => {
|
|
25
|
+
if (IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (persistedHeight.value === 0) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const event = {
|
|
32
|
+
// it'll be always `TELEGRAM_ANDROID_TIMING_CONFIG.duration`, since we're running animation via `withTiming`
|
|
33
|
+
duration: TELEGRAM_ANDROID_TIMING_CONFIG.duration,
|
|
34
|
+
target: target.value,
|
|
35
|
+
height: animatedKeyboardHeight.value,
|
|
36
|
+
progress: animatedKeyboardHeight.value / persistedHeight.value
|
|
37
|
+
};
|
|
38
|
+
return event;
|
|
39
|
+
}, evt => {
|
|
40
|
+
var _handler$onMove;
|
|
41
|
+
if (!evt) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
(_handler$onMove = handler.onMove) === null || _handler$onMove === void 0 || _handler$onMove.call(handler, evt);
|
|
45
|
+
|
|
46
|
+
// dispatch `onEnd`
|
|
47
|
+
if (evt.height === height.value) {
|
|
48
|
+
var _handler$onEnd;
|
|
49
|
+
(_handler$onEnd = handler.onEnd) === null || _handler$onEnd === void 0 || _handler$onEnd.call(handler, evt);
|
|
50
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
51
|
+
persistedHeight.value = height.value;
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
// REA uses own version of `DependencyList` and it's not compatible with the same type from React
|
|
55
|
+
deps);
|
|
56
|
+
useKeyboardHandler({
|
|
57
|
+
onStart: e => {
|
|
58
|
+
"worklet";
|
|
59
|
+
|
|
60
|
+
// immediately dispatch onStart/onEnd events if onStart dispatched with the same height
|
|
61
|
+
// and don't wait for animation 250ms
|
|
62
|
+
var _handler$onStart2;
|
|
63
|
+
if (!IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS && e.height === persistedHeight.value) {
|
|
64
|
+
var _handler$onStart, _handler$onEnd2;
|
|
65
|
+
(_handler$onStart = handler.onStart) === null || _handler$onStart === void 0 || _handler$onStart.call(handler, e);
|
|
66
|
+
(_handler$onEnd2 = handler.onEnd) === null || _handler$onEnd2 === void 0 || _handler$onEnd2.call(handler, e);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
target.value = e.target;
|
|
70
|
+
height.value = e.height;
|
|
71
|
+
if (e.height > 0) {
|
|
72
|
+
persistedHeight.value = e.height;
|
|
73
|
+
}
|
|
74
|
+
// if we are running on Android < 9, then we are using custom interpolation
|
|
75
|
+
// to achieve smoother animation and use `animatedKeyboardHeight` as animation
|
|
76
|
+
// driver
|
|
77
|
+
if (!IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS) {
|
|
78
|
+
animatedKeyboardHeight.value = withTiming(e.height, TELEGRAM_ANDROID_TIMING_CONFIG);
|
|
79
|
+
}
|
|
80
|
+
(_handler$onStart2 = handler.onStart) === null || _handler$onStart2 === void 0 || _handler$onStart2.call(handler, {
|
|
81
|
+
...e,
|
|
82
|
+
duration: IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS ? e.duration : TELEGRAM_ANDROID_TIMING_CONFIG.duration
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
onMove: e => {
|
|
86
|
+
"worklet";
|
|
87
|
+
|
|
88
|
+
if (IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS) {
|
|
89
|
+
var _handler$onMove2;
|
|
90
|
+
(_handler$onMove2 = handler.onMove) === null || _handler$onMove2 === void 0 || _handler$onMove2.call(handler, e);
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
onEnd: e => {
|
|
94
|
+
"worklet";
|
|
95
|
+
|
|
96
|
+
if (IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS) {
|
|
97
|
+
var _handler$onEnd3;
|
|
98
|
+
(_handler$onEnd3 = handler.onEnd) === null || _handler$onEnd3 === void 0 || _handler$onEnd3.call(handler, e);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, deps);
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=useSmoothKeyboardHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","Easing","useAnimatedReaction","useSharedValue","withTiming","useKeyboardHandler","IS_ANDROID_ELEVEN_OR_HIGHER","OS","Version","IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS","TELEGRAM_ANDROID_TIMING_CONFIG","duration","easing","bezier","useSmoothKeyboardHandler","handler","deps","target","height","persistedHeight","animatedKeyboardHeight","value","event","progress","evt","_handler$onMove","onMove","call","_handler$onEnd","onEnd","onStart","e","_handler$onStart2","_handler$onStart","_handler$onEnd2","_handler$onMove2","_handler$onEnd3"],"sources":["useSmoothKeyboardHandler.ts"],"sourcesContent":["import { Platform } from \"react-native\";\r\nimport {\r\n Easing,\r\n useAnimatedReaction,\r\n useSharedValue,\r\n withTiming,\r\n} from \"react-native-reanimated\";\r\n\r\nimport { useKeyboardHandler } from \"../../hooks\";\r\n\r\nconst IS_ANDROID_ELEVEN_OR_HIGHER =\r\n Platform.OS === \"android\" && Platform.Version >= 30;\r\n// on these platforms keyboard transitions will be smooth\r\nconst IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS =\r\n IS_ANDROID_ELEVEN_OR_HIGHER || Platform.OS === \"ios\" || Platform.OS as string === 'harmony';\r\n// on Android Telegram is not using androidx.core values and uses custom interpolation\r\n// duration is taken from here: https://github.com/DrKLO/Telegram/blob/e9a35cea54c06277c69d41b8e25d94b5d7ede065/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/AdjustPanLayoutHelper.java#L39\r\n// and bezier is taken from: https://github.com/DrKLO/Telegram/blob/e9a35cea54c06277c69d41b8e25d94b5d7ede065/TMessagesProj/src/main/java/androidx/recyclerview/widget/ChatListItemAnimator.java#L40\r\nconst TELEGRAM_ANDROID_TIMING_CONFIG = {\r\n duration: 250,\r\n easing: Easing.bezier(\r\n 0.19919472913616398,\r\n 0.010644531250000006,\r\n 0.27920937042459737,\r\n 0.91025390625,\r\n ),\r\n};\r\n\r\n/**\r\n * Hook that uses default transitions for iOS and Android > 11, and uses\r\n * custom interpolation on Android < 11 to achieve more smooth animation\r\n */\r\nexport const useSmoothKeyboardHandler: typeof useKeyboardHandler = (\r\n handler,\r\n deps,\r\n) => {\r\n const target = useSharedValue(-1);\r\n const height = useSharedValue(0);\r\n const persistedHeight = useSharedValue(0);\r\n const animatedKeyboardHeight = useSharedValue(0);\r\n\r\n useAnimatedReaction(\r\n () => {\r\n if (IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS) {\r\n return;\r\n }\r\n if (persistedHeight.value === 0) {\r\n return;\r\n }\r\n const event = {\r\n // it'll be always `TELEGRAM_ANDROID_TIMING_CONFIG.duration`, since we're running animation via `withTiming`\r\n duration: TELEGRAM_ANDROID_TIMING_CONFIG.duration,\r\n target: target.value,\r\n height: animatedKeyboardHeight.value,\r\n progress: animatedKeyboardHeight.value / persistedHeight.value,\r\n };\r\n return event;\r\n },\r\n (evt) => {\r\n if (!evt) {\r\n return;\r\n }\r\n handler.onMove?.(evt);\r\n\r\n // dispatch `onEnd`\r\n if (evt.height === height.value) {\r\n handler.onEnd?.(evt);\r\n // eslint-disable-next-line react-compiler/react-compiler\r\n persistedHeight.value = height.value;\r\n }\r\n },\r\n // REA uses own version of `DependencyList` and it's not compatible with the same type from React\r\n deps as unknown[],\r\n );\r\n\r\n useKeyboardHandler(\r\n {\r\n onStart: (e) => {\r\n \"worklet\";\r\n\r\n // immediately dispatch onStart/onEnd events if onStart dispatched with the same height\r\n // and don't wait for animation 250ms\r\n if (\r\n !IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS &&\r\n e.height === persistedHeight.value\r\n ) {\r\n handler.onStart?.(e);\r\n handler.onEnd?.(e);\r\n\r\n return;\r\n }\r\n\r\n target.value = e.target;\r\n height.value = e.height;\r\n\r\n if (e.height > 0) {\r\n persistedHeight.value = e.height;\r\n }\r\n // if we are running on Android < 9, then we are using custom interpolation\r\n // to achieve smoother animation and use `animatedKeyboardHeight` as animation\r\n // driver\r\n if (!IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS) {\r\n animatedKeyboardHeight.value = withTiming(\r\n e.height,\r\n TELEGRAM_ANDROID_TIMING_CONFIG,\r\n );\r\n }\r\n\r\n handler.onStart?.({\r\n ...e,\r\n duration: IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS\r\n ? e.duration\r\n : TELEGRAM_ANDROID_TIMING_CONFIG.duration,\r\n });\r\n },\r\n onMove: (e) => {\r\n \"worklet\";\r\n\r\n if (IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS) {\r\n handler.onMove?.(e);\r\n }\r\n },\r\n onEnd: (e) => {\r\n \"worklet\";\r\n\r\n if (IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS) {\r\n handler.onEnd?.(e);\r\n }\r\n },\r\n },\r\n deps,\r\n );\r\n};\r\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SACEC,MAAM,EACNC,mBAAmB,EACnBC,cAAc,EACdC,UAAU,QACL,yBAAyB;AAEhC,SAASC,kBAAkB,QAAQ,aAAa;AAEhD,MAAMC,2BAA2B,GAC/BN,QAAQ,CAACO,EAAE,KAAK,SAAS,IAAIP,QAAQ,CAACQ,OAAO,IAAI,EAAE;AACrD;AACA,MAAMC,kCAAkC,GACtCH,2BAA2B,IAAIN,QAAQ,CAACO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,EAAGK,CAAC,IAAK;MACb,SAAS;;MAET,IAAItB,kCAAkC,EAAE;QAAA,IAAA0B,gBAAA;QACtC,CAAAA,gBAAA,GAAApB,OAAO,CAACW,MAAM,cAAAS,gBAAA,eAAdA,gBAAA,CAAAR,IAAA,CAAAZ,OAAO,EAAUgB,CAAC,CAAC;MACrB;IACF,CAAC;IACDF,KAAK,EAAGE,CAAC,IAAK;MACZ,SAAS;;MAET,IAAItB,kCAAkC,EAAE;QAAA,IAAA2B,eAAA;QACtC,CAAAA,eAAA,GAAArB,OAAO,CAACc,KAAK,cAAAO,eAAA,eAAbA,eAAA,CAAAT,IAAA,CAAAZ,OAAO,EAASgB,CAAC,CAAC;MACpB;IACF;EACF,CAAC,EACDf,IACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const debounce = (worklet, wait = 0) => {
|
|
2
|
+
"worklet";
|
|
3
|
+
|
|
4
|
+
const value = {
|
|
5
|
+
time: 0
|
|
6
|
+
};
|
|
7
|
+
return (...args) => {
|
|
8
|
+
"worklet";
|
|
9
|
+
|
|
10
|
+
const t = Date.now();
|
|
11
|
+
const now = t - value.time;
|
|
12
|
+
if (now < wait) {
|
|
13
|
+
value.time = t;
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
value.time = t;
|
|
17
|
+
return worklet(...args);
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export const scrollDistanceWithRespectToSnapPoints = (defaultScrollValue, snapPoints) => {
|
|
21
|
+
"worklet";
|
|
22
|
+
|
|
23
|
+
let snapPoint;
|
|
24
|
+
if (snapPoints) {
|
|
25
|
+
snapPoint = snapPoints.find(offset => offset >= defaultScrollValue);
|
|
26
|
+
}
|
|
27
|
+
return snapPoint ?? defaultScrollValue;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["debounce","worklet","wait","value","time","args","t","Date","now","scrollDistanceWithRespectToSnapPoints","defaultScrollValue","snapPoints","snapPoint","find","offset"],"sources":["utils.ts"],"sourcesContent":["export const debounce = <F extends (...args: Parameters<F>) => ReturnType<F>>(\r\n worklet: F,\r\n wait = 0,\r\n) => {\r\n \"worklet\";\r\n\r\n const value = {\r\n time: 0,\r\n };\r\n\r\n return (...args: Parameters<F>): ReturnType<F> | void => {\r\n \"worklet\";\r\n\r\n const t = Date.now();\r\n const now = t - value.time;\r\n\r\n if (now < wait) {\r\n value.time = t;\r\n return;\r\n }\r\n\r\n value.time = t;\r\n\r\n return worklet(...args);\r\n };\r\n};\r\n\r\nexport const scrollDistanceWithRespectToSnapPoints = (\r\n defaultScrollValue: number,\r\n snapPoints?: number[],\r\n) => {\r\n \"worklet\";\r\n\r\n let snapPoint: number | undefined;\r\n\r\n if (snapPoints) {\r\n snapPoint = snapPoints.find((offset) => offset >= defaultScrollValue);\r\n }\r\n\r\n return snapPoint ?? defaultScrollValue;\r\n};\r\n"],"mappings":"AAAA,OAAO,MAAMA,QAAQ,GAAGA,CACtBC,OAAU,EACVC,IAAI,GAAG,CAAC,KACL;EACH,SAAS;;EAET,MAAMC,KAAK,GAAG;IACZC,IAAI,EAAE;EACR,CAAC;EAED,OAAO,CAAC,GAAGC,IAAmB,KAA2B;IACvD,SAAS;;IAET,MAAMC,CAAC,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC;IACpB,MAAMA,GAAG,GAAGF,CAAC,GAAGH,KAAK,CAACC,IAAI;IAE1B,IAAII,GAAG,GAAGN,IAAI,EAAE;MACdC,KAAK,CAACC,IAAI,GAAGE,CAAC;MACd;IACF;IAEAH,KAAK,CAACC,IAAI,GAAGE,CAAC;IAEd,OAAOL,OAAO,CAAC,GAAGI,IAAI,CAAC;EACzB,CAAC;AACH,CAAC;AAED,OAAO,MAAMI,qCAAqC,GAAGA,CACnDC,kBAA0B,EAC1BC,UAAqB,KAClB;EACH,SAAS;;EAET,IAAIC,SAA6B;EAEjC,IAAID,UAAU,EAAE;IACdC,SAAS,GAAGD,UAAU,CAACE,IAAI,CAAEC,MAAM,IAAKA,MAAM,IAAIJ,kBAAkB,CAAC;EACvE;EAEA,OAAOE,SAAS,IAAIF,kBAAkB;AACxC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React, { forwardRef, useMemo } from "react";
|
|
3
|
+
import Reanimated, { interpolate, useAnimatedStyle } from "react-native-reanimated";
|
|
4
|
+
import { useReanimatedKeyboardAnimation } from "../../hooks";
|
|
5
|
+
const KeyboardStickyView = /*#__PURE__*/forwardRef(({
|
|
6
|
+
children,
|
|
7
|
+
offset: {
|
|
8
|
+
closed = 0,
|
|
9
|
+
opened = 0
|
|
10
|
+
} = {},
|
|
11
|
+
style,
|
|
12
|
+
...props
|
|
13
|
+
}, ref) => {
|
|
14
|
+
const {
|
|
15
|
+
height,
|
|
16
|
+
progress
|
|
17
|
+
} = useReanimatedKeyboardAnimation();
|
|
18
|
+
const stickyViewStyle = useAnimatedStyle(() => {
|
|
19
|
+
const offset = interpolate(progress.value, [0, 1], [closed, opened]);
|
|
20
|
+
return {
|
|
21
|
+
transform: [{
|
|
22
|
+
translateY: height.value + offset
|
|
23
|
+
}]
|
|
24
|
+
};
|
|
25
|
+
}, [closed, opened]);
|
|
26
|
+
const styles = useMemo(() => [style, stickyViewStyle], [style, stickyViewStyle]);
|
|
27
|
+
return /*#__PURE__*/React.createElement(Reanimated.View, _extends({
|
|
28
|
+
ref: ref,
|
|
29
|
+
style: styles
|
|
30
|
+
}, props), children);
|
|
31
|
+
});
|
|
32
|
+
export default KeyboardStickyView;
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","forwardRef","useMemo","Reanimated","interpolate","useAnimatedStyle","useReanimatedKeyboardAnimation","KeyboardStickyView","children","offset","closed","opened","style","props","ref","height","progress","stickyViewStyle","value","transform","translateY","styles","createElement","View","_extends"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useMemo } from \"react\";\r\nimport Reanimated, {\r\n interpolate,\r\n useAnimatedStyle,\r\n} from \"react-native-reanimated\";\r\n\r\nimport { useReanimatedKeyboardAnimation } from \"../../hooks\";\r\n\r\nimport type { View, ViewProps } from \"react-native\";\r\n\r\nexport type KeyboardStickyViewProps = {\r\n /**\r\n * Specify additional offset to the view for given keyboard state.\r\n */\r\n offset?: {\r\n /**\r\n * Adds additional `translateY` when keyboard is close. By default `0`.\r\n */\r\n closed?: number;\r\n /**\r\n * Adds additional `translateY` when keyboard is open. By default `0`.\r\n */\r\n opened?: number;\r\n };\r\n} & ViewProps;\r\n\r\nconst KeyboardStickyView = forwardRef<\r\n View,\r\n React.PropsWithChildren<KeyboardStickyViewProps>\r\n>(\r\n (\r\n { children, offset: { closed = 0, opened = 0 } = {}, style, ...props },\r\n ref,\r\n ) => {\r\n const { height, progress } = useReanimatedKeyboardAnimation();\r\n const stickyViewStyle = useAnimatedStyle(() => {\r\n const offset = interpolate(progress.value, [0, 1], [closed, opened]);\r\n\r\n return {\r\n transform: [{ translateY: height.value + offset }],\r\n };\r\n }, [closed, opened]);\r\n\r\n const styles = useMemo(\r\n () => [style, stickyViewStyle],\r\n [style, stickyViewStyle],\r\n );\r\n\r\n return (\r\n <Reanimated.View ref={ref} style={styles} {...props}>\r\n {children}\r\n </Reanimated.View>\r\n );\r\n },\r\n);\r\n\r\nexport default KeyboardStickyView;\r\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAClD,OAAOC,UAAU,IACfC,WAAW,EACXC,gBAAgB,QACX,yBAAyB;AAEhC,SAASC,8BAA8B,QAAQ,aAAa;AAoB5D,MAAMC,kBAAkB,gBAAGN,UAAU,CAInC,CACE;EAAEO,QAAQ;EAAEC,MAAM,EAAE;IAAEC,MAAM,GAAG,CAAC;IAAEC,MAAM,GAAG;EAAE,CAAC,GAAG,CAAC,CAAC;EAAEC,KAAK;EAAE,GAAGC;AAAM,CAAC,EACtEC,GAAG,KACA;EACH,MAAM;IAAEC,MAAM;IAAEC;EAAS,CAAC,GAAGV,8BAA8B,CAAC,CAAC;EAC7D,MAAMW,eAAe,GAAGZ,gBAAgB,CAAC,MAAM;IAC7C,MAAMI,MAAM,GAAGL,WAAW,CAACY,QAAQ,CAACE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAACR,MAAM,EAAEC,MAAM,CAAC,CAAC;IAEpE,OAAO;MACLQ,SAAS,EAAE,CAAC;QAAEC,UAAU,EAAEL,MAAM,CAACG,KAAK,GAAGT;MAAO,CAAC;IACnD,CAAC;EACH,CAAC,EAAE,CAACC,MAAM,EAAEC,MAAM,CAAC,CAAC;EAEpB,MAAMU,MAAM,GAAGnB,OAAO,CACpB,MAAM,CAACU,KAAK,EAAEK,eAAe,CAAC,EAC9B,CAACL,KAAK,EAAEK,eAAe,CACzB,CAAC;EAED,oBACEjB,KAAA,CAAAsB,aAAA,CAACnB,UAAU,CAACoB,IAAI,EAAAC,QAAA;IAACV,GAAG,EAAEA,GAAI;IAACF,KAAK,EAAES;EAAO,GAAKR,KAAK,GAChDL,QACc,CAAC;AAEtB,CACF,CAAC;AAED,eAAeD,kBAAkB","ignoreList":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { Animated, StyleSheet, View } from "react-native";
|
|
3
|
+
import useColorScheme from "../hooks/useColorScheme";
|
|
4
|
+
const ArrowComponent = ({
|
|
5
|
+
type,
|
|
6
|
+
disabled,
|
|
7
|
+
theme
|
|
8
|
+
}) => {
|
|
9
|
+
const colorScheme = useColorScheme();
|
|
10
|
+
const color = useMemo(() => ({
|
|
11
|
+
backgroundColor: disabled ? theme[colorScheme].disabled : theme[colorScheme].primary
|
|
12
|
+
}), [disabled, theme, colorScheme]);
|
|
13
|
+
const left = useMemo(() => [styles.arrowLeftLine, color], [color]);
|
|
14
|
+
const right = useMemo(() => [styles.arrowRightLine, color], [color]);
|
|
15
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
16
|
+
style: type === "next" ? styles.arrowDownContainer : styles.arrowUpContainer
|
|
17
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
18
|
+
style: styles.arrow
|
|
19
|
+
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
20
|
+
style: left
|
|
21
|
+
}), /*#__PURE__*/React.createElement(Animated.View, {
|
|
22
|
+
style: right
|
|
23
|
+
})));
|
|
24
|
+
};
|
|
25
|
+
const arrowLine = {
|
|
26
|
+
width: 13,
|
|
27
|
+
height: 2,
|
|
28
|
+
borderRadius: 1
|
|
29
|
+
};
|
|
30
|
+
const arrowUpContainer = {
|
|
31
|
+
marginHorizontal: 5,
|
|
32
|
+
width: 30,
|
|
33
|
+
height: 30,
|
|
34
|
+
justifyContent: "center",
|
|
35
|
+
alignItems: "center"
|
|
36
|
+
};
|
|
37
|
+
const styles = StyleSheet.create({
|
|
38
|
+
arrowUpContainer: arrowUpContainer,
|
|
39
|
+
arrowDownContainer: {
|
|
40
|
+
...arrowUpContainer,
|
|
41
|
+
transform: [{
|
|
42
|
+
rotate: "180deg"
|
|
43
|
+
}]
|
|
44
|
+
},
|
|
45
|
+
arrow: {
|
|
46
|
+
width: 20,
|
|
47
|
+
height: 20,
|
|
48
|
+
flexDirection: "row",
|
|
49
|
+
alignItems: "center",
|
|
50
|
+
justifyContent: "space-between"
|
|
51
|
+
},
|
|
52
|
+
arrowLeftLine: {
|
|
53
|
+
...arrowLine,
|
|
54
|
+
transform: [{
|
|
55
|
+
rotate: "-45deg"
|
|
56
|
+
}],
|
|
57
|
+
left: -0.5
|
|
58
|
+
},
|
|
59
|
+
arrowRightLine: {
|
|
60
|
+
...arrowLine,
|
|
61
|
+
transform: [{
|
|
62
|
+
rotate: "45deg"
|
|
63
|
+
}],
|
|
64
|
+
left: -5.5
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
export default ArrowComponent;
|
|
68
|
+
//# sourceMappingURL=Arrow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useMemo","Animated","StyleSheet","View","useColorScheme","ArrowComponent","type","disabled","theme","colorScheme","color","backgroundColor","primary","left","styles","arrowLeftLine","right","arrowRightLine","createElement","style","arrowDownContainer","arrowUpContainer","arrow","arrowLine","width","height","borderRadius","marginHorizontal","justifyContent","alignItems","create","transform","rotate","flexDirection"],"sources":["Arrow.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\r\nimport { Animated, StyleSheet, View } from \"react-native\";\r\n\r\nimport useColorScheme from \"../hooks/useColorScheme\";\r\n\r\nimport type { KeyboardToolbarTheme } from \"./types\";\r\nimport type { ViewStyle } from \"react-native\";\r\n\r\ntype ArrowProps = {\r\n type: \"prev\" | \"next\";\r\n disabled?: boolean;\r\n theme: KeyboardToolbarTheme;\r\n};\r\n\r\nconst ArrowComponent: React.FC<ArrowProps> = ({ type, disabled, theme }) => {\r\n const colorScheme = useColorScheme();\r\n\r\n const color = useMemo(\r\n () => ({\r\n backgroundColor: disabled\r\n ? theme[colorScheme].disabled\r\n : theme[colorScheme].primary,\r\n }),\r\n [disabled, theme, colorScheme],\r\n );\r\n const left = useMemo(() => [styles.arrowLeftLine, color], [color]);\r\n const right = useMemo(() => [styles.arrowRightLine, color], [color]);\r\n\r\n return (\r\n <View\r\n style={\r\n type === \"next\" ? styles.arrowDownContainer : styles.arrowUpContainer\r\n }\r\n >\r\n <View style={styles.arrow}>\r\n <Animated.View style={left} />\r\n <Animated.View style={right} />\r\n </View>\r\n </View>\r\n );\r\n};\r\n\r\nconst arrowLine: ViewStyle = {\r\n width: 13,\r\n height: 2,\r\n borderRadius: 1,\r\n};\r\nconst arrowUpContainer: ViewStyle = {\r\n marginHorizontal: 5,\r\n width: 30,\r\n height: 30,\r\n justifyContent: \"center\",\r\n alignItems: \"center\",\r\n};\r\nconst styles = StyleSheet.create({\r\n arrowUpContainer: arrowUpContainer,\r\n arrowDownContainer: {\r\n ...arrowUpContainer,\r\n transform: [{ rotate: \"180deg\" }],\r\n },\r\n arrow: {\r\n width: 20,\r\n height: 20,\r\n flexDirection: \"row\",\r\n alignItems: \"center\",\r\n justifyContent: \"space-between\",\r\n },\r\n arrowLeftLine: {\r\n ...arrowLine,\r\n transform: [{ rotate: \"-45deg\" }],\r\n left: -0.5,\r\n },\r\n arrowRightLine: {\r\n ...arrowLine,\r\n transform: [{ rotate: \"45deg\" }],\r\n left: -5.5,\r\n },\r\n});\r\n\r\nexport default ArrowComponent;\r\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SAASC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAEzD,OAAOC,cAAc,MAAM,yBAAyB;AAWpD,MAAMC,cAAoC,GAAGA,CAAC;EAAEC,IAAI;EAAEC,QAAQ;EAAEC;AAAM,CAAC,KAAK;EAC1E,MAAMC,WAAW,GAAGL,cAAc,CAAC,CAAC;EAEpC,MAAMM,KAAK,GAAGV,OAAO,CACnB,OAAO;IACLW,eAAe,EAAEJ,QAAQ,GACrBC,KAAK,CAACC,WAAW,CAAC,CAACF,QAAQ,GAC3BC,KAAK,CAACC,WAAW,CAAC,CAACG;EACzB,CAAC,CAAC,EACF,CAACL,QAAQ,EAAEC,KAAK,EAAEC,WAAW,CAC/B,CAAC;EACD,MAAMI,IAAI,GAAGb,OAAO,CAAC,MAAM,CAACc,MAAM,CAACC,aAAa,EAAEL,KAAK,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;EAClE,MAAMM,KAAK,GAAGhB,OAAO,CAAC,MAAM,CAACc,MAAM,CAACG,cAAc,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EACDI,cAAc,EAAE;IACd,GAAGM,SAAS;IACZQ,SAAS,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAQ,CAAC,CAAC;IAChCnB,IAAI,EAAE,CAAC;EACT;AACF,CAAC,CAAC;AAEF,eAAeR,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { Platform, TouchableNativeFeedback, TouchableOpacity, View } from "react-native";
|
|
3
|
+
import useColorScheme from "../hooks/useColorScheme";
|
|
4
|
+
const ButtonIOS = ({
|
|
5
|
+
children,
|
|
6
|
+
onPress,
|
|
7
|
+
disabled,
|
|
8
|
+
accessibilityLabel,
|
|
9
|
+
accessibilityHint,
|
|
10
|
+
testID,
|
|
11
|
+
style
|
|
12
|
+
}) => {
|
|
13
|
+
// immediately switch to plain view to avoid animation flickering
|
|
14
|
+
// when fade out animation happens and view becomes disabled
|
|
15
|
+
const Container = disabled ? View : TouchableOpacity;
|
|
16
|
+
const accessibilityState = useMemo(() => ({
|
|
17
|
+
disabled
|
|
18
|
+
}), [disabled]);
|
|
19
|
+
return /*#__PURE__*/React.createElement(Container, {
|
|
20
|
+
accessibilityState: accessibilityState,
|
|
21
|
+
accessibilityRole: "button",
|
|
22
|
+
accessibilityLabel: accessibilityLabel,
|
|
23
|
+
accessibilityHint: accessibilityHint,
|
|
24
|
+
onPress: onPress,
|
|
25
|
+
style: style,
|
|
26
|
+
testID: testID
|
|
27
|
+
}, children);
|
|
28
|
+
};
|
|
29
|
+
const ButtonAndroid = ({
|
|
30
|
+
children,
|
|
31
|
+
onPress,
|
|
32
|
+
disabled,
|
|
33
|
+
accessibilityLabel,
|
|
34
|
+
accessibilityHint,
|
|
35
|
+
testID,
|
|
36
|
+
rippleRadius = 18,
|
|
37
|
+
style,
|
|
38
|
+
theme
|
|
39
|
+
}) => {
|
|
40
|
+
const colorScheme = useColorScheme();
|
|
41
|
+
const accessibilityState = useMemo(() => ({
|
|
42
|
+
disabled
|
|
43
|
+
}), [disabled]);
|
|
44
|
+
const ripple = useMemo(() => TouchableNativeFeedback.Ripple(theme[colorScheme].ripple, true, rippleRadius), [colorScheme, rippleRadius, theme]);
|
|
45
|
+
return /*#__PURE__*/React.createElement(TouchableNativeFeedback, {
|
|
46
|
+
accessibilityState: accessibilityState,
|
|
47
|
+
accessibilityRole: "button",
|
|
48
|
+
accessibilityLabel: accessibilityLabel,
|
|
49
|
+
accessibilityHint: accessibilityHint,
|
|
50
|
+
onPress: onPress,
|
|
51
|
+
background: ripple,
|
|
52
|
+
testID: testID,
|
|
53
|
+
style: style
|
|
54
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
55
|
+
style: style
|
|
56
|
+
}, children));
|
|
57
|
+
};
|
|
58
|
+
export default Platform.select({
|
|
59
|
+
android: ButtonAndroid,
|
|
60
|
+
default: ButtonIOS
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useMemo","Platform","TouchableNativeFeedback","TouchableOpacity","View","useColorScheme","ButtonIOS","children","onPress","disabled","accessibilityLabel","accessibilityHint","testID","style","Container","accessibilityState","createElement","accessibilityRole","ButtonAndroid","rippleRadius","theme","colorScheme","ripple","Ripple","background","select","android","default"],"sources":["Button.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\r\nimport {\r\n Platform,\r\n TouchableNativeFeedback,\r\n TouchableOpacity,\r\n View,\r\n} from \"react-native\";\r\n\r\nimport useColorScheme from \"../hooks/useColorScheme\";\r\n\r\nimport type { KeyboardToolbarTheme } from \"./types\";\r\nimport type { PropsWithChildren } from \"react\";\r\nimport type { ViewStyle } from \"react-native\";\r\n\r\ntype ButtonProps = {\r\n disabled?: boolean;\r\n onPress: () => void;\r\n accessibilityLabel: string;\r\n accessibilityHint: string;\r\n testID: string;\r\n rippleRadius?: number;\r\n style?: ViewStyle;\r\n theme: KeyboardToolbarTheme;\r\n};\r\n\r\nconst ButtonIOS = ({\r\n children,\r\n onPress,\r\n disabled,\r\n accessibilityLabel,\r\n accessibilityHint,\r\n testID,\r\n style,\r\n}: PropsWithChildren<ButtonProps>) => {\r\n // immediately switch to plain view to avoid animation flickering\r\n // when fade out animation happens and view becomes disabled\r\n const Container = disabled\r\n ? (View as unknown as typeof TouchableOpacity)\r\n : TouchableOpacity;\r\n const accessibilityState = useMemo(() => ({ disabled }), [disabled]);\r\n\r\n return (\r\n <Container\r\n accessibilityState={accessibilityState}\r\n accessibilityRole=\"button\"\r\n accessibilityLabel={accessibilityLabel}\r\n accessibilityHint={accessibilityHint}\r\n onPress={onPress}\r\n style={style}\r\n testID={testID}\r\n >\r\n {children}\r\n </Container>\r\n );\r\n};\r\nconst ButtonAndroid = ({\r\n children,\r\n onPress,\r\n disabled,\r\n accessibilityLabel,\r\n accessibilityHint,\r\n testID,\r\n rippleRadius = 18,\r\n style,\r\n theme,\r\n}: PropsWithChildren<ButtonProps>) => {\r\n const colorScheme = useColorScheme();\r\n const accessibilityState = useMemo(() => ({ disabled }), [disabled]);\r\n const ripple = useMemo(\r\n () =>\r\n TouchableNativeFeedback.Ripple(\r\n theme[colorScheme].ripple,\r\n true,\r\n rippleRadius,\r\n ),\r\n [colorScheme, rippleRadius, theme],\r\n );\r\n\r\n return (\r\n <TouchableNativeFeedback\r\n accessibilityState={accessibilityState}\r\n accessibilityRole=\"button\"\r\n accessibilityLabel={accessibilityLabel}\r\n accessibilityHint={accessibilityHint}\r\n onPress={onPress}\r\n background={ripple}\r\n testID={testID}\r\n style={style}\r\n >\r\n <View style={style}>{children}</View>\r\n </TouchableNativeFeedback>\r\n );\r\n};\r\n\r\nexport default Platform.select({\r\n android: ButtonAndroid,\r\n default: ButtonIOS,\r\n});\r\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SACEC,QAAQ,EACRC,uBAAuB,EACvBC,gBAAgB,EAChBC,IAAI,QACC,cAAc;AAErB,OAA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AiB,EAAC,QAAQ;IAC1BP,kBAAkB,EAAEA,kBAAmB;IACvCC,iBAAiB,EAAEA,iBAAkB;IACrCH,OAAO,EAAEA,OAAQ;IACjBgB,UAAU,EAAEF,MAAO;IACnBV,MAAM,EAAEA,MAAO;IACfC,KAAK,EAAEA;EAAM,gBAEbd,KAAA,CAAAiB,aAAA,CAACZ,IAAI;IAACS,KAAK,EAAEA;EAAM,GAAEN,QAAe,CACb,CAAC;AAE9B,CAAC;AAED,eAAeN,QAAQ,CAACwB,MAAM,CAAC;EAC7BC,OAAO,EAAER,aAAa;EACtBS,OAAO,EAAErB;AACX,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const colors = {
|
|
2
|
+
light: {
|
|
3
|
+
primary: "#2c2c2c",
|
|
4
|
+
disabled: "#B0BEC5",
|
|
5
|
+
background: "#f3f3f4",
|
|
6
|
+
ripple: "#bcbcbcbc"
|
|
7
|
+
},
|
|
8
|
+
dark: {
|
|
9
|
+
primary: "#fafafa",
|
|
10
|
+
disabled: "#707070",
|
|
11
|
+
background: "#2C2C2E",
|
|
12
|
+
ripple: "#F8F8F888"
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=colors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["colors","light","primary","disabled","background","ripple","dark"],"sources":["colors.ts"],"sourcesContent":["import type { KeyboardToolbarTheme } from \"./types\";\r\n\r\nexport const colors: KeyboardToolbarTheme = {\r\n light: {\r\n primary: \"#2c2c2c\",\r\n disabled: \"#B0BEC5\",\r\n background: \"#f3f3f4\",\r\n ripple: \"#bcbcbcbc\",\r\n },\r\n dark: {\r\n primary: \"#fafafa\",\r\n disabled: \"#707070\",\r\n background: \"#2C2C2E\",\r\n ripple: \"#F8F8F888\",\r\n },\r\n};\r\n"],"mappings":"AAEA,OAAO,MAAMA,MAA4B,GAAG;EAC1CC,KAAK,EAAE;IACLC,OAAO,EAAE,SAAS;IAClBC,QAAQ,EAAE,SAAS;IACnBC,UAAU,EAAE,SAAS;IACrBC,MAAM,EAAE;EACV,CAAC;EACDC,IAAI,EAAE;IACJJ,OAAO,EAAE,SAAS;IAClBC,QAAQ,EAAE,SAAS;IACnBC,UAAU,EAAE,SAAS;IACrBC,MAAM,EAAE;EACV;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Platform, PlatformColor } from "react-native";
|
|
2
|
+
export const colors = {
|
|
3
|
+
light: {
|
|
4
|
+
primary: Platform.select({
|
|
5
|
+
ios: PlatformColor("link"),
|
|
6
|
+
default: "#2c2c2c"
|
|
7
|
+
}),
|
|
8
|
+
disabled: Platform.select({
|
|
9
|
+
ios: PlatformColor("systemGray4"),
|
|
10
|
+
default: "#B0BEC5"
|
|
11
|
+
}),
|
|
12
|
+
background: Platform.select({
|
|
13
|
+
ios: "#F8F8F8",
|
|
14
|
+
default: "#f3f3f4"
|
|
15
|
+
}),
|
|
16
|
+
ripple: "#bcbcbcbc"
|
|
17
|
+
},
|
|
18
|
+
dark: {
|
|
19
|
+
primary: Platform.select({
|
|
20
|
+
ios: PlatformColor("label"),
|
|
21
|
+
default: "#fafafa"
|
|
22
|
+
}),
|
|
23
|
+
disabled: Platform.select({
|
|
24
|
+
ios: PlatformColor("systemGray"),
|
|
25
|
+
default: "#707070"
|
|
26
|
+
}),
|
|
27
|
+
background: Platform.select({
|
|
28
|
+
ios: "#555756",
|
|
29
|
+
default: "#2C2C2E"
|
|
30
|
+
}),
|
|
31
|
+
ripple: "#F8F8F888"
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=colors.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","PlatformColor","colors","light","primary","select","ios","default","disabled","background","ripple","dark"],"sources":["colors.native.ts"],"sourcesContent":["import { Platform, PlatformColor } from \"react-native\";\r\n\r\nimport type { KeyboardToolbarTheme } from \"./types\";\r\nimport type { ColorValue } from \"react-native\";\r\n\r\nexport const colors: KeyboardToolbarTheme = {\r\n light: {\r\n primary: Platform.select<ColorValue>({\r\n ios: PlatformColor(\"link\"),\r\n default: \"#2c2c2c\",\r\n }),\r\n disabled: Platform.select<ColorValue>({\r\n ios: PlatformColor(\"systemGray4\"),\r\n default: \"#B0BEC5\",\r\n }),\r\n background: Platform.select({\r\n ios: \"#F8F8F8\",\r\n default: \"#f3f3f4\",\r\n }),\r\n ripple: \"#bcbcbcbc\",\r\n },\r\n dark: {\r\n primary: Platform.select<ColorValue>({\r\n ios: PlatformColor(\"label\"),\r\n default: \"#fafafa\",\r\n }),\r\n disabled: Platform.select<ColorValue>({\r\n ios: PlatformColor(\"systemGray\"),\r\n default: \"#707070\",\r\n }),\r\n background: Platform.select({\r\n ios: \"#555756\",\r\n default: \"#2C2C2E\",\r\n }),\r\n ripple: \"#F8F8F888\",\r\n },\r\n};\r\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,aAAa,QAAQ,cAAc;AAKtD,OAAO,MAAMC,MAA4B,GAAG;EAC1CC,KAAK,EAAE;IACLC,OAAO,EAAEJ,QAAQ,CAACK,MAAM,CAAa;MACnCC,GAAG,EAAEL,aAAa,CAAC,MAAM,CAAC;MAC1BM,OAAO,EAAE;IACX,CAAC,CAAC;IACFC,QAAQ,EAAER,QAAQ,CAACK,MAAM,CAAa;MACpCC,GAAG,EAAEL,aAAa,CAAC,aAAa,CAAC;MACjCM,OAAO,EAAE;IACX,CAAC,CAAC;IACFE,UAAU,EAAET,QAAQ,CAACK,MAAM,CAAC;MAC1BC,GAAG,EAAE,SAAS;MACdC,OAAO,EAAE;IACX,CAAC,CAAC;IACFG,MAAM,EAAE;EACV,CAAC;EACDC,IAAI,EAAE;IACJP,OAAO,EAAEJ,QAAQ,CAACK,MAAM,CAAa;MACnCC,GAAG,EAAEL,aAAa,CAAC,OAAO,CAAC;MAC3BM,OAAO,EAAE;IACX,CAAC,CAAC;IACFC,QAAQ,EAAER,QAAQ,CAACK,MAAM,CAAa;MACpCC,GAAG,EAAEL,aAAa,CAAC,YAAY,CAAC;MAChCM,OAAO,EAAE;IACX,CAAC,CAAC;IACFE,UAAU,EAAET,QAAQ,CAACK,MAAM,CAAC;MAC1BC,GAAG,EAAE,SAAS;MACdC,OAAO,EAAE;IACX,CAAC,CAAC;IACFG,MAAM,EAAE;EACV;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { StyleSheet, Text, View } from "react-native";
|
|
3
|
+
import { FocusedInputEvents } from "../../bindings";
|
|
4
|
+
import KeyboardStickyView from "../KeyboardStickyView";
|
|
5
|
+
import { KeyboardController } from "../../bindings";
|
|
6
|
+
import useColorScheme from "../hooks/useColorScheme";
|
|
7
|
+
import Arrow from "./Arrow";
|
|
8
|
+
import Button from "./Button";
|
|
9
|
+
import { colors } from "./colors";
|
|
10
|
+
const TEST_ID_KEYBOARD_TOOLBAR = "keyboard.toolbar";
|
|
11
|
+
const TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;
|
|
12
|
+
const TEST_ID_KEYBOARD_TOOLBAR_NEXT = `${TEST_ID_KEYBOARD_TOOLBAR}.next`;
|
|
13
|
+
const TEST_ID_KEYBOARD_TOOLBAR_CONTENT = `${TEST_ID_KEYBOARD_TOOLBAR}.content`;
|
|
14
|
+
const TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;
|
|
15
|
+
const KEYBOARD_TOOLBAR_HEIGHT = 42;
|
|
16
|
+
const DEFAULT_OPACITY = "FF";
|
|
17
|
+
const offset = {
|
|
18
|
+
closed: KEYBOARD_TOOLBAR_HEIGHT
|
|
19
|
+
};
|
|
20
|
+
const dismissKeyboard = () => KeyboardController.dismiss();
|
|
21
|
+
const goToNextField = () => KeyboardController.setFocusTo("next");
|
|
22
|
+
const goToPrevField = () => KeyboardController.setFocusTo("prev");
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` and
|
|
26
|
+
* `Done` buttons.
|
|
27
|
+
*/
|
|
28
|
+
const KeyboardToolbar = ({
|
|
29
|
+
content,
|
|
30
|
+
theme = colors,
|
|
31
|
+
doneText,
|
|
32
|
+
button,
|
|
33
|
+
icon,
|
|
34
|
+
showArrows = true,
|
|
35
|
+
onNextCallback,
|
|
36
|
+
onPrevCallback,
|
|
37
|
+
onDoneCallback,
|
|
38
|
+
blur = null,
|
|
39
|
+
opacity = DEFAULT_OPACITY
|
|
40
|
+
}) => {
|
|
41
|
+
const colorScheme = useColorScheme();
|
|
42
|
+
const [inputs, setInputs] = useState({
|
|
43
|
+
current: 0,
|
|
44
|
+
count: 0
|
|
45
|
+
});
|
|
46
|
+
const isPrevDisabled = inputs.current === 0;
|
|
47
|
+
const isNextDisabled = inputs.current === inputs.count - 1;
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
const subscription = FocusedInputEvents.addListener("focusDidSet", e => {
|
|
50
|
+
setInputs(e);
|
|
51
|
+
});
|
|
52
|
+
return subscription.remove;
|
|
53
|
+
}, []);
|
|
54
|
+
const doneStyle = useMemo(() => [styles.doneButton, {
|
|
55
|
+
color: theme[colorScheme].primary
|
|
56
|
+
}], [colorScheme, theme]);
|
|
57
|
+
const toolbarStyle = useMemo(() => [styles.toolbar, {
|
|
58
|
+
backgroundColor: `${theme[colorScheme].background}${opacity}`
|
|
59
|
+
}], [colorScheme, opacity, theme]);
|
|
60
|
+
const ButtonContainer = button || Button;
|
|
61
|
+
const IconContainer = icon || Arrow;
|
|
62
|
+
const onPressNext = useCallback(() => {
|
|
63
|
+
goToNextField();
|
|
64
|
+
onNextCallback === null || onNextCallback === void 0 || onNextCallback();
|
|
65
|
+
}, [onNextCallback]);
|
|
66
|
+
const onPressPrev = useCallback(() => {
|
|
67
|
+
goToPrevField();
|
|
68
|
+
onPrevCallback === null || onPrevCallback === void 0 || onPrevCallback();
|
|
69
|
+
}, [onPrevCallback]);
|
|
70
|
+
const onPressDone = useCallback(() => {
|
|
71
|
+
dismissKeyboard();
|
|
72
|
+
onDoneCallback === null || onDoneCallback === void 0 || onDoneCallback();
|
|
73
|
+
}, [onDoneCallback]);
|
|
74
|
+
return /*#__PURE__*/React.createElement(KeyboardStickyView, {
|
|
75
|
+
offset: offset
|
|
76
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
77
|
+
style: toolbarStyle,
|
|
78
|
+
testID: TEST_ID_KEYBOARD_TOOLBAR
|
|
79
|
+
}, blur, showArrows && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ButtonContainer, {
|
|
80
|
+
accessibilityLabel: "Previous",
|
|
81
|
+
accessibilityHint: "Will move focus to previous field",
|
|
82
|
+
disabled: isPrevDisabled,
|
|
83
|
+
onPress: onPressPrev,
|
|
84
|
+
testID: TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS,
|
|
85
|
+
theme: theme
|
|
86
|
+
}, /*#__PURE__*/React.createElement(IconContainer, {
|
|
87
|
+
disabled: isPrevDisabled,
|
|
88
|
+
type: "prev",
|
|
89
|
+
theme: theme
|
|
90
|
+
})), /*#__PURE__*/React.createElement(ButtonContainer, {
|
|
91
|
+
accessibilityLabel: "Next",
|
|
92
|
+
accessibilityHint: "Will move focus to next field",
|
|
93
|
+
disabled: isNextDisabled,
|
|
94
|
+
onPress: onPressNext,
|
|
95
|
+
testID: TEST_ID_KEYBOARD_TOOLBAR_NEXT,
|
|
96
|
+
theme: theme
|
|
97
|
+
}, /*#__PURE__*/React.createElement(IconContainer, {
|
|
98
|
+
disabled: isNextDisabled,
|
|
99
|
+
type: "next",
|
|
100
|
+
theme: theme
|
|
101
|
+
}))), /*#__PURE__*/React.createElement(View, {
|
|
102
|
+
style: styles.flex,
|
|
103
|
+
testID: TEST_ID_KEYBOARD_TOOLBAR_CONTENT
|
|
104
|
+
}, content), /*#__PURE__*/React.createElement(ButtonContainer, {
|
|
105
|
+
accessibilityLabel: "Done",
|
|
106
|
+
accessibilityHint: "Will close the keyboard",
|
|
107
|
+
onPress: onPressDone,
|
|
108
|
+
testID: TEST_ID_KEYBOARD_TOOLBAR_DONE,
|
|
109
|
+
rippleRadius: 28,
|
|
110
|
+
style: styles.doneButtonContainer,
|
|
111
|
+
theme: theme
|
|
112
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
113
|
+
style: doneStyle,
|
|
114
|
+
maxFontSizeMultiplier: 1.3
|
|
115
|
+
}, doneText || "Done"))));
|
|
116
|
+
};
|
|
117
|
+
const styles = StyleSheet.create({
|
|
118
|
+
flex: {
|
|
119
|
+
flex: 1
|
|
120
|
+
},
|
|
121
|
+
toolbar: {
|
|
122
|
+
position: "absolute",
|
|
123
|
+
bottom: 0,
|
|
124
|
+
alignItems: "center",
|
|
125
|
+
width: "100%",
|
|
126
|
+
flexDirection: "row",
|
|
127
|
+
height: KEYBOARD_TOOLBAR_HEIGHT,
|
|
128
|
+
paddingHorizontal: 8
|
|
129
|
+
},
|
|
130
|
+
doneButton: {
|
|
131
|
+
fontWeight: "600",
|
|
132
|
+
fontSize: 15
|
|
133
|
+
},
|
|
134
|
+
doneButtonContainer: {
|
|
135
|
+
marginRight: 8
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
export { colors as DefaultKeyboardToolbarTheme };
|
|
139
|
+
export default KeyboardToolbar;
|
|
140
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useCallback","useEffect","useMemo","useState","StyleSheet","Text","View","FocusedInputEvents","KeyboardStickyView","KeyboardController","useColorScheme","Arrow","Button","colors","TEST_ID_KEYBOARD_TOOLBAR","TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS","TEST_ID_KEYBOARD_TOOLBAR_NEXT","TEST_ID_KEYBOARD_TOOLBAR_CONTENT","TEST_ID_KEYBOARD_TOOLBAR_DONE","KEYBOARD_TOOLBAR_HEIGHT","DEFAULT_OPACITY","offset","closed","dismissKeyboard","dismiss","goToNextField","setFocusTo","goToPrevField","KeyboardToolbar","content","theme","doneText","button","icon","showArrows","onNextCallback","onPrevCallback","onDoneCallback","blur","opacity","colorScheme","inputs","setInputs","current","count","isPrevDisabled","isNextDisabled","subscription","addListener","e","remove","doneStyle","styles","doneButton","color","primary","toolbarStyle","toolbar","backgroundColor","background","ButtonContainer","IconContainer","onPressNext","onPressPrev","onPressDone","createElement","style","testID","Fragment","accessibilityLabel","accessibilityHint","disabled","onPress","type","flex","rippleRadius","doneButtonContainer","maxFontSizeMultiplier","create","position","bottom","alignItems","width","flexDirection","height","paddingHorizontal","fontWeight","fontSize","marginRight","DefaultKeyboardToolbarTheme"],"sources":["index.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from \"react\";\r\nimport { StyleSheet, Text, View } from \"react-native\";\r\n\r\nimport {\r\n FocusedInputEvents,\r\n} from \"../../bindings\";\r\nimport KeyboardStickyView from \"../KeyboardStickyView\"\r\nimport { KeyboardController } from \"../../bindings\";\r\nimport useColorScheme from \"../hooks/useColorScheme\";\r\n\r\nimport Arrow from \"./Arrow\";\r\nimport Button from \"./Button\";\r\nimport { colors } from \"./colors\";\r\n\r\nimport type { HEX, KeyboardToolbarTheme } from \"./types\";\r\nimport type { ReactNode } from \"react\";\r\n\r\nexport type KeyboardToolbarProps = {\r\n /** An element that is shown in the middle of the toolbar. */\r\n content?: JSX.Element | null;\r\n /** A set of dark/light colors consumed by toolbar component. */\r\n theme?: KeyboardToolbarTheme;\r\n /** Custom text for done button. */\r\n doneText?: ReactNode;\r\n /** Custom touchable component for toolbar (used for prev/next/done buttons). */\r\n button?: typeof Button;\r\n /** Custom icon component used to display next/prev buttons. */\r\n icon?: typeof Arrow;\r\n /**\r\n * Whether to show next and previous buttons. Can be useful to set it to `false` if you have only one input\r\n * and want to show only `Done` button. Default to `true`.\r\n */\r\n showArrows?: boolean;\r\n /**\r\n * A callback that is called when the user presses the next button along with the default action.\r\n */\r\n onNextCallback?: () => void;\r\n /**\r\n * A callback that is called when the user presses the previous button along with the default action.\r\n */\r\n onPrevCallback?: () => void;\r\n /**\r\n * A callback that is called when the user presses the done button along with the default action.\r\n */\r\n onDoneCallback?: () => void;\r\n /**\r\n * A component that applies blur effect to the toolbar.\r\n */\r\n blur?: JSX.Element | null;\r\n /**\r\n * A value for container opacity in hexadecimal format (e.g. `ff`). Default value is `ff`.\r\n */\r\n opacity?: HEX;\r\n};\r\nconst TEST_ID_KEYBOARD_TOOLBAR = \"keyboard.toolbar\";\r\nconst TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;\r\nconst TEST_ID_KEYBOARD_TOOLBAR_NEXT = `${TEST_ID_KEYBOARD_TOOLBAR}.next`;\r\nconst TEST_ID_KEYBOARD_TOOLBAR_CONTENT = `${TEST_ID_KEYBOARD_TOOLBAR}.content`;\r\nconst TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;\r\n\r\nconst KEYBOARD_TOOLBAR_HEIGHT = 42;\r\nconst DEFAULT_OPACITY: HEX = \"FF\";\r\nconst offset = { closed: KEYBOARD_TOOLBAR_HEIGHT };\r\n\r\nconst dismissKeyboard = () => KeyboardController.dismiss();\r\nconst goToNextField = () => KeyboardController.setFocusTo(\"next\");\r\nconst goToPrevField = () => KeyboardController.setFocusTo(\"prev\");\r\n\r\n/**\r\n * `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` and\r\n * `Done` buttons.\r\n */\r\nconst KeyboardToolbar: React.FC<KeyboardToolbarProps> = ({\r\n content,\r\n theme = colors,\r\n doneText,\r\n button,\r\n icon,\r\n showArrows = true,\r\n onNextCallback,\r\n onPrevCallback,\r\n onDoneCallback,\r\n blur = null,\r\n opacity = DEFAULT_OPACITY,\r\n}) => {\r\n const colorScheme = useColorScheme();\r\n const [inputs, setInputs] = useState({\r\n current: 0,\r\n count: 0,\r\n });\r\n const isPrevDisabled = inputs.current === 0;\r\n const isNextDisabled = inputs.current === inputs.count - 1;\r\n\r\n useEffect(() => {\r\n const subscription = FocusedInputEvents.addListener(\"focusDidSet\", (e) => {\r\n setInputs(e);\r\n });\r\n\r\n return subscription.remove;\r\n }, []);\r\n const doneStyle = useMemo(\r\n () => [styles.doneButton, { color: theme[colorScheme].primary }],\r\n [colorScheme, theme],\r\n );\r\n const toolbarStyle = useMemo(\r\n () => [\r\n styles.toolbar,\r\n {\r\n backgroundColor: `${theme[colorScheme].background}${opacity}`,\r\n },\r\n ],\r\n [colorScheme, opacity, theme],\r\n );\r\n const ButtonContainer = button || Button;\r\n const IconContainer = icon || Arrow;\r\n\r\n const onPressNext = useCallback(() => {\r\n goToNextField();\r\n onNextCallback?.();\r\n }, [onNextCallback]);\r\n const onPressPrev = useCallback(() => {\r\n goToPrevField();\r\n onPrevCallback?.();\r\n }, [onPrevCallback]);\r\n const onPressDone = useCallback(() => {\r\n dismissKeyboard();\r\n onDoneCallback?.();\r\n }, [onDoneCallback]);\r\n\r\n return (\r\n <KeyboardStickyView offset={offset}>\r\n <View style={toolbarStyle} testID={TEST_ID_KEYBOARD_TOOLBAR}>\r\n {blur}\r\n {showArrows && (\r\n <>\r\n <ButtonContainer\r\n accessibilityLabel=\"Previous\"\r\n accessibilityHint=\"Will move focus to previous field\"\r\n disabled={isPrevDisabled}\r\n onPress={onPressPrev}\r\n testID={TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS}\r\n theme={theme}\r\n >\r\n <IconContainer\r\n disabled={isPrevDisabled}\r\n type=\"prev\"\r\n theme={theme}\r\n />\r\n </ButtonContainer>\r\n <ButtonContainer\r\n accessibilityLabel=\"Next\"\r\n accessibilityHint=\"Will move focus to next field\"\r\n disabled={isNextDisabled}\r\n onPress={onPressNext}\r\n testID={TEST_ID_KEYBOARD_TOOLBAR_NEXT}\r\n theme={theme}\r\n >\r\n <IconContainer\r\n disabled={isNextDisabled}\r\n type=\"next\"\r\n theme={theme}\r\n />\r\n </ButtonContainer>\r\n </>\r\n )}\r\n\r\n <View style={styles.flex} testID={TEST_ID_KEYBOARD_TOOLBAR_CONTENT}>\r\n {content}\r\n </View>\r\n <ButtonContainer\r\n accessibilityLabel=\"Done\"\r\n accessibilityHint=\"Will close the keyboard\"\r\n onPress={onPressDone}\r\n testID={TEST_ID_KEYBOARD_TOOLBAR_DONE}\r\n rippleRadius={28}\r\n style={styles.doneButtonContainer}\r\n theme={theme}\r\n >\r\n <Text style={doneStyle} maxFontSizeMultiplier={1.3}>\r\n {doneText || \"Done\"}\r\n </Text>\r\n </ButtonContainer>\r\n </View>\r\n </KeyboardStickyView>\r\n );\r\n};\r\n\r\nconst styles = StyleSheet.create({\r\n flex: {\r\n flex: 1,\r\n },\r\n toolbar: {\r\n position: \"absolute\",\r\n bottom: 0,\r\n alignItems: \"center\",\r\n width: \"100%\",\r\n flexDirection: \"row\",\r\n height: KEYBOARD_TOOLBAR_HEIGHT,\r\n paddingHorizontal: 8,\r\n },\r\n doneButton: {\r\n fontWeight: \"600\",\r\n fontSize: 15,\r\n },\r\n doneButtonContainer: {\r\n marginRight: 8,\r\n },\r\n});\r\n\r\nexport { colors as DefaultKeyboardToolbarTheme };\r\nexport default KeyboardToolbar;\r\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACxE,SAASC,UAAU,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAErD,SACEC,kBAAkB,QACb,gBAAgB;AACvB,OAAOC,kBAAkB,MAAM,uBAAuB;AACtD,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,OAAOC,cAAc,MAAM,yBAAyB;AAEpD,OAAOC,KAAK,MAAM,SAAS;AAC3B,OAAOC,MAAM,M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yD,YAAY,EAAE,EAAG;IACjBT,KAAK,EAAEd,MAAM,CAACwB,mBAAoB;IAClC9C,KAAK,EAAEA;EAAM,gBAEb/B,KAAA,CAAAkE,aAAA,CAAC5D,IAAI;IAAC6D,KAAK,EAAEf,SAAU;IAAC0B,qBAAqB,EAAE;EAAI,GAChD9C,QAAQ,IAAI,MACT,CACS,CACb,CACY,CAAC;AAEzB,CAAC;AAED,MAAMqB,MAAM,GAAGhD,UAAU,CAAC0E,MAAM,CAAC;EAC/BJ,IAAI,EAAE;IACJA,IAAI,EAAE;EACR,CAAC;EACDjB,OAAO,EAAE;IACPsB,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,CAAC;IACTC,UAAU,EAAE,QAAQ;IACpBC,KAAK,EAAE,MAAM;IACbC,aAAa,EAAE,KAAK;IACpBC,MAAM,EAAEjE,uBAAuB;IAC/BkE,iBAAiB,EAAE;EACrB,CAAC;EACDhC,UAAU,EAAE;IACViC,UAAU,EAAE,KAAK;IACjBC,QAAQ,EAAE;EACZ,CAAC;EACDX,mBAAmB,EAAE;IACnBY,WAAW,EAAE;EACf;AACF,CAAC,CAAC;AAEF,SAAS3E,MAAM,IAAI4E,2BAA2B;AAC9C,eAAe7D,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ColorValue } from \"react-native\";\r\n\r\ntype Theme = {\r\n /** Color for arrow when it's enabled */\r\n primary: ColorValue;\r\n /** Color for arrow when it's disabled */\r\n disabled: ColorValue;\r\n /** Keyboard toolbar background color */\r\n background: string;\r\n /** Color for ripple effect (on button touch) on Android */\r\n ripple: ColorValue;\r\n};\r\nexport type KeyboardToolbarTheme = {\r\n light: Theme;\r\n dark: Theme;\r\n};\r\ntype HexSymbol =\r\n | \"0\"\r\n | \"1\"\r\n | \"2\"\r\n | \"3\"\r\n | \"4\"\r\n | \"5\"\r\n | \"6\"\r\n | \"7\"\r\n | \"8\"\r\n | \"9\"\r\n | \"A\"\r\n | \"B\"\r\n | \"C\"\r\n | \"D\"\r\n | \"E\"\r\n | \"F\"\r\n | \"a\"\r\n | \"b\"\r\n | \"c\"\r\n | \"d\"\r\n | \"e\"\r\n | \"f\";\r\nexport type HEX = `${HexSymbol}${HexSymbol}`;\r\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useColorScheme","useColorSchemeRN"],"sources":["useColorScheme.ts"],"sourcesContent":["import { useColorScheme as useColorSchemeRN } from \"react-native\";\r\n\r\nconst useColorScheme = () => useColorSchemeRN() || \"light\";\r\n\r\nexport default useColorScheme;\r\n"],"mappings":"AAAA,SAASA,cAAc,IAAIC,gBAAgB,QAAQ,cAAc;AAEjE,MAAMD,cAAc,GAAGA,CAAA,KAAMC,gBAAgB,CAAC,CAAC,IAAI,OAAO;AAE1D,eAAeD,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as KeyboardAvoidingView } from "./KeyboardAvoidingView";
|
|
2
|
+
export { default as KeyboardStickyView } from "./KeyboardStickyView";
|
|
3
|
+
export { default as KeyboardAwareScrollView } from "./KeyboardAwareScrollView";
|
|
4
|
+
export { default as KeyboardToolbar, DefaultKeyboardToolbarTheme } from "./KeyboardToolbar";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["default","KeyboardAvoidingView","KeyboardStickyView","KeyboardAwareScrollView","KeyboardToolbar","DefaultKeyboardToolbarTheme"],"sources":["index.ts"],"sourcesContent":["export { default as KeyboardAvoidingView } from \"./KeyboardAvoidingView\";\r\nexport { default as KeyboardStickyView } from \"./KeyboardStickyView\";\r\nexport { default as KeyboardAwareScrollView } from \"./KeyboardAwareScrollView\";\r\nexport {\r\n default as KeyboardToolbar,\r\n DefaultKeyboardToolbarTheme,\r\n} from \"./KeyboardToolbar\";\r\nexport type { KeyboardAvoidingViewProps } from \"./KeyboardAvoidingView\";\r\nexport type { KeyboardStickyViewProps } from \"./KeyboardStickyView\";\r\nexport type { KeyboardAwareScrollViewProps } from \"./KeyboardAwareScrollView\";\r\nexport type { KeyboardToolbarProps } from \"./KeyboardToolbar\";\r\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,oBAAoB,QAAQ,wBAAwB;AACxE,SAASD,OAAO,IAAIE,kBAAkB,QAAQ,sBAAsB;AACpE,SAASF,OAAO,IAAIG,uBAAuB,QAAQ,2BAA2B;AAC9E,SACEH,OAAO,IAAII,eAAe,EAC1BC,2BAA2B,QACtB,mBAAmB","ignoreList":[]}
|