@kaushverse/pickify 1.1.12 → 1.1.15

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/dist/index.d.mts CHANGED
@@ -151,10 +151,16 @@ type Props = {
151
151
  styles?: FloatingButtonStyles;
152
152
  style?: ViewStyle;
153
153
  mainIconName?: string;
154
+ spacing?: number;
155
+ animationDuration?: number;
156
+ buttonSize?: number;
157
+ secondaryButtonSize?: number;
154
158
  };
155
159
  declare class FloatingButton extends React$1.Component<Props> {
156
160
  animation: Animated.Value;
157
- open: boolean;
161
+ state: {
162
+ open: boolean;
163
+ };
158
164
  toggleMenu: () => void;
159
165
  renderAction: (action: Action, index: number) => react_jsx_runtime.JSX.Element;
160
166
  render(): react_jsx_runtime.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -151,10 +151,16 @@ type Props = {
151
151
  styles?: FloatingButtonStyles;
152
152
  style?: ViewStyle;
153
153
  mainIconName?: string;
154
+ spacing?: number;
155
+ animationDuration?: number;
156
+ buttonSize?: number;
157
+ secondaryButtonSize?: number;
154
158
  };
155
159
  declare class FloatingButton extends React$1.Component<Props> {
156
160
  animation: Animated.Value;
157
- open: boolean;
161
+ state: {
162
+ open: boolean;
163
+ };
158
164
  toggleMenu: () => void;
159
165
  renderAction: (action: Action, index: number) => react_jsx_runtime.JSX.Element;
160
166
  render(): react_jsx_runtime.JSX.Element;
package/dist/index.js CHANGED
@@ -720,46 +720,49 @@ var defaultStyles3 = import_react_native4.StyleSheet.create({
720
720
  // src/core/FloatingButton.tsx
721
721
  var import_react4 = __toESM(require("react"));
722
722
  var import_react_native5 = require("react-native");
723
+ var import_vector_icons = require("@expo/vector-icons");
723
724
  var import_jsx_runtime5 = require("react/jsx-runtime");
724
725
  var FloatingButton = class extends import_react4.default.Component {
725
726
  animation = new import_react_native5.Animated.Value(0);
726
- open = false;
727
+ state = {
728
+ open: false
729
+ };
727
730
  toggleMenu = () => {
731
+ const toValue = this.state.open ? 0 : 1;
728
732
  import_react_native5.Animated.spring(this.animation, {
729
- toValue: this.open ? 0 : 1,
733
+ toValue,
730
734
  useNativeDriver: true,
731
- damping: 12,
732
- mass: 0.6,
733
- stiffness: 180
735
+ stiffness: 250,
736
+ damping: 20,
737
+ mass: 1
734
738
  }).start();
735
- this.open = !this.open;
739
+ this.setState({ open: !this.state.open });
736
740
  };
737
741
  renderAction = (action, index) => {
738
742
  const {
739
743
  mode = "vertical",
740
- radius = 100,
744
+ radius = 90,
741
745
  actions,
742
746
  renderItemIcon,
743
- styles: styles2
747
+ styles: styles2,
748
+ spacing = 65,
749
+ secondaryButtonSize = 48
744
750
  } = this.props;
745
751
  let translateX = 0;
746
752
  let translateY = 0;
747
753
  if (mode === "vertical") {
748
- translateY = -70 * (index + 1);
749
- translateX = 0;
754
+ translateY = -spacing * (index + 1);
750
755
  }
751
756
  if (mode === "horizontal") {
752
- translateX = -70 * (index + 1);
753
- translateY = 0;
757
+ translateX = -spacing * (index + 1);
754
758
  }
755
759
  if (mode === "circle") {
756
760
  const totalActions = actions.length;
757
- const startAngle = -Math.PI / 3;
758
- const endAngle = -Math.PI * 0.8;
761
+ const startAngle = -Math.PI / 2.5;
762
+ const endAngle = -Math.PI * 0.7;
759
763
  const angle = startAngle + index / (totalActions - 1 || 1) * (endAngle - startAngle);
760
- const adjustedRadius = radius * 0.65;
761
- translateX = adjustedRadius * Math.cos(angle);
762
- translateY = adjustedRadius * Math.sin(angle);
764
+ translateX = radius * Math.cos(angle);
765
+ translateY = radius * Math.sin(angle);
763
766
  }
764
767
  const animStyle = {
765
768
  transform: [
@@ -777,20 +780,25 @@ var FloatingButton = class extends import_react4.default.Component {
777
780
  },
778
781
  {
779
782
  scale: this.animation.interpolate({
780
- inputRange: [0, 0.5, 1],
781
- outputRange: [0, 1.2, 1]
783
+ inputRange: [0, 0.3, 0.7, 1],
784
+ outputRange: [0, 1.1, 0.95, 1]
782
785
  })
783
786
  }
784
787
  ],
785
- opacity: this.animation
788
+ opacity: this.animation.interpolate({
789
+ inputRange: [0, 0.2, 1],
790
+ outputRange: [0, 0.8, 1]
791
+ })
786
792
  };
787
793
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
788
794
  import_react_native5.TouchableWithoutFeedback,
789
795
  {
790
796
  onPress: () => {
791
797
  this.toggleMenu();
792
- action.onPress?.();
793
- action.navigateTo?.();
798
+ setTimeout(() => {
799
+ action.onPress?.();
800
+ action.navigateTo?.();
801
+ }, 100);
794
802
  },
795
803
  children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
796
804
  import_react_native5.Animated.View,
@@ -798,14 +806,26 @@ var FloatingButton = class extends import_react4.default.Component {
798
806
  style: [
799
807
  defaultStyles4.secondary,
800
808
  styles2?.secondaryButton,
801
- { backgroundColor: action.color || "#F02A4B" },
809
+ {
810
+ backgroundColor: action.color || "#F02A4B",
811
+ width: secondaryButtonSize,
812
+ height: secondaryButtonSize,
813
+ borderRadius: secondaryButtonSize / 2
814
+ },
802
815
  animStyle
803
816
  ],
804
- children: renderItemIcon?.({
817
+ children: renderItemIcon ? renderItemIcon({
805
818
  name: action.icon,
806
- size: 20,
819
+ size: secondaryButtonSize * 0.42,
807
820
  color: action.iconColor || "#FFF"
808
- })
821
+ }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
822
+ import_vector_icons.Ionicons,
823
+ {
824
+ name: action.icon,
825
+ size: secondaryButtonSize * 0.42,
826
+ color: action.iconColor || "#FFF"
827
+ }
828
+ )
809
829
  }
810
830
  )
811
831
  },
@@ -813,7 +833,14 @@ var FloatingButton = class extends import_react4.default.Component {
813
833
  );
814
834
  };
815
835
  render() {
816
- const { actions, renderMainIcon, styles: styles2, style, mainIconName } = this.props;
836
+ const {
837
+ actions,
838
+ renderMainIcon,
839
+ styles: styles2,
840
+ style,
841
+ mainIconName,
842
+ buttonSize = 56
843
+ } = this.props;
817
844
  const rotation = {
818
845
  transform: [
819
846
  {
@@ -824,48 +851,57 @@ var FloatingButton = class extends import_react4.default.Component {
824
851
  }
825
852
  ]
826
853
  };
827
- const scale = {
854
+ const mainScale = {
828
855
  transform: [
829
856
  {
830
857
  scale: this.animation.interpolate({
831
858
  inputRange: [0, 0.5, 1],
832
- outputRange: [1, 1.1, 1]
859
+ outputRange: [1, 1.15, 1]
833
860
  })
834
861
  }
835
862
  ]
836
863
  };
837
864
  const mainIcon = mainIconName || "add";
838
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_native5.View, { style: [defaultStyles4.container, styles2?.container, style], children: [
839
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
865
+ const containerStyle = [
866
+ defaultStyles4.container,
867
+ styles2?.container,
868
+ style,
869
+ { right: 20, bottom: 100 }
870
+ ];
871
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_native5.View, { style: containerStyle, children: [
872
+ actions.map(this.renderAction),
873
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native5.TouchableWithoutFeedback, { onPress: this.toggleMenu, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
840
874
  import_react_native5.Animated.View,
841
875
  {
842
876
  style: [
843
- defaultStyles4.circleContainer,
844
- styles2?.circleContainer,
877
+ defaultStyles4.mainButtonWrapper,
878
+ styles2?.mainButton,
879
+ rotation,
880
+ mainScale,
881
+ {
882
+ width: buttonSize,
883
+ height: buttonSize,
884
+ borderRadius: buttonSize / 2
885
+ }
886
+ ],
887
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
888
+ import_react_native5.View,
845
889
  {
846
- transform: [
890
+ style: [
891
+ defaultStyles4.button,
847
892
  {
848
- scale: this.animation.interpolate({
849
- inputRange: [0, 1],
850
- outputRange: [0, 1]
851
- })
893
+ width: buttonSize,
894
+ height: buttonSize,
895
+ borderRadius: buttonSize / 2
852
896
  }
853
897
  ],
854
- opacity: this.animation
898
+ children: renderMainIcon ? renderMainIcon({
899
+ name: mainIcon,
900
+ size: buttonSize * 0.46,
901
+ color: "#FFF"
902
+ }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_vector_icons.Ionicons, { name: "add", size: buttonSize * 0.46, color: "#FFF" })
855
903
  }
856
- ],
857
- children: actions.map(this.renderAction)
858
- }
859
- ),
860
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native5.TouchableWithoutFeedback, { onPress: this.toggleMenu, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
861
- import_react_native5.Animated.View,
862
- {
863
- style: [defaultStyles4.mainButtonWrapper, rotation, scale],
864
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native5.View, { style: [defaultStyles4.button, styles2?.mainButton], children: renderMainIcon?.({
865
- name: mainIcon,
866
- size: 26,
867
- color: "#FFF"
868
- }) })
904
+ )
869
905
  }
870
906
  ) })
871
907
  ] });
@@ -874,60 +910,29 @@ var FloatingButton = class extends import_react4.default.Component {
874
910
  var defaultStyles4 = import_react_native5.StyleSheet.create({
875
911
  container: {
876
912
  position: "absolute",
877
- bottom: 100,
878
- right: 20,
879
913
  alignItems: "center",
880
- justifyContent: "center"
914
+ justifyContent: "center",
915
+ zIndex: 1e3
881
916
  },
882
917
  mainButtonWrapper: {
883
- width: 60,
884
- height: 60,
885
- borderRadius: 30,
886
918
  backgroundColor: "#F02A4B",
887
919
  alignItems: "center",
888
920
  justifyContent: "center",
889
- shadowColor: "#000",
890
- shadowOffset: {
891
- width: 0,
892
- height: 2
893
- },
894
- shadowOpacity: 0.25,
895
- shadowRadius: 3.84,
896
- elevation: 5
921
+ elevation: 8,
922
+ zIndex: 1e3
897
923
  },
898
924
  button: {
899
- width: 60,
900
- height: 60,
901
- borderRadius: 30,
902
925
  backgroundColor: "#F02A4B",
903
926
  alignItems: "center",
904
927
  justifyContent: "center"
905
928
  },
906
- circleContainer: {
907
- position: "absolute",
908
- width: 200,
909
- height: 200,
910
- right: -70,
911
- bottom: -70,
912
- alignItems: "center",
913
- justifyContent: "center"
914
- },
915
929
  secondary: {
916
930
  position: "absolute",
917
- width: 48,
918
- height: 48,
919
- borderRadius: 24,
920
931
  backgroundColor: "#F02A4B",
921
932
  alignItems: "center",
922
933
  justifyContent: "center",
923
- shadowColor: "#000",
924
- shadowOffset: {
925
- width: 0,
926
- height: 2
927
- },
928
- shadowOpacity: 0.25,
929
- shadowRadius: 3.84,
930
- elevation: 5
934
+ elevation: 5,
935
+ zIndex: 999
931
936
  }
932
937
  });
933
938
 
package/dist/index.mjs CHANGED
@@ -704,46 +704,49 @@ import {
704
704
  TouchableWithoutFeedback,
705
705
  View as View5
706
706
  } from "react-native";
707
+ import { Ionicons } from "@expo/vector-icons";
707
708
  import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
708
709
  var FloatingButton = class extends React4.Component {
709
710
  animation = new Animated3.Value(0);
710
- open = false;
711
+ state = {
712
+ open: false
713
+ };
711
714
  toggleMenu = () => {
715
+ const toValue = this.state.open ? 0 : 1;
712
716
  Animated3.spring(this.animation, {
713
- toValue: this.open ? 0 : 1,
717
+ toValue,
714
718
  useNativeDriver: true,
715
- damping: 12,
716
- mass: 0.6,
717
- stiffness: 180
719
+ stiffness: 250,
720
+ damping: 20,
721
+ mass: 1
718
722
  }).start();
719
- this.open = !this.open;
723
+ this.setState({ open: !this.state.open });
720
724
  };
721
725
  renderAction = (action, index) => {
722
726
  const {
723
727
  mode = "vertical",
724
- radius = 100,
728
+ radius = 90,
725
729
  actions,
726
730
  renderItemIcon,
727
- styles: styles2
731
+ styles: styles2,
732
+ spacing = 65,
733
+ secondaryButtonSize = 48
728
734
  } = this.props;
729
735
  let translateX = 0;
730
736
  let translateY = 0;
731
737
  if (mode === "vertical") {
732
- translateY = -70 * (index + 1);
733
- translateX = 0;
738
+ translateY = -spacing * (index + 1);
734
739
  }
735
740
  if (mode === "horizontal") {
736
- translateX = -70 * (index + 1);
737
- translateY = 0;
741
+ translateX = -spacing * (index + 1);
738
742
  }
739
743
  if (mode === "circle") {
740
744
  const totalActions = actions.length;
741
- const startAngle = -Math.PI / 3;
742
- const endAngle = -Math.PI * 0.8;
745
+ const startAngle = -Math.PI / 2.5;
746
+ const endAngle = -Math.PI * 0.7;
743
747
  const angle = startAngle + index / (totalActions - 1 || 1) * (endAngle - startAngle);
744
- const adjustedRadius = radius * 0.65;
745
- translateX = adjustedRadius * Math.cos(angle);
746
- translateY = adjustedRadius * Math.sin(angle);
748
+ translateX = radius * Math.cos(angle);
749
+ translateY = radius * Math.sin(angle);
747
750
  }
748
751
  const animStyle = {
749
752
  transform: [
@@ -761,20 +764,25 @@ var FloatingButton = class extends React4.Component {
761
764
  },
762
765
  {
763
766
  scale: this.animation.interpolate({
764
- inputRange: [0, 0.5, 1],
765
- outputRange: [0, 1.2, 1]
767
+ inputRange: [0, 0.3, 0.7, 1],
768
+ outputRange: [0, 1.1, 0.95, 1]
766
769
  })
767
770
  }
768
771
  ],
769
- opacity: this.animation
772
+ opacity: this.animation.interpolate({
773
+ inputRange: [0, 0.2, 1],
774
+ outputRange: [0, 0.8, 1]
775
+ })
770
776
  };
771
777
  return /* @__PURE__ */ jsx5(
772
778
  TouchableWithoutFeedback,
773
779
  {
774
780
  onPress: () => {
775
781
  this.toggleMenu();
776
- action.onPress?.();
777
- action.navigateTo?.();
782
+ setTimeout(() => {
783
+ action.onPress?.();
784
+ action.navigateTo?.();
785
+ }, 100);
778
786
  },
779
787
  children: /* @__PURE__ */ jsx5(
780
788
  Animated3.View,
@@ -782,14 +790,26 @@ var FloatingButton = class extends React4.Component {
782
790
  style: [
783
791
  defaultStyles4.secondary,
784
792
  styles2?.secondaryButton,
785
- { backgroundColor: action.color || "#F02A4B" },
793
+ {
794
+ backgroundColor: action.color || "#F02A4B",
795
+ width: secondaryButtonSize,
796
+ height: secondaryButtonSize,
797
+ borderRadius: secondaryButtonSize / 2
798
+ },
786
799
  animStyle
787
800
  ],
788
- children: renderItemIcon?.({
801
+ children: renderItemIcon ? renderItemIcon({
789
802
  name: action.icon,
790
- size: 20,
803
+ size: secondaryButtonSize * 0.42,
791
804
  color: action.iconColor || "#FFF"
792
- })
805
+ }) : /* @__PURE__ */ jsx5(
806
+ Ionicons,
807
+ {
808
+ name: action.icon,
809
+ size: secondaryButtonSize * 0.42,
810
+ color: action.iconColor || "#FFF"
811
+ }
812
+ )
793
813
  }
794
814
  )
795
815
  },
@@ -797,7 +817,14 @@ var FloatingButton = class extends React4.Component {
797
817
  );
798
818
  };
799
819
  render() {
800
- const { actions, renderMainIcon, styles: styles2, style, mainIconName } = this.props;
820
+ const {
821
+ actions,
822
+ renderMainIcon,
823
+ styles: styles2,
824
+ style,
825
+ mainIconName,
826
+ buttonSize = 56
827
+ } = this.props;
801
828
  const rotation = {
802
829
  transform: [
803
830
  {
@@ -808,48 +835,57 @@ var FloatingButton = class extends React4.Component {
808
835
  }
809
836
  ]
810
837
  };
811
- const scale = {
838
+ const mainScale = {
812
839
  transform: [
813
840
  {
814
841
  scale: this.animation.interpolate({
815
842
  inputRange: [0, 0.5, 1],
816
- outputRange: [1, 1.1, 1]
843
+ outputRange: [1, 1.15, 1]
817
844
  })
818
845
  }
819
846
  ]
820
847
  };
821
848
  const mainIcon = mainIconName || "add";
822
- return /* @__PURE__ */ jsxs5(View5, { style: [defaultStyles4.container, styles2?.container, style], children: [
823
- /* @__PURE__ */ jsx5(
849
+ const containerStyle = [
850
+ defaultStyles4.container,
851
+ styles2?.container,
852
+ style,
853
+ { right: 20, bottom: 100 }
854
+ ];
855
+ return /* @__PURE__ */ jsxs5(View5, { style: containerStyle, children: [
856
+ actions.map(this.renderAction),
857
+ /* @__PURE__ */ jsx5(TouchableWithoutFeedback, { onPress: this.toggleMenu, children: /* @__PURE__ */ jsx5(
824
858
  Animated3.View,
825
859
  {
826
860
  style: [
827
- defaultStyles4.circleContainer,
828
- styles2?.circleContainer,
861
+ defaultStyles4.mainButtonWrapper,
862
+ styles2?.mainButton,
863
+ rotation,
864
+ mainScale,
865
+ {
866
+ width: buttonSize,
867
+ height: buttonSize,
868
+ borderRadius: buttonSize / 2
869
+ }
870
+ ],
871
+ children: /* @__PURE__ */ jsx5(
872
+ View5,
829
873
  {
830
- transform: [
874
+ style: [
875
+ defaultStyles4.button,
831
876
  {
832
- scale: this.animation.interpolate({
833
- inputRange: [0, 1],
834
- outputRange: [0, 1]
835
- })
877
+ width: buttonSize,
878
+ height: buttonSize,
879
+ borderRadius: buttonSize / 2
836
880
  }
837
881
  ],
838
- opacity: this.animation
882
+ children: renderMainIcon ? renderMainIcon({
883
+ name: mainIcon,
884
+ size: buttonSize * 0.46,
885
+ color: "#FFF"
886
+ }) : /* @__PURE__ */ jsx5(Ionicons, { name: "add", size: buttonSize * 0.46, color: "#FFF" })
839
887
  }
840
- ],
841
- children: actions.map(this.renderAction)
842
- }
843
- ),
844
- /* @__PURE__ */ jsx5(TouchableWithoutFeedback, { onPress: this.toggleMenu, children: /* @__PURE__ */ jsx5(
845
- Animated3.View,
846
- {
847
- style: [defaultStyles4.mainButtonWrapper, rotation, scale],
848
- children: /* @__PURE__ */ jsx5(View5, { style: [defaultStyles4.button, styles2?.mainButton], children: renderMainIcon?.({
849
- name: mainIcon,
850
- size: 26,
851
- color: "#FFF"
852
- }) })
888
+ )
853
889
  }
854
890
  ) })
855
891
  ] });
@@ -858,60 +894,29 @@ var FloatingButton = class extends React4.Component {
858
894
  var defaultStyles4 = StyleSheet5.create({
859
895
  container: {
860
896
  position: "absolute",
861
- bottom: 100,
862
- right: 20,
863
897
  alignItems: "center",
864
- justifyContent: "center"
898
+ justifyContent: "center",
899
+ zIndex: 1e3
865
900
  },
866
901
  mainButtonWrapper: {
867
- width: 60,
868
- height: 60,
869
- borderRadius: 30,
870
902
  backgroundColor: "#F02A4B",
871
903
  alignItems: "center",
872
904
  justifyContent: "center",
873
- shadowColor: "#000",
874
- shadowOffset: {
875
- width: 0,
876
- height: 2
877
- },
878
- shadowOpacity: 0.25,
879
- shadowRadius: 3.84,
880
- elevation: 5
905
+ elevation: 8,
906
+ zIndex: 1e3
881
907
  },
882
908
  button: {
883
- width: 60,
884
- height: 60,
885
- borderRadius: 30,
886
909
  backgroundColor: "#F02A4B",
887
910
  alignItems: "center",
888
911
  justifyContent: "center"
889
912
  },
890
- circleContainer: {
891
- position: "absolute",
892
- width: 200,
893
- height: 200,
894
- right: -70,
895
- bottom: -70,
896
- alignItems: "center",
897
- justifyContent: "center"
898
- },
899
913
  secondary: {
900
914
  position: "absolute",
901
- width: 48,
902
- height: 48,
903
- borderRadius: 24,
904
915
  backgroundColor: "#F02A4B",
905
916
  alignItems: "center",
906
917
  justifyContent: "center",
907
- shadowColor: "#000",
908
- shadowOffset: {
909
- width: 0,
910
- height: 2
911
- },
912
- shadowOpacity: 0.25,
913
- shadowRadius: 3.84,
914
- elevation: 5
918
+ elevation: 5,
919
+ zIndex: 999
915
920
  }
916
921
  });
917
922
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaushverse/pickify",
3
- "version": "1.1.12",
3
+ "version": "1.1.15",
4
4
  "description": "A fully customizable React Native picker with search, multi-select, grouping, and async support.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",