@hoddy-ui/core 2.5.9 → 2.5.11

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.
@@ -890,13 +890,13 @@ import Animated2, {
890
890
  useSharedValue as useSharedValue2,
891
891
  withTiming as withTiming2
892
892
  } from "react-native-reanimated";
893
- import { ms as ms5, ScaledSheet as ScaledSheet7 } from "react-native-size-matters";
894
893
  import { useSafeAreaInsets as useSafeAreaInsets2 } from "react-native-safe-area-context";
894
+ import { ms as ms5, ScaledSheet as ScaledSheet7 } from "react-native-size-matters";
895
895
  var Popup = ({
896
896
  title,
897
897
  sheet,
898
898
  bare = false,
899
- keyboardVerticalOffset = -10,
899
+ keyboardVerticalOffset,
900
900
  children,
901
901
  open,
902
902
  onClose = () => {
@@ -908,9 +908,29 @@ var Popup = ({
908
908
  const theme = useTheme();
909
909
  const colors2 = useColors();
910
910
  const [modalVisible, setModalVisible] = useState3(false);
911
+ const [keyboardVisible, setKeyboardVisible] = useState3(false);
911
912
  const { bottom } = useSafeAreaInsets2();
912
913
  const backdropOpacity = useSharedValue2(0);
913
914
  const contentTranslateY = useSharedValue2(1e3);
915
+ const keyboardVerticalOffsetValue = Platform5.OS === "ios" ? -bottom : -bottom * 2;
916
+ useEffect2(() => {
917
+ const keyboardDidShowListener = Keyboard2.addListener(
918
+ "keyboardDidShow",
919
+ () => {
920
+ setKeyboardVisible(true);
921
+ }
922
+ );
923
+ const keyboardDidHideListener = Keyboard2.addListener(
924
+ "keyboardDidHide",
925
+ () => {
926
+ setKeyboardVisible(false);
927
+ }
928
+ );
929
+ return () => {
930
+ keyboardDidHideListener?.remove();
931
+ keyboardDidShowListener?.remove();
932
+ };
933
+ }, []);
914
934
  useEffect2(() => {
915
935
  if (open) {
916
936
  setModalVisible(true);
@@ -943,15 +963,17 @@ var Popup = ({
943
963
  justifyContent: sheet ? "flex-end" : "center"
944
964
  },
945
965
  keyboardView: {
946
- flex: 1
966
+ flex: 1,
967
+ zIndex: 1e3
947
968
  },
948
969
  avoidingView: {
970
+ zIndex: 2,
949
971
  minHeight: typeof sheet === "number" ? sheet : void 0,
950
972
  maxHeight: "90%",
951
- zIndex: 1e3,
952
973
  alignSelf: "center",
953
974
  maxWidth: sheet ? void 0 : "90%",
954
- width: sheet ? "100%" : void 0
975
+ width: sheet ? "100%" : void 0,
976
+ marginBottom: Platform5.OS === "android" && keyboardVisible ? bottom : 0
955
977
  },
956
978
  container: {
957
979
  paddingBottom: sheet && !bare ? bottom + ms5(10) : void 0,
@@ -997,40 +1019,33 @@ var Popup = ({
997
1019
  visible: modalVisible,
998
1020
  onRequestClose: closeAction
999
1021
  },
1000
- /* @__PURE__ */ React11.createElement(UIThemeProvider, null, /* @__PURE__ */ React11.createElement(
1022
+ /* @__PURE__ */ React11.createElement(UIThemeProvider, null, /* @__PURE__ */ React11.createElement(Animated2.View, { style: [styles2.backdrop, backdropAnimatedStyle] }), /* @__PURE__ */ React11.createElement(
1001
1023
  KeyboardAvoidingView2,
1002
1024
  {
1003
1025
  style: styles2.keyboardView,
1004
1026
  behavior: Platform5.OS === "ios" ? "padding" : "height",
1005
- keyboardVerticalOffset
1027
+ keyboardVerticalOffset: keyboardVerticalOffset || keyboardVerticalOffsetValue
1006
1028
  },
1007
- /* @__PURE__ */ React11.createElement(TouchableWithoutFeedback2, { onPress: Keyboard2.dismiss }, /* @__PURE__ */ React11.createElement(View5, { style: styles2.root }, /* @__PURE__ */ React11.createElement(Animated2.View, { style: [styles2.backdrop, backdropAnimatedStyle] }), open && /* @__PURE__ */ React11.createElement(
1029
+ /* @__PURE__ */ React11.createElement(TouchableWithoutFeedback2, { onPress: Keyboard2.dismiss }, /* @__PURE__ */ React11.createElement(View5, { style: styles2.root }, open && /* @__PURE__ */ React11.createElement(
1008
1030
  Pressable,
1009
1031
  {
1010
- style: [StyleSheet2.absoluteFill, { zIndex: 2 }],
1032
+ style: [StyleSheet2.absoluteFill, { zIndex: 1 }],
1011
1033
  onPress: closeAction
1012
1034
  }
1013
1035
  ), /* @__PURE__ */ React11.createElement(
1014
1036
  Animated2.View,
1015
1037
  {
1016
1038
  style: [styles2.avoidingView, contentAnimatedStyle],
1017
- layout: LinearTransition
1039
+ layout: LinearTransition.springify().stiffness(200).mass(0.5).damping(100)
1018
1040
  },
1019
- /* @__PURE__ */ React11.createElement(
1020
- Animated2.View,
1041
+ /* @__PURE__ */ React11.createElement(View5, { style: styles2.container }, !bare && /* @__PURE__ */ React11.createElement(View5, { style: styles2.title }, /* @__PURE__ */ React11.createElement(View5, { style: styles2.titleIcon }, /* @__PURE__ */ React11.createElement(
1042
+ IconButton,
1021
1043
  {
1022
- style: styles2.container
1023
- },
1024
- !bare && /* @__PURE__ */ React11.createElement(View5, { style: styles2.title }, /* @__PURE__ */ React11.createElement(View5, { style: styles2.titleIcon }, /* @__PURE__ */ React11.createElement(
1025
- IconButton,
1026
- {
1027
- size: 20,
1028
- icon: "close",
1029
- onPress: closeAction
1030
- }
1031
- )), /* @__PURE__ */ React11.createElement(Typography_default, { align: "center", fontWeight: 500 }, title)),
1032
- /* @__PURE__ */ React11.createElement(View5, { style: styles2.content }, children)
1033
- )
1044
+ size: 20,
1045
+ icon: "close",
1046
+ onPress: closeAction
1047
+ }
1048
+ )), /* @__PURE__ */ React11.createElement(Typography_default, { align: "center", fontWeight: 500 }, title)), /* @__PURE__ */ React11.createElement(View5, { style: styles2.content }, children))
1034
1049
  )))
1035
1050
  ))
1036
1051
  );