@lookiero/checkout 2.0.0 → 2.1.0

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.
@@ -33,10 +33,11 @@ const ReturnQuestionsForm = ({ returnQuestions, checkoutItemPrice, productVarian
33
33
  const handleOnSubmit = useCallback(() => onSubmit(feedback), [feedback, onSubmit]);
34
34
  return (React.createElement(ReturnQuestionItemProvider, { returnQuestionItems: returnQuestionItems },
35
35
  React.createElement(PortalHost, { name: RETURN_QUESTION_FORM_PORTAL_HOST_NAME }),
36
- React.createElement(Modal, { footer: React.createElement(Button, { onPress: handleOnSubmit }, submitButtonText), portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME, testID: "return-questions-form-modal", visible: visible, scroll: true, showCloseButton: true, onClose: onClose },
36
+ React.createElement(Modal, { portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME, testID: "return-questions-form-modal", visible: visible, scroll: true, showCloseButton: true, onClose: onClose },
37
37
  React.createElement(View, { style: style.returnQuestionsContainer },
38
38
  React.createElement(Text, { level: 2, style: style.title }, titleText),
39
39
  React.createElement(ProductVariant, { brand: brand, color: color, country: country, media: media, name: name, price: checkoutItemPrice, size: size }),
40
- React.createElement(ReturnQuestions, { portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME, returnQuestions: returnQuestions })))));
40
+ React.createElement(ReturnQuestions, { portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME, returnQuestions: returnQuestions }),
41
+ React.createElement(Button, { style: style.submit, onPress: handleOnSubmit }, submitButtonText)))));
41
42
  };
42
43
  export { ReturnQuestionsForm };
@@ -1,8 +1,10 @@
1
1
  declare const style: {
2
2
  returnQuestionsContainer: {
3
- paddingBottom: number;
4
3
  paddingHorizontal: number;
5
4
  };
5
+ submit: {
6
+ marginTop: number;
7
+ };
6
8
  title: {
7
9
  marginBottom: number;
8
10
  textAlign: "center";
@@ -3,9 +3,11 @@ import { theme } from "../../../../theme/theme";
3
3
  const { spaceXL } = theme();
4
4
  const style = StyleSheet.create({
5
5
  returnQuestionsContainer: {
6
- paddingBottom: spaceXL,
7
6
  paddingHorizontal: spaceXL,
8
7
  },
8
+ submit: {
9
+ marginTop: spaceXL,
10
+ },
9
11
  title: {
10
12
  marginBottom: spaceXL,
11
13
  textAlign: "center",
@@ -1,6 +1,6 @@
1
1
  import { ALIGN, Button, Text } from "@lookiero/aurora";
2
2
  import { useI18nMessage } from "@lookiero/i18n-react";
3
- import React from "react";
3
+ import React, { useEffect, useRef } from "react";
4
4
  import { useCallback } from "react";
5
5
  import { View } from "react-native";
6
6
  import { Modal } from "../../../../../ui/components/layouts/modal/Modal";
@@ -9,7 +9,19 @@ const ModalNotificationItem = ({ visible, notification, onRemove, testID = "moda
9
9
  const titleText = useI18nMessage({ id: notification.titleI18nKey });
10
10
  const bodyText = useI18nMessage({ id: notification.bodyI18nKey });
11
11
  const acceptText = useI18nMessage({ id: notification.acceptI18nKey });
12
- const handleOnClose = useCallback(() => onRemove(notification.id), [notification.id, onRemove]);
12
+ const modalNotificationClosedRef = useRef(false);
13
+ const handleOnClose = useCallback(() => {
14
+ onRemove(notification.id);
15
+ modalNotificationClosedRef.current = true;
16
+ }, [notification.id, onRemove]);
17
+ /**
18
+ * Remove modal notification when this view is unmounted
19
+ */
20
+ useEffect(() => () => {
21
+ if (!modalNotificationClosedRef.current) {
22
+ onRemove(notification.id);
23
+ }
24
+ }, [notification.id, onRemove]);
13
25
  return (React.createElement(Modal, { testID: testID, visible: visible, onClose: handleOnClose },
14
26
  React.createElement(View, { style: style.modal },
15
27
  React.createElement(Text, { align: ALIGN.CENTER, level: 1 }, titleText),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [