@react-native-ohos/react-native-keyboard-controller 1.12.8-beta.9
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 +30 -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-lock.json5 +19 -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 +111 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentDescriptor.h +98 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +274 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.h +101 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewJSIBinder.h +64 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentDescriptor.h +85 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +110 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.h +84 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaJSIBinder.h +60 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.cpp +46 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.h +48 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.cpp +64 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.h +77 -0
- package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.cpp +45 -0
- package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.h +49 -0
- package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.cpp +186 -0
- package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.h +112 -0
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.cpp +64 -0
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.h +77 -0
- package/harmony/keyboard_controller/src/main/ets/Logger.ts +67 -0
- package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerPackage.ets +70 -0
- package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerTurboModule.ts +245 -0
- package/harmony/keyboard_controller/src/main/ets/RNStatusBarManagerCompatTurboModule.ts +119 -0
- package/harmony/keyboard_controller/src/main/ets/Type.ts +62 -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 +30 -0
- package/harmony/keyboard_controller.har +0 -0
- package/lib/commonjs/animated.js +188 -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 +27 -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 +180 -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 +21 -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 +178 -0
- package/react-native-keyboard-controller.podspec +61 -0
- package/src/animated.tsx +253 -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,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: -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CAACE,IAAI;IAACgB,KAAK,EAAEH;EAAM,CAAE,CAC1B,CACF,CAAC;AAEX,CAAC;AAED,MAAMO,SAAoB,GAAG;EAC3BC,KAAK,EAAE,EAAE;EACTC,MAAM,EAAE,CAAC;EACTC,YAAY,EAAE;AAChB,CAAC;AACD,MAAML,gBAA2B,GAAG;EAClCM,gBAAgB,EAAE,CAAC;EACnBH,KAAK,EAAE,EAAE;EACTC,MAAM,EAAE,EAAE;EACVG,cAAc,EAAE,QAAQ;EACxBC,UAAU,EAAE;AACd,CAAC;AACD,MAAMf,MAAM,GAAGZ,UAAU,CAAC4B,MAAM,CAAC;EAC/BT,gBAAgB,EAAEA,gBAAgB;EAClCD,kBAAkB,EAAE;IAClB,GAAGC,gBAAgB;IACnBU,SAAS,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAS,CAAC;EAClC,CAAC;EACDV,KAAK,EAAE;IACLE,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,EAAE;IACVQ,aAAa,EAAE,KAAK;IACpBJ,UAAU,EAAE,QAAQ;IACpBD,cAAc,EAAE;EAClB,CAAC;EACDb,aAAa,EAAE;IACb,GAAGQ,SAAS;IACZQ,SAAS,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAS,CAAC,CAAC;IACjCnB,IAAI,EAAE,CAAC;EACT,CAAC;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,OAAOC,cAAc,MAAM,yBAAyB;AAiBpD,MAAMC,SAAS,GAAGA,CAAC;EACjBC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,kBAAkB;EAClBC,iBAAiB;EACjBC,MAAM;EACNC;AAC8B,CAAC,KAAK;EACpC;EACA;EACA,MAAMC,SAAS,GAAGL,QAAQ,GACrBL,IAAI,GACLD,gBAAgB;EACpB,MAAMY,kBAAkB,GAAGf,OAAO,CAAC,OAAO;IAAES;EAAS,CAAC,CAAC,EAAE,CAACA,QAAQ,CAAC,CAAC;EAEpE,oBACEV,KAAA,CAAAiB,aAAA,CAACF,SAAS;IACRC,kBAAkB,EAAEA,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
|
@@ -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,MAAM,UAAU;AAC7B,SAASC,MAAM,QAAQ,UAAU;AA0CjC,MAAMC,wBAAwB,GAAG,kBAAkB;AACnD,MAAMC,iCAAiC,GAAG,GAAGD,wBAAwB,WAAW;AAChF,MAAME,6BAA6B,GAAG,GAAGF,wBAAwB,OAAO;AACxE,MAAMG,gCAAgC,GAAG,GAAGH,wBAAwB,UAAU;AAC9E,MAAMI,6BAA6B,GAAG,GAAGJ,wBAAwB,OAAO;AAExE,MAAMK,uBAAuB,GAAG,EAAE;AAClC,MAAMC,eAAoB,GAAG,IAAI;AACjC,MAAMC,MAAM,GAAG;EAAEC,MAAM,EAAEH;AAAwB,CAAC;AAEl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,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":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// copied from `android.view.WindowManager.LayoutParams`
|
|
2
|
+
export let AndroidSoftInputModes = /*#__PURE__*/function (AndroidSoftInputModes) {
|
|
3
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_ADJUST_NOTHING"] = 48] = "SOFT_INPUT_ADJUST_NOTHING";
|
|
4
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_ADJUST_PAN"] = 32] = "SOFT_INPUT_ADJUST_PAN";
|
|
5
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_ADJUST_RESIZE"] = 16] = "SOFT_INPUT_ADJUST_RESIZE";
|
|
6
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_ADJUST_UNSPECIFIED"] = 0] = "SOFT_INPUT_ADJUST_UNSPECIFIED";
|
|
7
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_IS_FORWARD_NAVIGATION"] = 256] = "SOFT_INPUT_IS_FORWARD_NAVIGATION";
|
|
8
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_MASK_ADJUST"] = 240] = "SOFT_INPUT_MASK_ADJUST";
|
|
9
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_MASK_STATE"] = 15] = "SOFT_INPUT_MASK_STATE";
|
|
10
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_MODE_CHANGED"] = 512] = "SOFT_INPUT_MODE_CHANGED";
|
|
11
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_ALWAYS_HIDDEN"] = 3] = "SOFT_INPUT_STATE_ALWAYS_HIDDEN";
|
|
12
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_ALWAYS_VISIBLE"] = 5] = "SOFT_INPUT_STATE_ALWAYS_VISIBLE";
|
|
13
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_HIDDEN"] = 2] = "SOFT_INPUT_STATE_HIDDEN";
|
|
14
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_UNCHANGED"] = 1] = "SOFT_INPUT_STATE_UNCHANGED";
|
|
15
|
+
// temporarily disable this rule to avoid breaking changes.
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
17
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_UNSPECIFIED"] = 0] = "SOFT_INPUT_STATE_UNSPECIFIED";
|
|
18
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_VISIBLE"] = 4] = "SOFT_INPUT_STATE_VISIBLE";
|
|
19
|
+
return AndroidSoftInputModes;
|
|
20
|
+
}({});
|
|
21
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AndroidSoftInputModes"],"sources":["constants.ts"],"sourcesContent":["// copied from `android.view.WindowManager.LayoutParams`\r\nexport enum AndroidSoftInputModes {\r\n SOFT_INPUT_ADJUST_NOTHING = 48,\r\n SOFT_INPUT_ADJUST_PAN = 32,\r\n SOFT_INPUT_ADJUST_RESIZE = 16,\r\n SOFT_INPUT_ADJUST_UNSPECIFIED = 0,\r\n SOFT_INPUT_IS_FORWARD_NAVIGATION = 256,\r\n SOFT_INPUT_MASK_ADJUST = 240,\r\n SOFT_INPUT_MASK_STATE = 15,\r\n SOFT_INPUT_MODE_CHANGED = 512,\r\n SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3,\r\n SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5,\r\n SOFT_INPUT_STATE_HIDDEN = 2,\r\n SOFT_INPUT_STATE_UNCHANGED = 1,\r\n // temporarily disable this rule to avoid breaking changes.\r\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\r\n SOFT_INPUT_STATE_UNSPECIFIED = 0,\r\n SOFT_INPUT_STATE_VISIBLE = 4,\r\n}\r\n"],"mappings":"AAAA;AACA,WAAYA,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAa/B;EACA;EAdUA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import { Animated } from "react-native";
|
|
3
|
+
const NOOP = () => {};
|
|
4
|
+
const withSharedValue = value => ({
|
|
5
|
+
value,
|
|
6
|
+
addListener: NOOP,
|
|
7
|
+
removeListener: NOOP,
|
|
8
|
+
modify: NOOP
|
|
9
|
+
});
|
|
10
|
+
const DEFAULT_SHARED_VALUE = withSharedValue(0);
|
|
11
|
+
const DEFAULT_LAYOUT = withSharedValue(null);
|
|
12
|
+
const defaultContext = {
|
|
13
|
+
enabled: true,
|
|
14
|
+
animated: {
|
|
15
|
+
progress: new Animated.Value(0),
|
|
16
|
+
height: new Animated.Value(0)
|
|
17
|
+
},
|
|
18
|
+
reanimated: {
|
|
19
|
+
progress: DEFAULT_SHARED_VALUE,
|
|
20
|
+
height: DEFAULT_SHARED_VALUE
|
|
21
|
+
},
|
|
22
|
+
layout: DEFAULT_LAYOUT,
|
|
23
|
+
setKeyboardHandlers: NOOP,
|
|
24
|
+
setInputHandlers: NOOP,
|
|
25
|
+
setEnabled: NOOP
|
|
26
|
+
};
|
|
27
|
+
export const KeyboardContext = /*#__PURE__*/createContext(defaultContext);
|
|
28
|
+
export const useKeyboardContext = () => {
|
|
29
|
+
const context = useContext(KeyboardContext);
|
|
30
|
+
if (__DEV__ && context === defaultContext) {
|
|
31
|
+
console.warn("Couldn't find real values for `KeyboardContext`. Please make sure you're inside of `KeyboardProvider` - otherwise functionality of `react-native-keyboard-controller` will not work.");
|
|
32
|
+
}
|
|
33
|
+
return context;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","useContext","Animated","NOOP","withSharedValue","value","addListener","removeListener","modify","DEFAULT_SHARED_VALUE","DEFAULT_LAYOUT","defaultContext","enabled","animated","progress","Value","height","reanimated","layout","setKeyboardHandlers","setInputHandlers","setEnabled","KeyboardContext","useKeyboardContext","context","__DEV__","console","warn"],"sources":["context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\r\nimport { Animated } from \"react-native\";\r\n\r\nimport type {\r\n FocusedInputHandlers,\r\n FocusedInputLayoutChangedEvent,\r\n KeyboardHandlers,\r\n} from \"./types\";\r\nimport type React from \"react\";\r\nimport type { SharedValue } from \"react-native-reanimated\";\r\n\r\nexport type AnimatedContext = {\r\n progress: Animated.Value;\r\n height: Animated.AnimatedMultiplication<number>;\r\n};\r\nexport type ReanimatedContext = {\r\n progress: SharedValue<number>;\r\n height: SharedValue<number>;\r\n};\r\nexport type KeyboardAnimationContext = {\r\n enabled: boolean;\r\n animated: AnimatedContext;\r\n reanimated: ReanimatedContext;\r\n layout: SharedValue<FocusedInputLayoutChangedEvent | null>;\r\n setKeyboardHandlers: (handlers: KeyboardHandlers) => void;\r\n setInputHandlers: (handlers: FocusedInputHandlers) => void;\r\n setEnabled: React.Dispatch<React.SetStateAction<boolean>>;\r\n};\r\nconst NOOP = () => {};\r\nconst withSharedValue = <T>(value: T): SharedValue<T> => ({\r\n value,\r\n addListener: NOOP,\r\n removeListener: NOOP,\r\n modify: NOOP,\r\n});\r\nconst DEFAULT_SHARED_VALUE = withSharedValue(0);\r\nconst DEFAULT_LAYOUT = withSharedValue<FocusedInputLayoutChangedEvent | null>(\r\n null,\r\n);\r\nconst defaultContext: KeyboardAnimationContext = {\r\n enabled: true,\r\n animated: {\r\n progress: new Animated.Value(0),\r\n height: new Animated.Value(0),\r\n },\r\n reanimated: {\r\n progress: DEFAULT_SHARED_VALUE,\r\n height: DEFAULT_SHARED_VALUE,\r\n },\r\n layout: DEFAULT_LAYOUT,\r\n setKeyboardHandlers: NOOP,\r\n setInputHandlers: NOOP,\r\n setEnabled: NOOP,\r\n};\r\nexport const KeyboardContext = createContext(defaultContext);\r\nexport const useKeyboardContext = () => {\r\n const context = useContext(KeyboardContext);\r\n if (__DEV__ && context === defaultContext) {\r\n console.warn(\r\n \"Couldn't find real values for `KeyboardContext`. Please make sure you're inside of `KeyboardProvider` - otherwise functionality of `react-native-keyboard-controller` will not work.\",\r\n );\r\n }\r\n\r\n return context;\r\n};\r\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AACjD,SAASC,QAAQ,QAAQ,cAAc;AA2BvC,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB,MAAMC,eAAe,GAAOC,KAAQ,KAAsB;EACxDA,KAAK;EACLC,WAAW,EAAEH,IAAI;EACjBI,cAAc,EAAEJ,IAAI;EACpBK,MAAM,EAAEL;AACV,CAAC,CAAC;AACF,MAAMM,oBAAoB,GAAGL,eAAe,CAAC,CAAC,CAAC;AAC/C,MAAMM,cAAc,GAAGN,eAAe,CACpC,IACF,CAAC;AACD,MAAMO,cAAwC,GAAG;EAC/CC,OAAO,EAAE,IAAI;EACbC,QAAQ,EAAE;IACRC,QAAQ,EAAE,IAAIZ,QAAQ,CAACa,KAAK,CAAC,CAAC,CAAC;IAC/BC,MAAM,EAAE,IAAId,QAAQ,CAACa,KAAK,CAAC,CAAC;EAC9B,CAAC;EACDE,UAAU,EAAE;IACVH,QAAQ,EAAEL,oBAAoB;IAC9BO,MAAM,EAAEP;EACV,CAAC;EACDS,MAAM,EAAER,cAAc;EACtBS,mBAAmB,EAAEhB,IAAI;EACzBiB,gBAAgB,EAAEjB,IAAI;EACtBkB,UAAU,EAAElB;AACd,CAAC;AACD,OAAO,MAAMmB,eAAe,gBAAGtB,aAAa,CAACW,cAAc,CAAC;AAC5D,OAAO,MAAMY,kBAAkB,GAAGA,CAAA,KAAM;EACtC,MAAMC,OAAO,GAAGvB,UAAU,CAACqB,eAAe,CAAC;EAC3C,IAAIG,OAAO,IAAID,OAAO,KAAKb,cAAc,EAAE;IACzCe,OAAO,CAACC,IAAI,CACV,sLACF,CAAC;EACH;EAEA,OAAOH,OAAO;AAChB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { KeyboardController } from "../bindings";
|
|
3
|
+
import { AndroidSoftInputModes } from "../constants";
|
|
4
|
+
import { useKeyboardContext } from "../context";
|
|
5
|
+
import { uuid } from "../utils";
|
|
6
|
+
export const useResizeMode = () => {
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
KeyboardController.setInputMode(AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE);
|
|
9
|
+
return () => KeyboardController.setDefaultMode();
|
|
10
|
+
}, []);
|
|
11
|
+
};
|
|
12
|
+
export const useKeyboardAnimation = () => {
|
|
13
|
+
useResizeMode();
|
|
14
|
+
const context = useKeyboardContext();
|
|
15
|
+
return context.animated;
|
|
16
|
+
};
|
|
17
|
+
export const useReanimatedKeyboardAnimation = () => {
|
|
18
|
+
useResizeMode();
|
|
19
|
+
const context = useKeyboardContext();
|
|
20
|
+
return context.reanimated;
|
|
21
|
+
};
|
|
22
|
+
export function useGenericKeyboardHandler(handler, deps) {
|
|
23
|
+
const context = useKeyboardContext();
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const key = uuid();
|
|
26
|
+
context.setKeyboardHandlers({
|
|
27
|
+
[key]: handler
|
|
28
|
+
});
|
|
29
|
+
return () => {
|
|
30
|
+
context.setKeyboardHandlers({
|
|
31
|
+
[key]: undefined
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
}, deps);
|
|
35
|
+
}
|
|
36
|
+
export function useKeyboardHandler(handler, deps) {
|
|
37
|
+
useResizeMode();
|
|
38
|
+
useGenericKeyboardHandler(handler, deps);
|
|
39
|
+
}
|
|
40
|
+
export function useKeyboardController() {
|
|
41
|
+
const context = useKeyboardContext();
|
|
42
|
+
return {
|
|
43
|
+
setEnabled: context.setEnabled,
|
|
44
|
+
enabled: context.enabled
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function useReanimatedFocusedInput() {
|
|
48
|
+
const context = useKeyboardContext();
|
|
49
|
+
return {
|
|
50
|
+
input: context.layout
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export function useFocusedInputHandler(handler, deps) {
|
|
54
|
+
const context = useKeyboardContext();
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
const key = uuid();
|
|
57
|
+
context.setInputHandlers({
|
|
58
|
+
[key]: handler
|
|
59
|
+
});
|
|
60
|
+
return () => {
|
|
61
|
+
context.setInputHandlers({
|
|
62
|
+
[key]: undefined
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
}, deps);
|
|
66
|
+
}
|
|
67
|
+
export * from "./useWindowDimensions";
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","KeyboardController","AndroidSoftInputModes","useKeyboardContext","uuid","useResizeMode","setInputMode","SOFT_INPUT_ADJUST_RESIZE","setDefaultMode","useKeyboardAnimation","context","animated","useReanimatedKeyboardAnimation","reanimated","useGenericKeyboardHandler","handler","deps","key","setKeyboardHandlers","undefined","useKeyboardHandler","useKeyboardController","setEnabled","enabled","useReanimatedFocusedInput","input","layout","useFocusedInputHandler","setInputHandlers"],"sources":["index.ts"],"sourcesContent":["import { useEffect } from \"react\";\r\n\r\nimport { KeyboardController } from \"../bindings\";\r\nimport { AndroidSoftInputModes } from \"../constants\";\r\nimport { useKeyboardContext } from \"../context\";\r\nimport { uuid } from \"../utils\";\r\n\r\nimport type { AnimatedContext, ReanimatedContext } from \"../context\";\r\nimport type { FocusedInputHandler, KeyboardHandler } from \"../types\";\r\nimport type { DependencyList } from \"react\";\r\n\r\nexport const useResizeMode = () => {\r\n useEffect(() => {\r\n KeyboardController.setInputMode(\r\n AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE,\r\n );\r\n\r\n return () => KeyboardController.setDefaultMode();\r\n }, []);\r\n};\r\n\r\nexport const useKeyboardAnimation = (): AnimatedContext => {\r\n useResizeMode();\r\n const context = useKeyboardContext();\r\n\r\n return context.animated;\r\n};\r\n\r\nexport const useReanimatedKeyboardAnimation = (): ReanimatedContext => {\r\n useResizeMode();\r\n const context = useKeyboardContext();\r\n\r\n return context.reanimated;\r\n};\r\n\r\nexport function useGenericKeyboardHandler(\r\n handler: KeyboardHandler,\r\n deps?: DependencyList,\r\n) {\r\n const context = useKeyboardContext();\r\n\r\n useEffect(() => {\r\n const key = uuid();\r\n\r\n context.setKeyboardHandlers({ [key]: handler });\r\n\r\n return () => {\r\n context.setKeyboardHandlers({ [key]: undefined });\r\n };\r\n }, deps);\r\n}\r\n\r\nexport function useKeyboardHandler(\r\n handler: KeyboardHandler,\r\n deps?: DependencyList,\r\n) {\r\n useResizeMode();\r\n useGenericKeyboardHandler(handler, deps);\r\n}\r\n\r\nexport function useKeyboardController() {\r\n const context = useKeyboardContext();\r\n\r\n return { setEnabled: context.setEnabled, enabled: context.enabled };\r\n}\r\n\r\nexport function useReanimatedFocusedInput() {\r\n const context = useKeyboardContext();\r\n\r\n return { input: context.layout };\r\n}\r\n\r\nexport function useFocusedInputHandler(\r\n handler?: FocusedInputHandler,\r\n deps?: DependencyList,\r\n) {\r\n const context = useKeyboardContext();\r\n\r\n useEffect(() => {\r\n const key = uuid();\r\n\r\n context.setInputHandlers({ [key]: handler });\r\n\r\n return () => {\r\n context.setInputHandlers({ [key]: undefined });\r\n };\r\n }, deps);\r\n}\r\n\r\nexport * from \"./useWindowDimensions\";\r\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AAEjC,SAASC,kBAAkB,QAAQ,aAAa;AAChD,SAASC,qBAAqB,QAAQ,cAAc;AACpD,SAASC,kBAAkB,QAAQ,YAAY;AAC/C,SAASC,IAAI,QAAQ,UAAU;AAM/B,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EACjCL,SAAS,CAAC,MAAM;IACdC,kBAAkB,CAACK,YAAY,CAC7BJ,qBAAqB,CAACK,wBACxB,CAAC;IAED,OAAO,MAAMN,kBAAkB,CAACO,cAAc,CAAC,CAAC;EAClD,CAAC,EAAE,EAAE,CAAC;AACR,CAAC;AAED,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAuB;EACzDJ,aAAa,CAAC,CAAC;EACf,MAAMK,OAAO,GAAGP,kBAAkB,CAAC,CAAC;EAEpC,OAAOO,OAAO,CAACC,QAAQ;AACzB,CAAC;AAED,OAAO,MAAMC,8BAA8B,GAAGA,CAAA,KAAyB;EACrEP,aAAa,CAAC,CAAC;EACf,MAAMK,OAAO,GAAGP,kBAAkB,CAAC,CAAC;EAEpC,OAAOO,OAAO,CAACG,UAAU;AAC3B,CAAC;AAED,OAAO,SAASC,yBAAyBA,CACvCC,OAAwB,EACxBC,IAAqB,EACrB;EACA,MAAMN,OAAO,GAAGP,kBAAkB,CAAC,CAAC;EAEpCH,SAAS,CAAC,MAAM;IACd,MAAMiB,GAAG,GAAGb,IAAI,CAAC,CAAC;IAElBM,OAAO,CAACQ,mBAAmB,CAAC;MAAE,CAACD,GAAG,GAAGF;IAAQ,CAAC,CAAC;IAE/C,OAAO,MAAM;MACXL,OAAO,CAACQ,mBAAmB,CAAC;QAAE,CAACD,GAAG,GAAGE;MAAU,CAAC,CAAC;IACnD,CAAC;EACH,CAAC,EAAEH,IAAI,CAAC;AACV;AAEA,OAAO,SAASI,kBAAkBA,CAChCL,OAAwB,EACxBC,IAAqB,EACrB;EACAX,aAAa,CAAC,CAAC;EACfS,yBAAyB,CAACC,OAAO,EAAEC,IAAI,CAAC;AAC1C;AAEA,OAAO,SAASK,qBAAqBA,CAAA,EAAG;EACtC,MAAMX,OAAO,GAAGP,kBAAkB,CAAC,CAAC;EAEpC,OAAO;IAAEmB,UAAU,EAAEZ,OAAO,CAACY,UAAU;IAAEC,OAAO,EAAEb,OAAO,CAACa;EAAQ,CAAC;AACrE;AAEA,OAAO,SAASC,yBAAyBA,CAAA,EAAG;EAC1C,MAAMd,OAAO,GAAGP,kBAAkB,CAAC,CAAC;EAEpC,OAAO;IAAEsB,KAAK,EAAEf,OAAO,CAACgB;EAAO,CAAC;AAClC;AAEA,OAAO,SAASC,sBAAsBA,CACpCZ,OAA6B,EAC7BC,IAAqB,EACrB;EACA,MAAMN,OAAO,GAAGP,kBAAkB,CAAC,CAAC;EAEpCH,SAAS,CAAC,MAAM;IACd,MAAMiB,GAAG,GAAGb,IAAI,CAAC,CAAC;IAElBM,OAAO,CAACkB,gBAAgB,CAAC;MAAE,CAACX,GAAG,GAAGF;IAAQ,CAAC,CAAC;IAE5C,OAAO,MAAM;MACXL,OAAO,CAACkB,gBAAgB,CAAC;QAAE,CAACX,GAAG,GAAGE;MAAU,CAAC,CAAC;IAChD,CAAC;EACH,CAAC,EAAEH,IAAI,CAAC;AACV;AAEA,cAAc,uBAAuB","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { WindowDimensionsEvents } from "../../bindings";
|
|
3
|
+
let initialDimensions = {
|
|
4
|
+
width: 0,
|
|
5
|
+
height: 0
|
|
6
|
+
};
|
|
7
|
+
WindowDimensionsEvents.addListener("windowDidResize", e => {
|
|
8
|
+
initialDimensions = e;
|
|
9
|
+
});
|
|
10
|
+
export const useWindowDimensions = () => {
|
|
11
|
+
const [dimensions, setDimensions] = useState(initialDimensions);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const subscription = WindowDimensionsEvents.addListener("windowDidResize", e => {
|
|
14
|
+
setDimensions(e);
|
|
15
|
+
});
|
|
16
|
+
return () => {
|
|
17
|
+
subscription.remove();
|
|
18
|
+
};
|
|
19
|
+
}, []);
|
|
20
|
+
return dimensions;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=index.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useState","WindowDimensionsEvents","initialDimensions","width","height","addListener","e","useWindowDimensions","dimensions","setDimensions","subscription","remove"],"sources":["index.android.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\r\n\r\nimport { WindowDimensionsEvents } from \"../../bindings\";\r\n\r\nimport type { WindowDimensionsEventData } from \"../../types\";\r\n\r\nlet initialDimensions: WindowDimensionsEventData = {\r\n width: 0,\r\n height: 0,\r\n};\r\n\r\nWindowDimensionsEvents.addListener(\"windowDidResize\", (e) => {\r\n initialDimensions = e;\r\n});\r\n\r\nexport const useWindowDimensions = () => {\r\n const [dimensions, setDimensions] = useState(initialDimensions);\r\n\r\n useEffect(() => {\r\n const subscription = WindowDimensionsEvents.addListener(\r\n \"windowDidResize\",\r\n (e) => {\r\n setDimensions(e);\r\n },\r\n );\r\n\r\n return () => {\r\n subscription.remove();\r\n };\r\n }, []);\r\n\r\n return dimensions;\r\n};\r\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE3C,SAASC,sBAAsB,QAAQ,gBAAgB;AAIvD,IAAIC,iBAA4C,GAAG;EACjDC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE;AACV,CAAC;AAEDH,sBAAsB,CAACI,WAAW,CAAC,iBAAiB,EAAGC,CAAC,IAAK;EAC3DJ,iBAAiB,GAAGI,CAAC;AACvB,CAAC,CAAC;AAEF,OAAO,MAAMC,mBAAmB,GAAGA,CAAA,KAAM;EACvC,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGT,QAAQ,CAACE,iBAAiB,CAAC;EAE/DH,SAAS,CAAC,MAAM;IACd,MAAMW,YAAY,GAAGT,sBAAsB,CAACI,WAAW,CACrD,iBAAiB,EAChBC,CAAC,IAAK;MACLG,aAAa,CAACH,CAAC,CAAC;IAClB,CACF,CAAC;IAED,OAAO,MAAM;MACXI,YAAY,CAACC,MAAM,CAAC,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOH,UAAU;AACnB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useWindowDimensions"],"sources":["index.ts"],"sourcesContent":["export { useWindowDimensions } from \"react-native\";\r\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./bindings";
|
|
2
|
+
export * from "./animated";
|
|
3
|
+
export * from "./context";
|
|
4
|
+
export * from "./hooks";
|
|
5
|
+
export * from "./constants";
|
|
6
|
+
export * from "./types";
|
|
7
|
+
export { KeyboardAvoidingView, KeyboardStickyView, KeyboardAwareScrollView,
|
|
8
|
+
// keyboard toolbar
|
|
9
|
+
KeyboardToolbar, DefaultKeyboardToolbarTheme } from "./components";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["KeyboardAvoidingView","KeyboardStickyView","KeyboardAwareScrollView","KeyboardToolbar","DefaultKeyboardToolbarTheme"],"sources":["index.ts"],"sourcesContent":["export * from \"./bindings\";\r\nexport * from \"./animated\";\r\nexport * from \"./context\";\r\nexport * from \"./hooks\";\r\nexport * from \"./constants\";\r\nexport * from \"./types\";\r\n\r\nexport {\r\n KeyboardAvoidingView,\r\n KeyboardStickyView,\r\n KeyboardAwareScrollView,\r\n // keyboard toolbar\r\n KeyboardToolbar,\r\n DefaultKeyboardToolbarTheme,\r\n} from \"./components\";\r\nexport type {\r\n KeyboardAvoidingViewProps,\r\n KeyboardStickyViewProps,\r\n KeyboardAwareScrollViewProps,\r\n KeyboardToolbarProps,\r\n} from \"./components\";\r\n"],"mappings":"AAAA,cAAc,YAAY;AAC1B,cAAc,YAAY;AAC1B,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,aAAa;AAC3B,cAAc,SAAS;AAEvB,SACEA,oBAAoB,EACpBC,kBAAkB,EAClBC,uBAAuB;AACvB;AACAC,eAAe,EACfC,2BAA2B,QACtB,cAAc","ignoreList":[]}
|