@teamnhz/rn-ui-toolkit 1.4.0 → 1.4.2

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.
@@ -3,13 +3,17 @@ import { TouchableOpacity, Text, StyleSheet, ActivityIndicator, } from "react-na
3
3
  import LinearGradient from "react-native-linear-gradient";
4
4
  const LinearGradientButton = ({ title, onPress, loading = false, disabled = false, colors = ["#4c669f", "#3b5998", "#192f6a"], start = { x: 0, y: 0 }, end = { x: 1, y: 1 }, containerStyle, textStyle, height = 50, borderRadius = 12, }) => {
5
5
  const isDisabled = loading || disabled;
6
- return (React.createElement(TouchableOpacity, { activeOpacity: 0.8, onPress: onPress, disabled: isDisabled, style: [{ opacity: isDisabled ? 0.6 : 1, width: "100%" }, containerStyle,] },
7
- React.createElement(LinearGradient, { colors: colors, start: start, end: end, style: [
8
- styles.button,
9
- { height, borderRadius }
10
- ] }, loading ? (React.createElement(ActivityIndicator, { color: "#fff", size: "small" })) : (React.createElement(Text, { style: [styles.text, textStyle] }, title)))));
6
+ return (React.createElement(TouchableOpacity, { activeOpacity: 0.8, onPress: onPress, disabled: isDisabled, style: [
7
+ styles.container,
8
+ { opacity: isDisabled ? 0.6 : 1 },
9
+ containerStyle,
10
+ ] },
11
+ React.createElement(LinearGradient, { colors: colors, start: start, end: end, style: [styles.button, { height, borderRadius }] }, loading ? (React.createElement(ActivityIndicator, { color: "#fff", size: "small" })) : (React.createElement(Text, { style: [styles.text, textStyle] }, title)))));
11
12
  };
12
13
  const styles = StyleSheet.create({
14
+ container: {
15
+ alignSelf: "stretch",
16
+ },
13
17
  button: {
14
18
  justifyContent: "center",
15
19
  alignItems: "center",
@@ -19,6 +23,7 @@ const styles = StyleSheet.create({
19
23
  color: "#fff",
20
24
  fontSize: 16,
21
25
  fontWeight: "600",
26
+ textAlign: "center",
22
27
  },
23
28
  });
24
29
  export default LinearGradientButton;
@@ -1,9 +1,10 @@
1
1
  import React, { ReactNode } from "react";
2
- import { ModalProps } from "react-native-modal";
3
- type AppModalProps = Partial<ModalProps> & {
2
+ import { ModalProps as RNModalProps } from "react-native";
3
+ type AppModalProps = Partial<RNModalProps> & {
4
4
  children: ReactNode;
5
5
  closing: () => void;
6
6
  bkO?: number;
7
+ isVisible: boolean;
7
8
  };
8
- declare const Modals: ({ children, closing, bkO, ...props }: AppModalProps) => React.JSX.Element;
9
+ declare const Modals: ({ children, closing, bkO, isVisible, animationType, ...props }: AppModalProps) => React.JSX.Element;
9
10
  export default Modals;
@@ -1,33 +1,22 @@
1
1
  import React from "react";
2
- import Modal from "react-native-modal";
3
- // Base Modal Component customized for app needs
4
- const Modals = ({ children, closing, bkO = 0.5, ...props }) => (React.createElement(Modal, { backdropOpacity: bkO, animationInTiming: 400, animationOutTiming: 400, backdropTransitionOutTiming: 0, swipeDirection: ["down", "left", "right", "up"], onSwipeComplete: closing, onBackdropPress: closing, onBackButtonPress: closing, ...props }, children));
2
+ import { Modal, View, StyleSheet, Dimensions, TouchableWithoutFeedback, } from "react-native";
3
+ const { height: SCREEN_HEIGHT } = Dimensions.get("window");
4
+ const Modals = ({ children, closing, bkO = 0.5, isVisible, animationType = "fade", ...props }) => {
5
+ return (React.createElement(Modal, { visible: isVisible, transparent: true, animationType: animationType, onRequestClose: closing, statusBarTranslucent: true, ...props },
6
+ React.createElement(TouchableWithoutFeedback, { onPress: closing },
7
+ React.createElement(View, { style: [styles.overlay, { backgroundColor: `rgba(0, 0, 0, ${bkO})` }] },
8
+ React.createElement(TouchableWithoutFeedback, null,
9
+ React.createElement(View, { style: styles.contentContainer }, children))))));
10
+ };
11
+ const styles = StyleSheet.create({
12
+ overlay: {
13
+ flex: 1,
14
+ justifyContent: "center",
15
+ alignItems: "center",
16
+ },
17
+ contentContainer: {
18
+ maxHeight: SCREEN_HEIGHT * 0.9,
19
+ width: "90%",
20
+ },
21
+ });
5
22
  export default Modals;
6
- // import React, { ReactNode } from 'react';
7
- // import Modal, { ModalProps } from 'react-native-modal';
8
- // type AppModalProps = Partial<ModalProps> & {
9
- // children: ReactNode;
10
- // closing: () => void;
11
- // bkO?: number;
12
- // };
13
- // // Base Modal Component customized for app needs
14
- // const Modals = ({
15
- // children,
16
- // closing,
17
- // bkO = 0.5,
18
- // ...props
19
- // }: AppModalProps) => (
20
- // <Modal
21
- // backdropOpacity={bkO}
22
- // animationInTiming={400}
23
- // animationOutTiming={400}
24
- // backdropTransitionOutTiming={0}
25
- // swipeDirection={['down', 'left', 'right', 'up']}
26
- // onSwipeComplete={closing}
27
- // onBackdropPress={closing}
28
- // onBackButtonPress={closing}
29
- // {...props}>
30
- // {children}
31
- // </Modal>
32
- // );
33
- // export default Modals;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamnhz/rn-ui-toolkit",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [