react-native-keyboard-controller 1.12.7 → 1.13.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/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardGestureAreaViewManager.kt +5 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/ReactContext.kt +13 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/ThemedReactContext.kt +0 -10
- package/android/src/main/java/com/reactnativekeyboardcontroller/interactive/interpolators/Interpolator.kt +2 -1
- package/android/src/main/java/com/reactnativekeyboardcontroller/interactive/interpolators/IosInterpolator.kt +2 -1
- package/android/src/main/java/com/reactnativekeyboardcontroller/interactive/interpolators/LinearInterpolator.kt +1 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/listeners/FocusedInputObserver.kt +13 -8
- package/android/src/main/java/com/reactnativekeyboardcontroller/listeners/KeyboardAnimationCallback.kt +71 -59
- package/android/src/main/java/com/reactnativekeyboardcontroller/managers/KeyboardGestureAreaViewManagerImpl.kt +4 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/modal/ModalAttachedWatcher.kt +80 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/modules/StatusBarManagerCompatModuleImpl.kt +6 -12
- package/android/src/main/java/com/reactnativekeyboardcontroller/views/EdgeToEdgeReactViewGroup.kt +47 -13
- package/android/src/main/java/com/reactnativekeyboardcontroller/views/KeyboardGestureAreaReactViewGroup.kt +7 -0
- package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardGestureAreaViewManager.kt +5 -0
- package/ios/extensions/UIView.swift +10 -0
- package/ios/observers/KeyboardMovementObserver.swift +7 -5
- package/ios/views/KeyboardControllerView.mm +30 -39
- package/lib/commonjs/animated.js +15 -30
- package/lib/commonjs/animated.js.map +1 -1
- package/lib/commonjs/bindings.js.map +1 -1
- package/lib/commonjs/bindings.native.js.map +1 -1
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js +2 -14
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -1
- package/lib/commonjs/components/KeyboardAvoidingView/index.js +4 -4
- package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js +7 -6
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/utils.js.map +1 -1
- package/lib/commonjs/components/KeyboardStickyView/index.js +2 -2
- package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/Arrow.js +2 -2
- package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/Button.js +12 -12
- package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/index.js +33 -27
- package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
- package/lib/commonjs/components/index.js +2 -2
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/context.js +3 -2
- package/lib/commonjs/context.js.map +1 -1
- package/lib/commonjs/event-handler.d.js +6 -0
- package/lib/commonjs/event-handler.d.js.map +1 -0
- package/lib/commonjs/event-handler.js +19 -0
- package/lib/commonjs/event-handler.js.map +1 -0
- package/lib/commonjs/event-handler.web.js +10 -0
- package/lib/commonjs/event-handler.web.js.map +1 -0
- package/lib/commonjs/event-mappings.js +9 -0
- package/lib/commonjs/event-mappings.js.map +1 -0
- package/lib/commonjs/hooks/index.js +8 -21
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useSyncEffect/index.js +37 -0
- package/lib/commonjs/hooks/useSyncEffect/index.js.map +1 -0
- package/lib/commonjs/internal.js +20 -44
- package/lib/commonjs/internal.js.map +1 -1
- package/lib/commonjs/monkey-patch.android.js +1 -1
- package/lib/commonjs/monkey-patch.android.js.map +1 -1
- package/lib/commonjs/monkey-patch.js.map +1 -1
- package/lib/commonjs/reanimated.js +1 -3
- package/lib/commonjs/reanimated.js.map +1 -1
- package/lib/commonjs/reanimated.native.js +1 -35
- package/lib/commonjs/reanimated.native.js.map +1 -1
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js +1 -1
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js +1 -1
- package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/animated.js +16 -32
- package/lib/module/animated.js.map +1 -1
- package/lib/module/bindings.js.map +1 -1
- package/lib/module/bindings.native.js.map +1 -1
- package/lib/module/components/KeyboardAvoidingView/hooks.js +2 -14
- package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -1
- package/lib/module/components/KeyboardAvoidingView/index.js +3 -3
- package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/index.js +6 -5
- package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/utils.js.map +1 -1
- package/lib/module/components/KeyboardStickyView/index.js +1 -1
- package/lib/module/components/KeyboardToolbar/Button.js +10 -10
- package/lib/module/components/KeyboardToolbar/Button.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/index.js +31 -25
- package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
- package/lib/module/context.js +3 -2
- package/lib/module/context.js.map +1 -1
- package/lib/module/event-handler.d.js +2 -0
- package/lib/module/event-handler.d.js.map +1 -0
- package/lib/module/event-handler.js +14 -0
- package/lib/module/event-handler.js.map +1 -0
- package/lib/module/event-handler.web.js +5 -0
- package/lib/module/event-handler.web.js.map +1 -0
- package/lib/module/event-mappings.js +3 -0
- package/lib/module/event-mappings.js.map +1 -0
- package/lib/module/hooks/index.js +7 -21
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useSyncEffect/index.js +31 -0
- package/lib/module/hooks/useSyncEffect/index.js.map +1 -0
- package/lib/module/internal.js +21 -45
- package/lib/module/internal.js.map +1 -1
- package/lib/module/monkey-patch.js.map +1 -1
- package/lib/module/reanimated.js +0 -2
- package/lib/module/reanimated.js.map +1 -1
- package/lib/module/reanimated.native.js +0 -32
- package/lib/module/reanimated.native.js.map +1 -1
- package/lib/module/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/components/KeyboardToolbar/Button.d.ts +2 -2
- package/lib/typescript/components/KeyboardToolbar/index.d.ts +4 -3
- package/lib/typescript/context.d.ts +3 -3
- package/lib/typescript/event-mappings.d.ts +2 -0
- package/lib/typescript/hooks/index.d.ts +1 -1
- package/lib/typescript/hooks/useSyncEffect/index.d.ts +14 -0
- package/lib/typescript/internal.d.ts +5 -19
- package/lib/typescript/reanimated.d.ts +1 -3
- package/lib/typescript/reanimated.native.d.ts +1 -3
- package/lib/typescript/specs/KeyboardGestureAreaNativeComponent.d.ts +2 -1
- package/lib/typescript/types.d.ts +6 -0
- package/package.json +11 -7
- package/src/animated.tsx +20 -43
- package/src/bindings.native.ts +1 -0
- package/src/bindings.ts +1 -0
- package/src/components/KeyboardAvoidingView/hooks.ts +2 -13
- package/src/components/KeyboardAvoidingView/index.tsx +1 -1
- package/src/components/KeyboardAwareScrollView/index.tsx +8 -3
- package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +1 -0
- package/src/components/KeyboardAwareScrollView/utils.ts +1 -0
- package/src/components/KeyboardToolbar/Button.tsx +11 -11
- package/src/components/KeyboardToolbar/index.tsx +45 -25
- package/src/context.ts +8 -6
- package/src/event-handler.d.ts +8 -0
- package/src/event-handler.js +15 -0
- package/src/event-handler.web.js +5 -0
- package/src/event-mappings.ts +14 -0
- package/src/hooks/index.ts +9 -16
- package/src/hooks/useSyncEffect/index.ts +36 -0
- package/src/internal.ts +34 -54
- package/src/monkey-patch.ts +1 -0
- package/src/reanimated.native.ts +0 -50
- package/src/reanimated.ts +1 -12
- package/src/specs/KeyboardGestureAreaNativeComponent.ts +5 -1
- package/src/types.ts +6 -0
- package/lib/commonjs/utils.js +0 -9
- package/lib/commonjs/utils.js.map +0 -1
- package/lib/module/utils.js +0 -2
- package/lib/module/utils.js.map +0 -1
- package/lib/typescript/utils.d.ts +0 -1
- package/src/utils.ts +0 -1
|
@@ -1 +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\";\nimport {\n Platform,\n TouchableNativeFeedback,\n TouchableOpacity,\n View,\n} from \"react-native\";\n\nimport useColorScheme from \"../hooks/useColorScheme\";\n\nimport type { KeyboardToolbarTheme } from \"./types\";\nimport type { PropsWithChildren } from \"react\";\nimport type { ViewStyle } from \"react-native\";\n\ntype ButtonProps = {\n disabled?: boolean;\n onPress: () => void;\n accessibilityLabel: string;\n accessibilityHint: string;\n testID: string;\n rippleRadius?: number;\n style?: ViewStyle;\n theme: KeyboardToolbarTheme;\n};\n\nconst ButtonIOS = ({\n children,\n onPress,\n disabled,\n accessibilityLabel,\n accessibilityHint,\n testID,\n style,\n}: PropsWithChildren<ButtonProps>) => {\n // immediately switch to plain view to avoid animation flickering\n // when fade out animation happens and view becomes disabled\n const Container = disabled\n ? (View as unknown as typeof TouchableOpacity)\n : TouchableOpacity;\n const accessibilityState = useMemo(() => ({ disabled }), [disabled]);\n\n return (\n <Container\n
|
|
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\";\nimport {\n Platform,\n TouchableNativeFeedback,\n TouchableOpacity,\n View,\n} from \"react-native\";\n\nimport useColorScheme from \"../hooks/useColorScheme\";\n\nimport type { KeyboardToolbarTheme } from \"./types\";\nimport type { PropsWithChildren } from \"react\";\nimport type { GestureResponderEvent, ViewStyle } from \"react-native\";\n\ntype ButtonProps = {\n disabled?: boolean;\n onPress: (event: GestureResponderEvent) => void;\n accessibilityLabel: string;\n accessibilityHint: string;\n testID: string;\n rippleRadius?: number;\n style?: ViewStyle;\n theme: KeyboardToolbarTheme;\n};\n\nconst ButtonIOS = ({\n children,\n onPress,\n disabled,\n accessibilityLabel,\n accessibilityHint,\n testID,\n style,\n}: PropsWithChildren<ButtonProps>) => {\n // immediately switch to plain view to avoid animation flickering\n // when fade out animation happens and view becomes disabled\n const Container = disabled\n ? (View as unknown as typeof TouchableOpacity)\n : TouchableOpacity;\n const accessibilityState = useMemo(() => ({ disabled }), [disabled]);\n\n return (\n <Container\n accessibilityHint={accessibilityHint}\n accessibilityLabel={accessibilityLabel}\n accessibilityRole=\"button\"\n accessibilityState={accessibilityState}\n style={style}\n testID={testID}\n onPress={onPress}\n >\n {children}\n </Container>\n );\n};\nconst ButtonAndroid = ({\n children,\n onPress,\n disabled,\n accessibilityLabel,\n accessibilityHint,\n testID,\n rippleRadius = 18,\n style,\n theme,\n}: PropsWithChildren<ButtonProps>) => {\n const colorScheme = useColorScheme();\n const accessibilityState = useMemo(() => ({ disabled }), [disabled]);\n const ripple = useMemo(\n () =>\n TouchableNativeFeedback.Ripple(\n theme[colorScheme].ripple,\n true,\n rippleRadius,\n ),\n [colorScheme, rippleRadius, theme],\n );\n\n return (\n <TouchableNativeFeedback\n accessibilityHint={accessibilityHint}\n accessibilityLabel={accessibilityLabel}\n accessibilityRole=\"button\"\n accessibilityState={accessibilityState}\n background={ripple}\n style={style}\n testID={testID}\n onPress={onPress}\n >\n <View style={style}>{children}</View>\n </TouchableNativeFeedback>\n );\n};\n\nexport default Platform.select({\n android: ButtonAndroid,\n default: ButtonIOS,\n});\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;IACRH,iBAAiB,EAAEA,iBAAkB;IACrCD,kBAAkB,EAAEA,kBAAmB;IACvCO,iBAAiB,EAAC,QAAQ;IAC1BF,kBAAkB,EAAEA,kBAAmB;IACvCF,KAAK,EAAEA,KAAM;IACbD,MAAM,EAAEA,MAAO;IACfJ,OAAO,EAAEA;EAAQ,GAEhBD,QACQ,CAAC;AAEhB,CAAC;AACD,MAAMW,aAAa,GAAGA,CAAC;EACrBX,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,kBAAkB;EAClBC,iBAAiB;EACjBC,MAAM;EACNO,YAAY,GAAG,EAAE;EACjBN,KAAK;EACLO;AAC8B,CAAC,KAAK;EACpC,MAAMC,WAAW,GAAGhB,cAAc,CAAC,CAAC;EACpC,MAAMU,kBAAkB,GAAGf,OAAO,CAAC,OAAO;IAAES;EAAS,CAAC,CAAC,EAAE,CAACA,QAAQ,CAAC,CAAC;EACpE,MAAMa,MAAM,GAAGtB,OAAO,CACpB,MACEE,uBAAuB,CAACqB,MAAM,CAC5BH,KAAK,CAACC,WAAW,CAAC,CAACC,MAAM,EACzB,IAAI,EACJH,YACF,CAAC,EACH,CAACE,WAAW,EAAEF,YAAY,EAAEC,KAAK,CACnC,CAAC;EAED,oBACErB,KAAA,CAAAiB,aAAA,CAACd,uBAAuB;IACtBS,iBAAiB,EAAEA,iBAAkB;IACrCD,kBAAkB,EAAEA,kBAAmB;IACvCO,iBAAiB,EAAC,QAAQ;IAC1BF,kBAAkB,EAAEA,kBAAmB;IACvCS,UAAU,EAAEF,MAAO;IACnBT,KAAK,EAAEA,KAAM;IACbD,MAAM,EAAEA,MAAO;IACfJ,OAAO,EAAEA;EAAQ,gBAEjBT,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":[]}
|
|
@@ -58,17 +58,23 @@ const KeyboardToolbar = ({
|
|
|
58
58
|
}], [colorScheme, opacity, theme]);
|
|
59
59
|
const ButtonContainer = button || Button;
|
|
60
60
|
const IconContainer = icon || Arrow;
|
|
61
|
-
const onPressNext = useCallback(
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
const onPressNext = useCallback(event => {
|
|
62
|
+
onNextCallback === null || onNextCallback === void 0 || onNextCallback(event);
|
|
63
|
+
if (!event.isDefaultPrevented()) {
|
|
64
|
+
goToNextField();
|
|
65
|
+
}
|
|
64
66
|
}, [onNextCallback]);
|
|
65
|
-
const onPressPrev = useCallback(
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
const onPressPrev = useCallback(event => {
|
|
68
|
+
onPrevCallback === null || onPrevCallback === void 0 || onPrevCallback(event);
|
|
69
|
+
if (!event.isDefaultPrevented()) {
|
|
70
|
+
goToPrevField();
|
|
71
|
+
}
|
|
68
72
|
}, [onPrevCallback]);
|
|
69
|
-
const onPressDone = useCallback(
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
const onPressDone = useCallback(event => {
|
|
74
|
+
onDoneCallback === null || onDoneCallback === void 0 || onDoneCallback(event);
|
|
75
|
+
if (!event.isDefaultPrevented()) {
|
|
76
|
+
dismissKeyboard();
|
|
77
|
+
}
|
|
72
78
|
}, [onDoneCallback]);
|
|
73
79
|
return /*#__PURE__*/React.createElement(KeyboardStickyView, {
|
|
74
80
|
offset: offset
|
|
@@ -76,41 +82,41 @@ const KeyboardToolbar = ({
|
|
|
76
82
|
style: toolbarStyle,
|
|
77
83
|
testID: TEST_ID_KEYBOARD_TOOLBAR
|
|
78
84
|
}, blur, showArrows && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ButtonContainer, {
|
|
85
|
+
accessibilityHint: "Moves focus to the previous field",
|
|
79
86
|
accessibilityLabel: "Previous",
|
|
80
|
-
accessibilityHint: "Will move focus to previous field",
|
|
81
87
|
disabled: isPrevDisabled,
|
|
82
|
-
onPress: onPressPrev,
|
|
83
88
|
testID: TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS,
|
|
84
|
-
theme: theme
|
|
89
|
+
theme: theme,
|
|
90
|
+
onPress: onPressPrev
|
|
85
91
|
}, /*#__PURE__*/React.createElement(IconContainer, {
|
|
86
92
|
disabled: isPrevDisabled,
|
|
87
|
-
|
|
88
|
-
|
|
93
|
+
theme: theme,
|
|
94
|
+
type: "prev"
|
|
89
95
|
})), /*#__PURE__*/React.createElement(ButtonContainer, {
|
|
96
|
+
accessibilityHint: "Moves focus to the next field",
|
|
90
97
|
accessibilityLabel: "Next",
|
|
91
|
-
accessibilityHint: "Will move focus to next field",
|
|
92
98
|
disabled: isNextDisabled,
|
|
93
|
-
onPress: onPressNext,
|
|
94
99
|
testID: TEST_ID_KEYBOARD_TOOLBAR_NEXT,
|
|
95
|
-
theme: theme
|
|
100
|
+
theme: theme,
|
|
101
|
+
onPress: onPressNext
|
|
96
102
|
}, /*#__PURE__*/React.createElement(IconContainer, {
|
|
97
103
|
disabled: isNextDisabled,
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
theme: theme,
|
|
105
|
+
type: "next"
|
|
100
106
|
}))), /*#__PURE__*/React.createElement(View, {
|
|
101
107
|
style: styles.flex,
|
|
102
108
|
testID: TEST_ID_KEYBOARD_TOOLBAR_CONTENT
|
|
103
109
|
}, content), /*#__PURE__*/React.createElement(ButtonContainer, {
|
|
110
|
+
accessibilityHint: "Closes the keyboard",
|
|
104
111
|
accessibilityLabel: "Done",
|
|
105
|
-
accessibilityHint: "Will close the keyboard",
|
|
106
|
-
onPress: onPressDone,
|
|
107
|
-
testID: TEST_ID_KEYBOARD_TOOLBAR_DONE,
|
|
108
112
|
rippleRadius: 28,
|
|
109
113
|
style: styles.doneButtonContainer,
|
|
110
|
-
|
|
114
|
+
testID: TEST_ID_KEYBOARD_TOOLBAR_DONE,
|
|
115
|
+
theme: theme,
|
|
116
|
+
onPress: onPressDone
|
|
111
117
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
112
|
-
|
|
113
|
-
|
|
118
|
+
maxFontSizeMultiplier: 1.3,
|
|
119
|
+
style: doneStyle
|
|
114
120
|
}, doneText || "Done"))));
|
|
115
121
|
};
|
|
116
122
|
const styles = StyleSheet.create({
|
|
@@ -1 +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\";\nimport { StyleSheet, Text, View } from \"react-native\";\n\nimport {\n FocusedInputEvents,\n KeyboardStickyView,\n} from \"react-native-keyboard-controller\";\n\nimport { KeyboardController } from \"../../bindings\";\nimport useColorScheme from \"../hooks/useColorScheme\";\n\nimport Arrow from \"./Arrow\";\nimport Button from \"./Button\";\nimport { colors } from \"./colors\";\n\nimport type { HEX, KeyboardToolbarTheme } from \"./types\";\nimport type { ReactNode } from \"react\";\n\nexport type KeyboardToolbarProps = {\n /** An element that is shown in the middle of the toolbar. */\n content?: JSX.Element | null;\n /** A set of dark/light colors consumed by toolbar component. */\n theme?: KeyboardToolbarTheme;\n /** Custom text for done button. */\n doneText?: ReactNode;\n /** Custom touchable component for toolbar (used for prev/next/done buttons). */\n button?: typeof Button;\n /** Custom icon component used to display next/prev buttons. */\n icon?: typeof Arrow;\n /**\n * Whether to show next and previous buttons. Can be useful to set it to `false` if you have only one input\n * and want to show only `Done` button. Default to `true`.\n */\n showArrows?: boolean;\n /**\n * A callback that is called when the user presses the next button along with the default action.\n */\n onNextCallback?: () => void;\n /**\n * A callback that is called when the user presses the previous button along with the default action.\n */\n onPrevCallback?: () => void;\n /**\n * A callback that is called when the user presses the done button along with the default action.\n */\n onDoneCallback?: () => void;\n /**\n * A component that applies blur effect to the toolbar.\n */\n blur?: JSX.Element | null;\n /**\n * A value for container opacity in hexadecimal format (e.g. `ff`). Default value is `ff`.\n */\n opacity?: HEX;\n};\nconst TEST_ID_KEYBOARD_TOOLBAR = \"keyboard.toolbar\";\nconst TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;\nconst TEST_ID_KEYBOARD_TOOLBAR_NEXT = `${TEST_ID_KEYBOARD_TOOLBAR}.next`;\nconst TEST_ID_KEYBOARD_TOOLBAR_CONTENT = `${TEST_ID_KEYBOARD_TOOLBAR}.content`;\nconst TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;\n\nconst KEYBOARD_TOOLBAR_HEIGHT = 42;\nconst DEFAULT_OPACITY: HEX = \"FF\";\nconst offset = { closed: KEYBOARD_TOOLBAR_HEIGHT };\n\nconst dismissKeyboard = () => KeyboardController.dismiss();\nconst goToNextField = () => KeyboardController.setFocusTo(\"next\");\nconst goToPrevField = () => KeyboardController.setFocusTo(\"prev\");\n\n/**\n * `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` and\n * `Done` buttons.\n */\nconst KeyboardToolbar: React.FC<KeyboardToolbarProps> = ({\n content,\n theme = colors,\n doneText,\n button,\n icon,\n showArrows = true,\n onNextCallback,\n onPrevCallback,\n onDoneCallback,\n blur = null,\n opacity = DEFAULT_OPACITY,\n}) => {\n const colorScheme = useColorScheme();\n const [inputs, setInputs] = useState({\n current: 0,\n count: 0,\n });\n const isPrevDisabled = inputs.current === 0;\n const isNextDisabled = inputs.current === inputs.count - 1;\n\n useEffect(() => {\n const subscription = FocusedInputEvents.addListener(\"focusDidSet\", (e) => {\n setInputs(e);\n });\n\n return subscription.remove;\n }, []);\n const doneStyle = useMemo(\n () => [styles.doneButton, { color: theme[colorScheme].primary }],\n [colorScheme, theme],\n );\n const toolbarStyle = useMemo(\n () => [\n styles.toolbar,\n {\n backgroundColor: `${theme[colorScheme].background}${opacity}`,\n },\n ],\n [colorScheme, opacity, theme],\n );\n const ButtonContainer = button || Button;\n const IconContainer = icon || Arrow;\n\n const onPressNext = useCallback(() => {\n goToNextField();\n onNextCallback?.();\n }, [onNextCallback]);\n const onPressPrev = useCallback(() => {\n goToPrevField();\n onPrevCallback?.();\n }, [onPrevCallback]);\n const onPressDone = useCallback(() => {\n dismissKeyboard();\n onDoneCallback?.();\n }, [onDoneCallback]);\n\n return (\n <KeyboardStickyView offset={offset}>\n <View style={toolbarStyle} testID={TEST_ID_KEYBOARD_TOOLBAR}>\n {blur}\n {showArrows && (\n <>\n <ButtonContainer\n accessibilityLabel=\"Previous\"\n accessibilityHint=\"Will move focus to previous field\"\n disabled={isPrevDisabled}\n onPress={onPressPrev}\n testID={TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS}\n theme={theme}\n >\n <IconContainer\n disabled={isPrevDisabled}\n type=\"prev\"\n theme={theme}\n />\n </ButtonContainer>\n <ButtonContainer\n accessibilityLabel=\"Next\"\n accessibilityHint=\"Will move focus to next field\"\n disabled={isNextDisabled}\n onPress={onPressNext}\n testID={TEST_ID_KEYBOARD_TOOLBAR_NEXT}\n theme={theme}\n >\n <IconContainer\n disabled={isNextDisabled}\n type=\"next\"\n theme={theme}\n />\n </ButtonContainer>\n </>\n )}\n\n <View style={styles.flex} testID={TEST_ID_KEYBOARD_TOOLBAR_CONTENT}>\n {content}\n </View>\n <ButtonContainer\n accessibilityLabel=\"Done\"\n accessibilityHint=\"Will close the keyboard\"\n onPress={onPressDone}\n testID={TEST_ID_KEYBOARD_TOOLBAR_DONE}\n rippleRadius={28}\n style={styles.doneButtonContainer}\n theme={theme}\n >\n <Text style={doneStyle} maxFontSizeMultiplier={1.3}>\n {doneText || \"Done\"}\n </Text>\n </ButtonContainer>\n </View>\n </KeyboardStickyView>\n );\n};\n\nconst styles = StyleSheet.create({\n flex: {\n flex: 1,\n },\n toolbar: {\n position: \"absolute\",\n bottom: 0,\n alignItems: \"center\",\n width: \"100%\",\n flexDirection: \"row\",\n height: KEYBOARD_TOOLBAR_HEIGHT,\n paddingHorizontal: 8,\n },\n doneButton: {\n fontWeight: \"600\",\n fontSize: 15,\n },\n doneButtonContainer: {\n marginRight: 8,\n },\n});\n\nexport { colors as DefaultKeyboardToolbarTheme };\nexport default KeyboardToolbar;\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,EAClBC,kBAAkB,QACb,kCAAkC;AAEzC,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,GAAI,GAAED,wBAAyB,WAAU;AAChF,MAAME,6BAA6B,GAAI,GAAEF,wBAAyB,OAAM;AACxE,MAAMG,gCAAgC,GAAI,GAAEH,wBAAyB,UAAS;AAC9E,MAAMI,6BAA6B,GAAI,GAAEJ,wBAAyB,OAAM;AAExE,MAAMK,uBAAuB,GAAG,EAAE;AAClC,MAAMC,eAAoB,GAAG,IAAI;AACjC,MAAMC,MAAM,GAAG;EAAEC,MAAM,EAAEH;AAAwB,CAAC;AAElD,MAAMI,eAAe,GAAGA,CAAA,KAAMd,kBAAkB,CAACe,OAAO,CAAC,CAAC;AAC1D,MAAMC,aAAa,GAAGA,CAAA,KAAMhB,kBAAkB,CAACiB,UAAU,CAAC,MA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B,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":[]}
|
|
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","event","isDefaultPrevented","onPressPrev","onPressDone","createElement","style","testID","Fragment","accessibilityHint","accessibilityLabel","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\";\nimport { StyleSheet, Text, View } from \"react-native\";\n\nimport {\n FocusedInputEvents,\n KeyboardStickyView,\n} from \"react-native-keyboard-controller\";\n\nimport { KeyboardController } from \"../../bindings\";\nimport useColorScheme from \"../hooks/useColorScheme\";\n\nimport Arrow from \"./Arrow\";\nimport Button from \"./Button\";\nimport { colors } from \"./colors\";\n\nimport type { HEX, KeyboardToolbarTheme } from \"./types\";\nimport type { ReactNode } from \"react\";\nimport type { GestureResponderEvent } from \"react-native\";\n\nexport type KeyboardToolbarProps = {\n /** An element that is shown in the middle of the toolbar. */\n content?: JSX.Element | null;\n /** A set of dark/light colors consumed by toolbar component. */\n theme?: KeyboardToolbarTheme;\n /** Custom text for done button. */\n doneText?: ReactNode;\n /** Custom touchable component for toolbar (used for prev/next/done buttons). */\n button?: typeof Button;\n /** Custom icon component used to display next/prev buttons. */\n icon?: typeof Arrow;\n /**\n * Whether to show next and previous buttons. Can be useful to set it to `false` if you have only one input\n * and want to show only `Done` button. Default to `true`.\n */\n showArrows?: boolean;\n /**\n * A callback that is called when the user presses the next button along with the default action.\n */\n onNextCallback?: (event: GestureResponderEvent) => void;\n /**\n * A callback that is called when the user presses the previous button along with the default action.\n */\n onPrevCallback?: (event: GestureResponderEvent) => void;\n /**\n * A callback that is called when the user presses the done button along with the default action.\n */\n onDoneCallback?: (event: GestureResponderEvent) => void;\n /**\n * A component that applies blur effect to the toolbar.\n */\n blur?: JSX.Element | null;\n /**\n * A value for container opacity in hexadecimal format (e.g. `ff`). Default value is `ff`.\n */\n opacity?: HEX;\n};\n\nconst TEST_ID_KEYBOARD_TOOLBAR = \"keyboard.toolbar\";\nconst TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;\nconst TEST_ID_KEYBOARD_TOOLBAR_NEXT = `${TEST_ID_KEYBOARD_TOOLBAR}.next`;\nconst TEST_ID_KEYBOARD_TOOLBAR_CONTENT = `${TEST_ID_KEYBOARD_TOOLBAR}.content`;\nconst TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;\n\nconst KEYBOARD_TOOLBAR_HEIGHT = 42;\nconst DEFAULT_OPACITY: HEX = \"FF\";\nconst offset = { closed: KEYBOARD_TOOLBAR_HEIGHT };\n\nconst dismissKeyboard = () => KeyboardController.dismiss();\nconst goToNextField = () => KeyboardController.setFocusTo(\"next\");\nconst goToPrevField = () => KeyboardController.setFocusTo(\"prev\");\n\n/**\n * `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` and\n * `Done` buttons.\n */\nconst KeyboardToolbar: React.FC<KeyboardToolbarProps> = ({\n content,\n theme = colors,\n doneText,\n button,\n icon,\n showArrows = true,\n onNextCallback,\n onPrevCallback,\n onDoneCallback,\n blur = null,\n opacity = DEFAULT_OPACITY,\n}) => {\n const colorScheme = useColorScheme();\n const [inputs, setInputs] = useState({\n current: 0,\n count: 0,\n });\n const isPrevDisabled = inputs.current === 0;\n const isNextDisabled = inputs.current === inputs.count - 1;\n\n useEffect(() => {\n const subscription = FocusedInputEvents.addListener(\"focusDidSet\", (e) => {\n setInputs(e);\n });\n\n return subscription.remove;\n }, []);\n const doneStyle = useMemo(\n () => [styles.doneButton, { color: theme[colorScheme].primary }],\n [colorScheme, theme],\n );\n const toolbarStyle = useMemo(\n () => [\n styles.toolbar,\n {\n backgroundColor: `${theme[colorScheme].background}${opacity}`,\n },\n ],\n [colorScheme, opacity, theme],\n );\n const ButtonContainer = button || Button;\n const IconContainer = icon || Arrow;\n\n const onPressNext = useCallback(\n (event: GestureResponderEvent) => {\n onNextCallback?.(event);\n\n if (!event.isDefaultPrevented()) {\n goToNextField();\n }\n },\n [onNextCallback],\n );\n const onPressPrev = useCallback(\n (event: GestureResponderEvent) => {\n onPrevCallback?.(event);\n\n if (!event.isDefaultPrevented()) {\n goToPrevField();\n }\n },\n [onPrevCallback],\n );\n const onPressDone = useCallback(\n (event: GestureResponderEvent) => {\n onDoneCallback?.(event);\n\n if (!event.isDefaultPrevented()) {\n dismissKeyboard();\n }\n },\n [onDoneCallback],\n );\n\n return (\n <KeyboardStickyView offset={offset}>\n <View style={toolbarStyle} testID={TEST_ID_KEYBOARD_TOOLBAR}>\n {blur}\n {showArrows && (\n <>\n <ButtonContainer\n accessibilityHint=\"Moves focus to the previous field\"\n accessibilityLabel=\"Previous\"\n disabled={isPrevDisabled}\n testID={TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS}\n theme={theme}\n onPress={onPressPrev}\n >\n <IconContainer\n disabled={isPrevDisabled}\n theme={theme}\n type=\"prev\"\n />\n </ButtonContainer>\n <ButtonContainer\n accessibilityHint=\"Moves focus to the next field\"\n accessibilityLabel=\"Next\"\n disabled={isNextDisabled}\n testID={TEST_ID_KEYBOARD_TOOLBAR_NEXT}\n theme={theme}\n onPress={onPressNext}\n >\n <IconContainer\n disabled={isNextDisabled}\n theme={theme}\n type=\"next\"\n />\n </ButtonContainer>\n </>\n )}\n\n <View style={styles.flex} testID={TEST_ID_KEYBOARD_TOOLBAR_CONTENT}>\n {content}\n </View>\n <ButtonContainer\n accessibilityHint=\"Closes the keyboard\"\n accessibilityLabel=\"Done\"\n rippleRadius={28}\n style={styles.doneButtonContainer}\n testID={TEST_ID_KEYBOARD_TOOLBAR_DONE}\n theme={theme}\n onPress={onPressDone}\n >\n <Text maxFontSizeMultiplier={1.3} style={doneStyle}>\n {doneText || \"Done\"}\n </Text>\n </ButtonContainer>\n </View>\n </KeyboardStickyView>\n );\n};\n\nconst styles = StyleSheet.create({\n flex: {\n flex: 1,\n },\n toolbar: {\n position: \"absolute\",\n bottom: 0,\n alignItems: \"center\",\n width: \"100%\",\n flexDirection: \"row\",\n height: KEYBOARD_TOOLBAR_HEIGHT,\n paddingHorizontal: 8,\n },\n doneButton: {\n fontWeight: \"600\",\n fontSize: 15,\n },\n doneButtonContainer: {\n marginRight: 8,\n },\n});\n\nexport { colors as DefaultKeyboardToolbarTheme };\nexport default KeyboardToolbar;\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,kB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|
|
|
1
1
|
import { createContext, useContext } from "react";
|
|
2
2
|
import { Animated } from "react-native";
|
|
3
3
|
const NOOP = () => {};
|
|
4
|
+
const NESTED_NOOP = () => NOOP;
|
|
4
5
|
const withSharedValue = value => ({
|
|
5
6
|
value,
|
|
6
7
|
addListener: NOOP,
|
|
@@ -20,8 +21,8 @@ const defaultContext = {
|
|
|
20
21
|
height: DEFAULT_SHARED_VALUE
|
|
21
22
|
},
|
|
22
23
|
layout: DEFAULT_LAYOUT,
|
|
23
|
-
setKeyboardHandlers:
|
|
24
|
-
setInputHandlers:
|
|
24
|
+
setKeyboardHandlers: NESTED_NOOP,
|
|
25
|
+
setInputHandlers: NESTED_NOOP,
|
|
25
26
|
setEnabled: NOOP
|
|
26
27
|
};
|
|
27
28
|
export const KeyboardContext = /*#__PURE__*/createContext(defaultContext);
|
|
@@ -1 +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\";\nimport { Animated } from \"react-native\";\n\nimport type {\n
|
|
1
|
+
{"version":3,"names":["createContext","useContext","Animated","NOOP","NESTED_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\";\nimport { Animated } from \"react-native\";\n\nimport type {\n FocusedInputHandler,\n FocusedInputLayoutChangedEvent,\n KeyboardHandler,\n} from \"./types\";\nimport type React from \"react\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nexport type AnimatedContext = {\n progress: Animated.Value;\n height: Animated.AnimatedMultiplication<number>;\n};\nexport type ReanimatedContext = {\n progress: SharedValue<number>;\n height: SharedValue<number>;\n};\nexport type KeyboardAnimationContext = {\n enabled: boolean;\n animated: AnimatedContext;\n reanimated: ReanimatedContext;\n layout: SharedValue<FocusedInputLayoutChangedEvent | null>;\n setKeyboardHandlers: (handlers: KeyboardHandler) => () => void;\n setInputHandlers: (handlers: FocusedInputHandler) => () => void;\n setEnabled: React.Dispatch<React.SetStateAction<boolean>>;\n};\nconst NOOP = () => {};\nconst NESTED_NOOP = () => NOOP;\nconst withSharedValue = <T>(value: T): SharedValue<T> => ({\n value,\n addListener: NOOP,\n removeListener: NOOP,\n modify: NOOP,\n});\nconst DEFAULT_SHARED_VALUE = withSharedValue(0);\nconst DEFAULT_LAYOUT = withSharedValue<FocusedInputLayoutChangedEvent | null>(\n null,\n);\nconst defaultContext: KeyboardAnimationContext = {\n enabled: true,\n animated: {\n progress: new Animated.Value(0),\n height: new Animated.Value(0),\n },\n reanimated: {\n progress: DEFAULT_SHARED_VALUE,\n height: DEFAULT_SHARED_VALUE,\n },\n layout: DEFAULT_LAYOUT,\n setKeyboardHandlers: NESTED_NOOP,\n setInputHandlers: NESTED_NOOP,\n setEnabled: NOOP,\n};\n\nexport const KeyboardContext = createContext(defaultContext);\nexport const useKeyboardContext = () => {\n const context = useContext(KeyboardContext);\n\n if (__DEV__ && context === defaultContext) {\n console.warn(\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.\",\n );\n }\n\n return context;\n};\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AACjD,SAASC,QAAQ,QAAQ,cAAc;AA2BvC,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB,MAAMC,WAAW,GAAGA,CAAA,KAAMD,IAAI;AAC9B,MAAME,eAAe,GAAOC,KAAQ,KAAsB;EACxDA,KAAK;EACLC,WAAW,EAAEJ,IAAI;EACjBK,cAAc,EAAEL,IAAI;EACpBM,MAAM,EAAEN;AACV,CAAC,CAAC;AACF,MAAMO,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,IAAIb,QAAQ,CAACc,KAAK,CAAC,CAAC,CAAC;IAC/BC,MAAM,EAAE,IAAIf,QAAQ,CAACc,KAAK,CAAC,CAAC;EAC9B,CAAC;EACDE,UAAU,EAAE;IACVH,QAAQ,EAAEL,oBAAoB;IAC9BO,MAAM,EAAEP;EACV,CAAC;EACDS,MAAM,EAAER,cAAc;EACtBS,mBAAmB,EAAEhB,WAAW;EAChCiB,gBAAgB,EAAEjB,WAAW;EAC7BkB,UAAU,EAAEnB;AACd,CAAC;AAED,OAAO,MAAMoB,eAAe,gBAAGvB,aAAa,CAACY,cAAc,CAAC;AAC5D,OAAO,MAAMY,kBAAkB,GAAGA,CAAA,KAAM;EACtC,MAAMC,OAAO,GAAGxB,UAAU,CAACsB,eAAe,CAAC;EAE3C,IAAIG,OAAO,IAAID,OAAO,KAAKb,cAAc,EAAE;IACzCe,OAAO,CAACC,IAAI,CACV,sLACF,CAAC;EACH;EAEA,OAAOH,OAAO;AAChB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["event-handler.d.ts"],"sourcesContent":["declare function registerEventHandler(\n handler: (event: never) => void,\n eventName: string,\n viewTag: number,\n): number;\ndeclare function unregisterEventHandler(id: number): void;\n\nexport { registerEventHandler, unregisterEventHandler };\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
let REACore = null;
|
|
2
|
+
try {
|
|
3
|
+
REACore = require("react-native-reanimated/src/core");
|
|
4
|
+
} catch (e1) {
|
|
5
|
+
try {
|
|
6
|
+
REACore = require("react-native-reanimated/src/reanimated2/core");
|
|
7
|
+
} catch (e2) {
|
|
8
|
+
console.warn("Failed to load REACore from both paths");
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const registerEventHandler = REACore.registerEventHandler;
|
|
12
|
+
const unregisterEventHandler = REACore.unregisterEventHandler;
|
|
13
|
+
export { registerEventHandler, unregisterEventHandler };
|
|
14
|
+
//# sourceMappingURL=event-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["REACore","require","e1","e2","console","warn","registerEventHandler","unregisterEventHandler"],"sources":["event-handler.js"],"sourcesContent":["let REACore = null;\n\ntry {\n REACore = require(\"react-native-reanimated/src/core\");\n} catch (e1) {\n try {\n REACore = require(\"react-native-reanimated/src/reanimated2/core\");\n } catch (e2) {\n console.warn(\"Failed to load REACore from both paths\");\n }\n}\nconst registerEventHandler = REACore.registerEventHandler;\nconst unregisterEventHandler = REACore.unregisterEventHandler;\n\nexport { registerEventHandler, unregisterEventHandler };\n"],"mappings":"AAAA,IAAIA,OAAO,GAAG,IAAI;AAElB,IAAI;EACFA,OAAO,GAAGC,OAAO,CAAC,kCAAkC,CAAC;AACvD,CAAC,CAAC,OAAOC,EAAE,EAAE;EACX,IAAI;IACFF,OAAO,GAAGC,OAAO,CAAC,8CAA8C,CAAC;EACnE,CAAC,CAAC,OAAOE,EAAE,EAAE;IACXC,OAAO,CAACC,IAAI,CAAC,wCAAwC,CAAC;EACxD;AACF;AACA,MAAMC,oBAAoB,GAAGN,OAAO,CAACM,oBAAoB;AACzD,MAAMC,sBAAsB,GAAGP,OAAO,CAACO,sBAAsB;AAE7D,SAASD,oBAAoB,EAAEC,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NOOP","registerEventHandler","unregisterEventHandler"],"sources":["event-handler.web.js"],"sourcesContent":["const NOOP = () => {};\nconst registerEventHandler = NOOP;\nconst unregisterEventHandler = NOOP;\n\nexport { registerEventHandler, unregisterEventHandler };\n"],"mappings":"AAAA,MAAMA,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB,MAAMC,oBAAoB,GAAGD,IAAI;AACjC,MAAME,sBAAsB,GAAGF,IAAI;AAEnC,SAASC,oBAAoB,EAAEC,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export const keyboardEventsMap = new Map([["onStart", "onKeyboardMoveStart"], ["onMove", "onKeyboardMove"], ["onEnd", "onKeyboardMoveEnd"], ["onInteractive", "onKeyboardMoveInteractive"]]);
|
|
2
|
+
export const focusedInputEventsMap = new Map([["onChangeText", "onFocusedInputTextChanged"], ["onSelectionChange", "onFocusedInputSelectionChanged"]]);
|
|
3
|
+
//# sourceMappingURL=event-mappings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["keyboardEventsMap","Map","focusedInputEventsMap"],"sources":["event-mappings.ts"],"sourcesContent":["import type { FocusedInputHandler, KeyboardHandler } from \"./types\";\n\nexport const keyboardEventsMap = new Map<keyof KeyboardHandler, string>([\n [\"onStart\", \"onKeyboardMoveStart\"],\n [\"onMove\", \"onKeyboardMove\"],\n [\"onEnd\", \"onKeyboardMoveEnd\"],\n [\"onInteractive\", \"onKeyboardMoveInteractive\"],\n]);\nexport const focusedInputEventsMap = new Map<keyof FocusedInputHandler, string>(\n [\n [\"onChangeText\", \"onFocusedInputTextChanged\"],\n [\"onSelectionChange\", \"onFocusedInputSelectionChanged\"],\n ],\n);\n"],"mappings":"AAEA,OAAO,MAAMA,iBAAiB,GAAG,IAAIC,GAAG,CAAgC,CACtE,CAAC,SAAS,EAAE,qBAAqB,CAAC,EAClC,CAAC,QAAQ,EAAE,gBAAgB,CAAC,EAC5B,CAAC,OAAO,EAAE,mBAAmB,CAAC,EAC9B,CAAC,eAAe,EAAE,2BAA2B,CAAC,CAC/C,CAAC;AACF,OAAO,MAAMC,qBAAqB,GAAG,IAAID,GAAG,CAC1C,CACE,CAAC,cAAc,EAAE,2BAA2B,CAAC,EAC7C,CAAC,mBAAmB,EAAE,gCAAgC,CAAC,CAE3D,CAAC","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@ import { useEffect } from "react";
|
|
|
2
2
|
import { KeyboardController } from "../bindings";
|
|
3
3
|
import { AndroidSoftInputModes } from "../constants";
|
|
4
4
|
import { useKeyboardContext } from "../context";
|
|
5
|
-
import
|
|
5
|
+
import useSyncEffect from "./useSyncEffect";
|
|
6
6
|
export const useResizeMode = () => {
|
|
7
7
|
useEffect(() => {
|
|
8
8
|
KeyboardController.setInputMode(AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE);
|
|
@@ -21,16 +21,9 @@ export const useReanimatedKeyboardAnimation = () => {
|
|
|
21
21
|
};
|
|
22
22
|
export function useGenericKeyboardHandler(handler, deps) {
|
|
23
23
|
const context = useKeyboardContext();
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
[key]: handler
|
|
28
|
-
});
|
|
29
|
-
return () => {
|
|
30
|
-
context.setKeyboardHandlers({
|
|
31
|
-
[key]: undefined
|
|
32
|
-
});
|
|
33
|
-
};
|
|
24
|
+
useSyncEffect(() => {
|
|
25
|
+
const cleanup = context.setKeyboardHandlers(handler);
|
|
26
|
+
return () => cleanup();
|
|
34
27
|
}, deps);
|
|
35
28
|
}
|
|
36
29
|
export function useKeyboardHandler(handler, deps) {
|
|
@@ -52,16 +45,9 @@ export function useReanimatedFocusedInput() {
|
|
|
52
45
|
}
|
|
53
46
|
export function useFocusedInputHandler(handler, deps) {
|
|
54
47
|
const context = useKeyboardContext();
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
[key]: handler
|
|
59
|
-
});
|
|
60
|
-
return () => {
|
|
61
|
-
context.setInputHandlers({
|
|
62
|
-
[key]: undefined
|
|
63
|
-
});
|
|
64
|
-
};
|
|
48
|
+
useSyncEffect(() => {
|
|
49
|
+
const cleanup = context.setInputHandlers(handler);
|
|
50
|
+
return () => cleanup();
|
|
65
51
|
}, deps);
|
|
66
52
|
}
|
|
67
53
|
export * from "./useWindowDimensions";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","KeyboardController","AndroidSoftInputModes","useKeyboardContext","
|
|
1
|
+
{"version":3,"names":["useEffect","KeyboardController","AndroidSoftInputModes","useKeyboardContext","useSyncEffect","useResizeMode","setInputMode","SOFT_INPUT_ADJUST_RESIZE","setDefaultMode","useKeyboardAnimation","context","animated","useReanimatedKeyboardAnimation","reanimated","useGenericKeyboardHandler","handler","deps","cleanup","setKeyboardHandlers","useKeyboardHandler","useKeyboardController","setEnabled","enabled","useReanimatedFocusedInput","input","layout","useFocusedInputHandler","setInputHandlers"],"sources":["index.ts"],"sourcesContent":["import { useEffect } from \"react\";\n\nimport { KeyboardController } from \"../bindings\";\nimport { AndroidSoftInputModes } from \"../constants\";\nimport { useKeyboardContext } from \"../context\";\n\nimport useSyncEffect from \"./useSyncEffect\";\n\nimport type { AnimatedContext, ReanimatedContext } from \"../context\";\nimport type { FocusedInputHandler, KeyboardHandler } from \"../types\";\nimport type { DependencyList } from \"react\";\n\nexport const useResizeMode = () => {\n useEffect(() => {\n KeyboardController.setInputMode(\n AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE,\n );\n\n return () => KeyboardController.setDefaultMode();\n }, []);\n};\n\nexport const useKeyboardAnimation = (): AnimatedContext => {\n useResizeMode();\n const context = useKeyboardContext();\n\n return context.animated;\n};\n\nexport const useReanimatedKeyboardAnimation = (): ReanimatedContext => {\n useResizeMode();\n const context = useKeyboardContext();\n\n return context.reanimated;\n};\n\nexport function useGenericKeyboardHandler(\n handler: KeyboardHandler,\n deps?: DependencyList,\n) {\n const context = useKeyboardContext();\n\n useSyncEffect(() => {\n const cleanup = context.setKeyboardHandlers(handler);\n\n return () => cleanup();\n }, deps);\n}\n\nexport function useKeyboardHandler(\n handler: KeyboardHandler,\n deps?: DependencyList,\n) {\n useResizeMode();\n useGenericKeyboardHandler(handler, deps);\n}\n\nexport function useKeyboardController() {\n const context = useKeyboardContext();\n\n return { setEnabled: context.setEnabled, enabled: context.enabled };\n}\n\nexport function useReanimatedFocusedInput() {\n const context = useKeyboardContext();\n\n return { input: context.layout };\n}\n\nexport function useFocusedInputHandler(\n handler: FocusedInputHandler,\n deps?: DependencyList,\n) {\n const context = useKeyboardContext();\n\n useSyncEffect(() => {\n const cleanup = context.setInputHandlers(handler);\n\n return () => cleanup();\n }, deps);\n}\n\nexport * from \"./useWindowDimensions\";\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AAEjC,SAASC,kBAAkB,QAAQ,aAAa;AAChD,SAASC,qBAAqB,QAAQ,cAAc;AACpD,SAASC,kBAAkB,QAAQ,YAAY;AAE/C,OAAOC,aAAa,MAAM,iBAAiB;AAM3C,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;EAEpCC,aAAa,CAAC,MAAM;IAClB,MAAMa,OAAO,GAAGP,OAAO,CAACQ,mBAAmB,CAACH,OAAO,CAAC;IAEpD,OAAO,MAAME,OAAO,CAAC,CAAC;EACxB,CAAC,EAAED,IAAI,CAAC;AACV;AAEA,OAAO,SAASG,kBAAkBA,CAChCJ,OAAwB,EACxBC,IAAqB,EACrB;EACAX,aAAa,CAAC,CAAC;EACfS,yBAAyB,CAACC,OAAO,EAAEC,IAAI,CAAC;AAC1C;AAEA,OAAO,SAASI,qBAAqBA,CAAA,EAAG;EACtC,MAAMV,OAAO,GAAGP,kBAAkB,CAAC,CAAC;EAEpC,OAAO;IAAEkB,UAAU,EAAEX,OAAO,CAACW,UAAU;IAAEC,OAAO,EAAEZ,OAAO,CAACY;EAAQ,CAAC;AACrE;AAEA,OAAO,SAASC,yBAAyBA,CAAA,EAAG;EAC1C,MAAMb,OAAO,GAAGP,kBAAkB,CAAC,CAAC;EAEpC,OAAO;IAAEqB,KAAK,EAAEd,OAAO,CAACe;EAAO,CAAC;AAClC;AAEA,OAAO,SAASC,sBAAsBA,CACpCX,OAA4B,EAC5BC,IAAqB,EACrB;EACA,MAAMN,OAAO,GAAGP,kBAAkB,CAAC,CAAC;EAEpCC,aAAa,CAAC,MAAM;IAClB,MAAMa,OAAO,GAAGP,OAAO,CAACiB,gBAAgB,CAACZ,OAAO,CAAC;IAEjD,OAAO,MAAME,OAAO,CAAC,CAAC;EACxB,CAAC,EAAED,IAAI,CAAC;AACV;AAEA,cAAc,uBAAuB","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* @description
|
|
4
|
+
* Equivalent to `useEffect` but will run the effect synchronously, i. e. before render.
|
|
5
|
+
*
|
|
6
|
+
* @param {effect} - imperative function
|
|
7
|
+
* @param {deps} - if present, effect will only activate if the values in the list change
|
|
8
|
+
*
|
|
9
|
+
* @author Kiryl Ziusko
|
|
10
|
+
* @since 1.13.0
|
|
11
|
+
* @version 1.0.0
|
|
12
|
+
*/
|
|
13
|
+
const useSyncEffect = (effect, deps) => {
|
|
14
|
+
const cachedDeps = useRef(null);
|
|
15
|
+
const areDepsEqual = deps === null || deps === void 0 ? void 0 : deps.every((el, index) => cachedDeps.current && el === cachedDeps.current[index]);
|
|
16
|
+
const cleanupRef = useRef();
|
|
17
|
+
if (!areDepsEqual || !cachedDeps.current) {
|
|
18
|
+
var _cleanupRef$current;
|
|
19
|
+
(_cleanupRef$current = cleanupRef.current) === null || _cleanupRef$current === void 0 || _cleanupRef$current.call(cleanupRef);
|
|
20
|
+
cleanupRef.current = effect();
|
|
21
|
+
cachedDeps.current = deps;
|
|
22
|
+
}
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
return () => {
|
|
25
|
+
var _cleanupRef$current2;
|
|
26
|
+
(_cleanupRef$current2 = cleanupRef.current) === null || _cleanupRef$current2 === void 0 || _cleanupRef$current2.call(cleanupRef);
|
|
27
|
+
};
|
|
28
|
+
}, []);
|
|
29
|
+
};
|
|
30
|
+
export default useSyncEffect;
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","useSyncEffect","effect","deps","cachedDeps","areDepsEqual","every","el","index","current","cleanupRef","_cleanupRef$current","call","_cleanupRef$current2"],"sources":["index.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\n\nimport type { DependencyList } from \"react\";\n\n/**\n * @description\n * Equivalent to `useEffect` but will run the effect synchronously, i. e. before render.\n *\n * @param {effect} - imperative function\n * @param {deps} - if present, effect will only activate if the values in the list change\n *\n * @author Kiryl Ziusko\n * @since 1.13.0\n * @version 1.0.0\n */\nconst useSyncEffect: typeof useEffect = (effect, deps) => {\n const cachedDeps = useRef<DependencyList | undefined | null>(null);\n const areDepsEqual = deps?.every(\n (el, index) => cachedDeps.current && el === cachedDeps.current[index],\n );\n const cleanupRef = useRef<(() => void) | void>();\n\n if (!areDepsEqual || !cachedDeps.current) {\n cleanupRef.current?.();\n cleanupRef.current = effect();\n cachedDeps.current = deps;\n }\n\n useEffect(() => {\n return () => {\n cleanupRef.current?.();\n };\n }, []);\n};\n\nexport default useSyncEffect;\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAIzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,aAA+B,GAAGA,CAACC,MAAM,EAAEC,IAAI,KAAK;EACxD,MAAMC,UAAU,GAAGJ,MAAM,CAAoC,IAAI,CAAC;EAClE,MAAMK,YAAY,GAAGF,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEG,KAAK,CAC9B,CAACC,EAAE,EAAEC,KAAK,KAAKJ,UAAU,CAACK,OAAO,IAAIF,EAAE,KAAKH,UAAU,CAACK,OAAO,CAACD,KAAK,CACtE,CAAC;EACD,MAAME,UAAU,GAAGV,MAAM,CAAsB,CAAC;EAEhD,IAAI,CAACK,YAAY,IAAI,CAACD,UAAU,CAACK,OAAO,EAAE;IAAA,IAAAE,mBAAA;IACxC,CAAAA,mBAAA,GAAAD,UAAU,CAACD,OAAO,cAAAE,mBAAA,eAAlBA,mBAAA,CAAAC,IAAA,CAAAF,UAAqB,CAAC;IACtBA,UAAU,CAACD,OAAO,GAAGP,MAAM,CAAC,CAAC;IAC7BE,UAAU,CAACK,OAAO,GAAGN,IAAI;EAC3B;EAEAJ,SAAS,CAAC,MAAM;IACd,OAAO,MAAM;MAAA,IAAAc,oBAAA;MACX,CAAAA,oBAAA,GAAAH,UAAU,CAACD,OAAO,cAAAI,oBAAA,eAAlBA,oBAAA,CAAAD,IAAA,CAAAF,UAAqB,CAAC;IACxB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;AACR,CAAC;AAED,eAAeT,aAAa","ignoreList":[]}
|
package/lib/module/internal.js
CHANGED
|
@@ -1,50 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Animated } from "react-native";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* }
|
|
14
|
-
*/
|
|
15
|
-
export function useSharedHandlers() {
|
|
16
|
-
const handlers = useSharedValue({});
|
|
17
|
-
const jsHandlers = useRef({});
|
|
1
|
+
import { useRef } from "react";
|
|
2
|
+
import { Animated, findNodeHandle } from "react-native";
|
|
3
|
+
import { registerEventHandler, unregisterEventHandler } from "./event-handler";
|
|
4
|
+
export function useEventHandlerRegistration(map, viewTagRef) {
|
|
5
|
+
const onRegisterHandler = handler => {
|
|
6
|
+
const viewTag = findNodeHandle(viewTagRef.current);
|
|
7
|
+
const ids = Object.keys(handler).map(handlerName => {
|
|
8
|
+
const eventName = map.get(handlerName);
|
|
9
|
+
const functionToCall = handler[handlerName];
|
|
10
|
+
if (eventName && viewTag) {
|
|
11
|
+
return registerEventHandler(event => {
|
|
12
|
+
"worklet";
|
|
18
13
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// Below we are writing all handlers to `ref` and afterwards synchronize them with
|
|
24
|
-
// shared value (since `refs` are not referring to actual value in worklets).
|
|
25
|
-
// This approach allow us to update synchronously handlers in js thread (and it assures,
|
|
26
|
-
// that it will have all of them) and then update them in worklet thread (calls are
|
|
27
|
-
// happening in FIFO order, so we will always have actual value).
|
|
28
|
-
const updateSharedHandlers = () => {
|
|
29
|
-
// eslint-disable-next-line react-compiler/react-compiler
|
|
30
|
-
handlers.value = jsHandlers.current;
|
|
31
|
-
};
|
|
32
|
-
const setHandlers = useCallback(handler => {
|
|
33
|
-
jsHandlers.current = {
|
|
34
|
-
...jsHandlers.current,
|
|
35
|
-
...handler
|
|
36
|
-
};
|
|
37
|
-
updateSharedHandlers();
|
|
38
|
-
}, []);
|
|
39
|
-
const broadcast = (type, event) => {
|
|
40
|
-
"worklet";
|
|
41
|
-
|
|
42
|
-
Object.keys(handlers.value).forEach(key => {
|
|
43
|
-
var _handlers$value$key, _handlers$value$key$t;
|
|
44
|
-
(_handlers$value$key = handlers.value[key]) === null || _handlers$value$key === void 0 || (_handlers$value$key$t = _handlers$value$key[type]) === null || _handlers$value$key$t === void 0 || _handlers$value$key$t.call(_handlers$value$key, event);
|
|
14
|
+
functionToCall === null || functionToCall === void 0 || functionToCall(event);
|
|
15
|
+
}, eventName, viewTag);
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
45
18
|
});
|
|
19
|
+
return () => {
|
|
20
|
+
ids.forEach(id => id ? unregisterEventHandler(id) : null);
|
|
21
|
+
};
|
|
46
22
|
};
|
|
47
|
-
return
|
|
23
|
+
return onRegisterHandler;
|
|
48
24
|
}
|
|
49
25
|
|
|
50
26
|
/**
|
|
@@ -58,7 +34,7 @@ export function useSharedHandlers() {
|
|
|
58
34
|
*/
|
|
59
35
|
export function useAnimatedValue(initialValue, config) {
|
|
60
36
|
const ref = useRef(null);
|
|
61
|
-
if (ref.current
|
|
37
|
+
if (ref.current === null) {
|
|
62
38
|
ref.current = new Animated.Value(initialValue, config);
|
|
63
39
|
}
|
|
64
40
|
return ref.current;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useRef","Animated","findNodeHandle","registerEventHandler","unregisterEventHandler","useEventHandlerRegistration","map","viewTagRef","onRegisterHandler","handler","viewTag","current","ids","Object","keys","handlerName","eventName","get","functionToCall","event","forEach","id","useAnimatedValue","initialValue","config","ref","Value"],"sources":["internal.ts"],"sourcesContent":["import { useRef } from \"react\";\nimport { Animated, findNodeHandle } from \"react-native\";\n\nimport { registerEventHandler, unregisterEventHandler } from \"./event-handler\";\n\ntype EventHandler = (event: never) => void;\ntype ComponentOrHandle = Parameters<typeof findNodeHandle>[0];\n\nexport function useEventHandlerRegistration<\n H extends Partial<Record<string, EventHandler>>,\n>(\n map: Map<keyof H, string>,\n viewTagRef: React.MutableRefObject<ComponentOrHandle>,\n) {\n const onRegisterHandler = (handler: H) => {\n const viewTag = findNodeHandle(viewTagRef.current);\n const ids = Object.keys(handler).map((handlerName) => {\n const eventName = map.get(handlerName as keyof H);\n const functionToCall = handler[handlerName as keyof H];\n\n if (eventName && viewTag) {\n return registerEventHandler(\n (event: Parameters<NonNullable<H[keyof H]>>[0]) => {\n \"worklet\";\n\n functionToCall?.(event);\n },\n eventName,\n viewTag,\n );\n }\n\n return null;\n });\n\n return () => {\n ids.forEach((id) => (id ? unregisterEventHandler(id) : null));\n };\n };\n\n return onRegisterHandler;\n}\n\n/**\n * TS variant of `useAnimatedValue` hook which is added in RN 0.71\n * A better alternative of storing animated values in refs, since\n * it doesn't recreate a new `Animated.Value` object on every re-render\n * and therefore consumes less memory. We can not use a variant from\n * RN, since this library supports earlier versions of RN.\n *\n * @see https://github.com/facebook/react-native/commit/e22217fe8b9455e32695f88ca835e11442b0a937\n */\nexport function useAnimatedValue(\n initialValue: number,\n config?: Animated.AnimatedConfig,\n): Animated.Value {\n const ref = useRef<Animated.Value | null>(null);\n\n if (ref.current === null) {\n ref.current = new Animated.Value(initialValue, config);\n }\n\n return ref.current;\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,OAAO;AAC9B,SAASC,QAAQ,EAAEC,cAAc,QAAQ,cAAc;AAEvD,SAASC,oBAAoB,EAAEC,sBAAsB,QAAQ,iBAAiB;AAK9E,OAAO,SAASC,2BAA2BA,CAGzCC,GAAyB,EACzBC,UAAqD,EACrD;EACA,MAAMC,iBAAiB,GAAIC,OAAU,IAAK;IACxC,MAAMC,OAAO,GAAGR,cAAc,CAACK,UAAU,CAACI,OAAO,CAAC;IAClD,MAAMC,GAAG,GAAGC,MAAM,CAACC,IAAI,CAACL,OAAO,CAAC,CAACH,GAAG,CAAES,WAAW,IAAK;MACpD,MAAMC,SAAS,GAAGV,GAAG,CAACW,GAAG,CAACF,WAAsB,CAAC;MACjD,MAAMG,cAAc,GAAGT,OAAO,CAACM,WAAW,CAAY;MAEtD,IAAIC,SAAS,IAAIN,OAAO,EAAE;QACxB,OAAOP,oBAAoB,CACxBgB,KAA6C,IAAK;UACjD,SAAS;;UAETD,cAAc,aAAdA,cAAc,eAAdA,cAAc,CAAGC,KAAK,CAAC;QACzB,CAAC,EACDH,SAAS,EACTN,OACF,CAAC;MACH;MAEA,OAAO,IAAI;IACb,CAAC,CAAC;IAEF,OAAO,MAAM;MACXE,GAAG,CAACQ,OAAO,CAAEC,EAAE,IAAMA,EAAE,GAAGjB,sBAAsB,CAACiB,EAAE,CAAC,GAAG,IAAK,CAAC;IAC/D,CAAC;EACH,CAAC;EAED,OAAOb,iBAAiB;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASc,gBAAgBA,CAC9BC,YAAoB,EACpBC,MAAgC,EAChB;EAChB,MAAMC,GAAG,GAAGzB,MAAM,CAAwB,IAAI,CAAC;EAE/C,IAAIyB,GAAG,CAACd,OAAO,KAAK,IAAI,EAAE;IACxBc,GAAG,CAACd,OAAO,GAAG,IAAIV,QAAQ,CAACyB,KAAK,CAACH,YAAY,EAAEC,MAAM,CAAC;EACxD;EAEA,OAAOC,GAAG,CAACd,OAAO;AACpB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NOOP","applyMonkeyPatch","revertMonkeyPatch"],"sources":["monkey-patch.ts"],"sourcesContent":["// stub for all platforms\nconst NOOP = () => {};\nexport const applyMonkeyPatch = NOOP;\nexport const revertMonkeyPatch = NOOP;\n"],"mappings":"AAAA;AACA,MAAMA,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"names":["NOOP","applyMonkeyPatch","revertMonkeyPatch"],"sources":["monkey-patch.ts"],"sourcesContent":["// stub for all platforms\nconst NOOP = () => {};\n\nexport const applyMonkeyPatch = NOOP;\nexport const revertMonkeyPatch = NOOP;\n"],"mappings":"AAAA;AACA,MAAMA,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,OAAO,MAAMC,gBAAgB,GAAGD,IAAI;AACpC,OAAO,MAAME,iBAAiB,GAAGF,IAAI","ignoreList":[]}
|
package/lib/module/reanimated.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
const NOOP = () => () => {};
|
|
2
2
|
export const useAnimatedKeyboardHandler = NOOP;
|
|
3
3
|
export const useFocusedInputLayoutHandler = NOOP;
|
|
4
|
-
export const useFocusedInputTextHandler = NOOP;
|
|
5
|
-
export const useFocusedInputSelectionHandler = NOOP;
|
|
6
4
|
//# sourceMappingURL=reanimated.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NOOP","useAnimatedKeyboardHandler","useFocusedInputLayoutHandler"
|
|
1
|
+
{"version":3,"names":["NOOP","useAnimatedKeyboardHandler","useFocusedInputLayoutHandler"],"sources":["reanimated.ts"],"sourcesContent":["import type {\n EventWithName,\n FocusedInputLayoutChangedEvent,\n FocusedInputLayoutHandlerHook,\n KeyboardHandlerHook,\n NativeEvent,\n} from \"./types\";\n\nconst NOOP = () => () => {};\n\nexport const useAnimatedKeyboardHandler: KeyboardHandlerHook<\n Record<string, unknown>,\n EventWithName<NativeEvent>\n> = NOOP;\nexport const useFocusedInputLayoutHandler: FocusedInputLayoutHandlerHook<\n Record<string, unknown>,\n EventWithName<FocusedInputLayoutChangedEvent>\n> = NOOP;\n"],"mappings":"AAQA,MAAMA,IAAI,GAAGA,CAAA,KAAM,MAAM,CAAC,CAAC;AAE3B,OAAO,MAAMC,0BAGZ,GAAGD,IAAI;AACR,OAAO,MAAME,4BAGZ,GAAGF,IAAI","ignoreList":[]}
|
|
@@ -43,36 +43,4 @@ export const useFocusedInputLayoutHandler = (handlers, dependencies) => {
|
|
|
43
43
|
}
|
|
44
44
|
}, ["onFocusedInputLayoutChanged"], doDependenciesDiffer);
|
|
45
45
|
};
|
|
46
|
-
export const useFocusedInputTextHandler = (handlers, dependencies) => {
|
|
47
|
-
const {
|
|
48
|
-
context,
|
|
49
|
-
doDependenciesDiffer
|
|
50
|
-
} = useHandler(handlers, dependencies);
|
|
51
|
-
return useEvent(event => {
|
|
52
|
-
"worklet";
|
|
53
|
-
|
|
54
|
-
const {
|
|
55
|
-
onFocusedInputTextChanged
|
|
56
|
-
} = handlers;
|
|
57
|
-
if (onFocusedInputTextChanged && event.eventName.endsWith("onFocusedInputTextChanged")) {
|
|
58
|
-
onFocusedInputTextChanged(event, context);
|
|
59
|
-
}
|
|
60
|
-
}, ["onFocusedInputTextChanged"], doDependenciesDiffer);
|
|
61
|
-
};
|
|
62
|
-
export const useFocusedInputSelectionHandler = (handlers, dependencies) => {
|
|
63
|
-
const {
|
|
64
|
-
context,
|
|
65
|
-
doDependenciesDiffer
|
|
66
|
-
} = useHandler(handlers, dependencies);
|
|
67
|
-
return useEvent(event => {
|
|
68
|
-
"worklet";
|
|
69
|
-
|
|
70
|
-
const {
|
|
71
|
-
onFocusedInputSelectionChanged
|
|
72
|
-
} = handlers;
|
|
73
|
-
if (onFocusedInputSelectionChanged && event.eventName.endsWith("onFocusedInputSelectionChanged")) {
|
|
74
|
-
onFocusedInputSelectionChanged(event, context);
|
|
75
|
-
}
|
|
76
|
-
}, ["onFocusedInputSelectionChanged"], doDependenciesDiffer);
|
|
77
|
-
};
|
|
78
46
|
//# sourceMappingURL=reanimated.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEvent","useHandler","useAnimatedKeyboardHandler","handlers","dependencies","context","doDependenciesDiffer","event","onKeyboardMoveStart","onKeyboardMove","onKeyboardMoveEnd","onKeyboardMoveInteractive","eventName","endsWith","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged"
|
|
1
|
+
{"version":3,"names":["useEvent","useHandler","useAnimatedKeyboardHandler","handlers","dependencies","context","doDependenciesDiffer","event","onKeyboardMoveStart","onKeyboardMove","onKeyboardMoveEnd","onKeyboardMoveInteractive","eventName","endsWith","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged"],"sources":["reanimated.native.ts"],"sourcesContent":["import { useEvent, useHandler } from \"react-native-reanimated\";\n\nimport type {\n EventWithName,\n FocusedInputLayoutChangedEvent,\n FocusedInputLayoutHandlerHook,\n KeyboardHandlerHook,\n NativeEvent,\n} from \"./types\";\n\ntype EventContext = Record<string, unknown>;\n\nexport const useAnimatedKeyboardHandler: KeyboardHandlerHook<\n EventContext,\n EventWithName<NativeEvent>\n> = (handlers, dependencies) => {\n const { context, doDependenciesDiffer } = useHandler(handlers, dependencies);\n\n return useEvent(\n (event) => {\n \"worklet\";\n const {\n onKeyboardMoveStart,\n onKeyboardMove,\n onKeyboardMoveEnd,\n onKeyboardMoveInteractive,\n } = handlers;\n\n if (\n onKeyboardMoveStart &&\n event.eventName.endsWith(\"onKeyboardMoveStart\")\n ) {\n onKeyboardMoveStart(event, context);\n }\n\n if (onKeyboardMove && event.eventName.endsWith(\"onKeyboardMove\")) {\n onKeyboardMove(event, context);\n }\n\n if (onKeyboardMoveEnd && event.eventName.endsWith(\"onKeyboardMoveEnd\")) {\n onKeyboardMoveEnd(event, context);\n }\n\n if (\n onKeyboardMoveInteractive &&\n event.eventName.endsWith(\"onKeyboardMoveInteractive\")\n ) {\n onKeyboardMoveInteractive(event, context);\n }\n },\n [\n \"onKeyboardMoveStart\",\n \"onKeyboardMove\",\n \"onKeyboardMoveEnd\",\n \"onKeyboardMoveInteractive\",\n ],\n doDependenciesDiffer,\n );\n};\n\nexport const useFocusedInputLayoutHandler: FocusedInputLayoutHandlerHook<\n EventContext,\n EventWithName<FocusedInputLayoutChangedEvent>\n> = (handlers, dependencies) => {\n const { context, doDependenciesDiffer } = useHandler(handlers, dependencies);\n\n return useEvent(\n (event) => {\n \"worklet\";\n const { onFocusedInputLayoutChanged } = handlers;\n\n if (\n onFocusedInputLayoutChanged &&\n event.eventName.endsWith(\"onFocusedInputLayoutChanged\")\n ) {\n onFocusedInputLayoutChanged(event, context);\n }\n },\n [\"onFocusedInputLayoutChanged\"],\n doDependenciesDiffer,\n );\n};\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,UAAU,QAAQ,yBAAyB;AAY9D,OAAO,MAAMC,0BAGZ,GAAGA,CAACC,QAAQ,EAAEC,YAAY,KAAK;EAC9B,MAAM;IAAEC,OAAO;IAAEC;EAAqB,CAAC,GAAGL,UAAU,CAACE,QAAQ,EAAEC,YAAY,CAAC;EAE5E,OAAOJ,QAAQ,CACZO,KAAK,IAAK;IACT,SAAS;;IACT,MAAM;MACJC,mBAAmB;MACnBC,cAAc;MACdC,iBAAiB;MACjBC;IACF,CAAC,GAAGR,QAAQ;IAEZ,IACEK,mBAAmB,IACnBD,KAAK,CAACK,SAAS,CAACC,QAAQ,CAAC,qBAAqB,CAAC,EAC/C;MACAL,mBAAmB,CAACD,KAAK,EAAEF,OAAO,CAAC;IACrC;IAEA,IAAII,cAAc,IAAIF,KAAK,CAACK,SAAS,CAACC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;MAChEJ,cAAc,CAACF,KAAK,EAAEF,OAAO,CAAC;IAChC;IAEA,IAAIK,iBAAiB,IAAIH,KAAK,CAACK,SAAS,CAACC,QAAQ,CAAC,mBAAmB,CAAC,EAAE;MACtEH,iBAAiB,CAACH,KAAK,EAAEF,OAAO,CAAC;IACnC;IAEA,IACEM,yBAAyB,IACzBJ,KAAK,CAACK,SAAS,CAACC,QAAQ,CAAC,2BAA2B,CAAC,EACrD;MACAF,yBAAyB,CAACJ,KAAK,EAAEF,OAAO,CAAC;IAC3C;EACF,CAAC,EACD,CACE,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,2BAA2B,CAC5B,EACDC,oBACF,CAAC;AACH,CAAC;AAED,OAAO,MAAMQ,4BAGZ,GAAGA,CAACX,QAAQ,EAAEC,YAAY,KAAK;EAC9B,MAAM;IAAEC,OAAO;IAAEC;EAAqB,CAAC,GAAGL,UAAU,CAACE,QAAQ,EAAEC,YAAY,CAAC;EAE5E,OAAOJ,QAAQ,CACZO,KAAK,IAAK;IACT,SAAS;;IACT,MAAM;MAAEQ;IAA4B,CAAC,GAAGZ,QAAQ;IAEhD,IACEY,2BAA2B,IAC3BR,KAAK,CAACK,SAAS,CAACC,QAAQ,CAAC,6BAA6B,CAAC,EACvD;MACAE,2BAA2B,CAACR,KAAK,EAAEF,OAAO,CAAC;IAC7C;EACF,CAAC,EACD,CAAC,6BAA6B,CAAC,EAC/BC,oBACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["codegenNativeComponent","excludedPlatforms"],"sources":["KeyboardGestureAreaNativeComponent.ts"],"sourcesContent":["import codegenNativeComponent from \"react-native/Libraries/Utilities/codegenNativeComponent\";\n\nimport type { HostComponent } from \"react-native\";\nimport type { ViewProps } from \"react-native/Libraries/Components/View/ViewPropTypes\";\nimport type {
|
|
1
|
+
{"version":3,"names":["codegenNativeComponent","excludedPlatforms"],"sources":["KeyboardGestureAreaNativeComponent.ts"],"sourcesContent":["import codegenNativeComponent from \"react-native/Libraries/Utilities/codegenNativeComponent\";\n\nimport type { HostComponent } from \"react-native\";\nimport type { ViewProps } from \"react-native/Libraries/Components/View/ViewPropTypes\";\nimport type {\n Double,\n WithDefault,\n} from \"react-native/Libraries/Types/CodegenTypes\";\n\nexport interface NativeProps extends ViewProps {\n interpolator?: WithDefault<\"linear\" | \"ios\", \"linear\">;\n showOnSwipeUp?: boolean;\n enableSwipeToDismiss?: boolean;\n offset?: Double;\n}\n\nexport default codegenNativeComponent<NativeProps>(\"KeyboardGestureArea\", {\n excludedPlatforms: [\"iOS\"],\n}) as HostComponent<NativeProps>;\n"],"mappings":"AAAA,OAAOA,sBAAsB,MAAM,yDAAyD;AAgB5F,eAAeA,sBAAsB,CAAc,qBAAqB,EAAE;EACxEC,iBAAiB,EAAE,CAAC,KAAK;AAC3B,CAAC,CAAC","ignoreList":[]}
|