diff --git a/.eslintrc.js b/.eslintrc.js index 15dd4c30a55..249e324ad0a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -31,6 +31,9 @@ module.exports = { "@stylistic/eslint-plugin-js" ], rules: { + //Rules from react 17 https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#eslint + "react/react-in-jsx-scope": "off", + "react/jsx-uses-react": "off", "comma-dangle": ["error", "never"], "no-case-declarations": "off", "no-inner-declarations": "off", @@ -124,24 +127,27 @@ module.exports = { "no-restricted-imports": [ "error", { - "paths": [ + paths: [ { name: "i18n-js", - message: 'Importing I18n from "i18n-js" is not allowed. Import it from "ts/i18n.ts" instead.', - }, + message: + 'Importing I18n from "i18n-js" is not allowed. Import it from "ts/i18n.ts" instead.' + }, { name: "@pagopa/ts-commons", importNames: ["pot"], - message: 'Importing { pot } from "@pagopa/ts-commons" is not allowed. Use \'import * as pot from "@pagopa/ts-commons/lib/pot"\' instead.', + message: + 'Importing { pot } from "@pagopa/ts-commons" is not allowed. Use \'import * as pot from "@pagopa/ts-commons/lib/pot"\' instead.' } ], patterns: [ { group: ["**/config"], importNames: ["privacyUrl"], - message: 'Importing "privacyUrl" from "config.ts" module is restricted. Please use "tosConfigSelector" to obtain it instead.' + message: + 'Importing "privacyUrl" from "config.ts" module is restricted. Please use "tosConfigSelector" to obtain it instead.' } - ] + ] } ] }, diff --git a/babel.config.js b/babel.config.js index f4215f40295..4cf7f48c240 100644 --- a/babel.config.js +++ b/babel.config.js @@ -5,8 +5,20 @@ module.exports = { [ "react-native-reanimated/plugin", { - globals: ["__scanCodes"] - } - ] - ] + globals: ["__scanCodes"], + }, + ], + [ + "@babel/plugin-transform-class-properties", + { loose: true }, + ], + [ + "@babel/plugin-transform-private-methods", + { loose: true }, + ], + [ + "@babel/plugin-transform-private-property-in-object", + { loose: true }, + ], + ], }; diff --git a/package.json b/package.json index 0c590c8a8fd..eb641b03094 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,10 @@ ] }, "dependencies": { + "@babel/plugin-transform-class-properties": "^7.25.9", + "@babel/plugin-transform-private-methods": "^7.25.9", + "@babel/plugin-transform-private-property-in-object": "^7.25.9", + "@babel/plugin-transform-react-jsx": "^7.25.9", "@gorhom/bottom-sheet": "^4.1.5", "@pagopa/io-app-design-system": "4.3.0", "@pagopa/io-pagopa-commons": "^3.1.0", @@ -178,7 +182,7 @@ "xstate": "^5" }, "devDependencies": { - "@babel/core": "^7.20.0", + "@babel/core": "^7.26.0", "@babel/plugin-transform-regenerator": "^7.18.6", "@babel/preset-env": "^7.20.0", "@babel/preset-typescript": "^7.23.3", @@ -226,6 +230,7 @@ "chalk": "^2.4.1", "eslint": "^8.19.0", "eslint-config-prettier": "^8.3.0", + "eslint-plugin-ft-flow": "latest", "eslint-plugin-functional": "^4.1.1", "eslint-plugin-import": "^2.25.4", "eslint-plugin-jest": "^28.8.3", diff --git a/ts/App.tsx b/ts/App.tsx index cb6a0e62089..7bfd24cccd5 100644 --- a/ts/App.tsx +++ b/ts/App.tsx @@ -4,7 +4,6 @@ import { IOThemeContextProvider, ToastProvider } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { GestureHandlerRootView } from "react-native-gesture-handler"; import { SafeAreaProvider } from "react-native-safe-area-context"; import { Provider } from "react-redux"; diff --git a/ts/RootContainer.tsx b/ts/RootContainer.tsx index 52e9434ce10..f3ab3f496e2 100644 --- a/ts/RootContainer.tsx +++ b/ts/RootContainer.tsx @@ -1,6 +1,6 @@ import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import * as React from "react"; +import { PureComponent } from "react"; import { AppState, AppStateStatus, @@ -43,7 +43,7 @@ type Props = ReturnType & * - the UpdateAppModal, if the backend is not compatible with the installed app version * - the root for displaying light modals */ -class RootContainer extends React.PureComponent { +class RootContainer extends PureComponent { private subscription: NativeEventSubscription | undefined; constructor(props: Props) { super(props); diff --git a/ts/__mocks__/@gorhom/bottom-sheet.ts b/ts/__mocks__/@gorhom/bottom-sheet.ts index 2e181887b7e..40dd82cdedb 100644 --- a/ts/__mocks__/@gorhom/bottom-sheet.ts +++ b/ts/__mocks__/@gorhom/bottom-sheet.ts @@ -7,7 +7,7 @@ * * reference: https://github.com/gorhom/react-native-bottom-sheet/blob/master/mock.js */ -import React, { PropsWithChildren } from "react"; +import { Component, PropsWithChildren } from "react"; const NOOP = () => {}; const NOOP_VALUE = { value: 0, set: NOOP, get: () => 0 }; @@ -18,7 +18,7 @@ const BottomSheetBackdrop = NOOP; const BottomSheetComponent = (props: PropsWithChildren) => props.children; -class BottomSheetModal extends React.Component { +class BottomSheetModal extends Component { snapToIndex() {} snapToPosition() {} expand() {} @@ -33,7 +33,7 @@ class BottomSheetModal extends React.Component { } } -class BottomSheet extends React.Component { +class BottomSheet extends Component { snapToIndex() {} snapToPosition() {} expand() {} diff --git a/ts/__mocks__/react-native-text-input-mask.ts b/ts/__mocks__/react-native-text-input-mask.ts index c4fe13a777b..9f7cf32214a 100644 --- a/ts/__mocks__/react-native-text-input-mask.ts +++ b/ts/__mocks__/react-native-text-input-mask.ts @@ -1,9 +1,9 @@ /** * Mocked version of TextInputMask */ -import React from "react"; +import { Component } from "react"; -class TextInputMask extends React.Component { +class TextInputMask extends Component { public render() { return null; } diff --git a/ts/components/AnimatedImage.tsx b/ts/components/AnimatedImage.tsx index 15f6a6134f9..63ac9b3d548 100644 --- a/ts/components/AnimatedImage.tsx +++ b/ts/components/AnimatedImage.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { ComponentProps } from "react"; import { Image } from "react-native"; import Animated, { Easing, @@ -7,7 +7,7 @@ import Animated, { withTiming } from "react-native-reanimated"; -export type AnimatedImageProps = React.ComponentProps; +export type AnimatedImageProps = ComponentProps; /** * AnimatedImage component renders an image with a fade-in animation diff --git a/ts/components/AppVersion.tsx b/ts/components/AppVersion.tsx index 08e433c9d41..9ab82cb9591 100644 --- a/ts/components/AppVersion.tsx +++ b/ts/components/AppVersion.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { GestureResponderEvent, Pressable, diff --git a/ts/components/BonusCard/BonusCard.tsx b/ts/components/BonusCard/BonusCard.tsx index 22f73c3da71..2915533b8a5 100644 --- a/ts/components/BonusCard/BonusCard.tsx +++ b/ts/components/BonusCard/BonusCard.tsx @@ -1,21 +1,22 @@ import { Avatar, + BodySmall, H2, HSpacer, IOColors, - BodySmall, VSpacer } from "@pagopa/io-app-design-system"; -import React from "react"; + +import { Fragment, ReactNode, useMemo } from "react"; import { ImageURISource, StyleSheet, View } from "react-native"; -import { useSafeAreaInsets } from "react-native-safe-area-context"; -import Placeholder from "rn-placeholder"; import { heightPercentageToDP, widthPercentageToDP } from "react-native-responsive-screen"; -import { isDesignSystemEnabledSelector } from "../../store/reducers/persistedPreferences"; +import { useSafeAreaInsets } from "react-native-safe-area-context"; +import Placeholder from "rn-placeholder"; import { useIOSelector } from "../../store/hooks"; +import { isDesignSystemEnabledSelector } from "../../store/reducers/persistedPreferences"; import { BonusCardCounter } from "./BonusCardCounter"; import { BonusCardShape } from "./BonusCardShape"; import { BonusCardStatus } from "./BonusCardStatus"; @@ -29,10 +30,10 @@ type ContentProps = { logoUris?: Array; name: string; organizationName: string; - status: React.ReactNode; + status: ReactNode; counters?: ReadonlyArray; - cardFooter?: React.ReactNode; - cardBackground?: React.ReactNode; + cardFooter?: ReactNode; + cardBackground?: ReactNode; }; type LoadingStateProps = @@ -86,10 +87,10 @@ const BonusCardContent = (props: BonusCard) => { {counters.map((counter, index) => { const isLast = index === counters.length - 1; return ( - + {!isLast && } - + ); })} @@ -110,7 +111,7 @@ export const BonusCard = (props: BonusCard) => { // This will generate a new key based on isLoading state. // A new key will force BonusCardShape to rerender, remeasuring the layout and adapting to new // container size. - const shapeKey = React.useMemo( + const shapeKey = useMemo( () => props.isLoading && Math.random().toString(36).slice(2), [props.isLoading] ); diff --git a/ts/components/BonusCard/BonusCardCounter.tsx b/ts/components/BonusCard/BonusCardCounter.tsx index cd93c00e12f..87a1e00ac66 100644 --- a/ts/components/BonusCard/BonusCardCounter.tsx +++ b/ts/components/BonusCard/BonusCardCounter.tsx @@ -1,5 +1,5 @@ import { H3, IOColors, LabelMini, VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; +import { useEffect } from "react"; import { StyleSheet, View } from "react-native"; import Animated, { useAnimatedStyle, @@ -78,7 +78,7 @@ const BonusProgressBar = ({ progress }: BonusProgressBarProps) => { : IOColors.blue; const width = useSharedValue(100); - React.useEffect(() => { + useEffect(() => { // eslint-disable-next-line functional/immutable-data width.value = progress * 100; }); diff --git a/ts/components/BonusCard/BonusCardScreenComponent.tsx b/ts/components/BonusCard/BonusCardScreenComponent.tsx index fc82f663687..c1d587d1f38 100644 --- a/ts/components/BonusCard/BonusCardScreenComponent.tsx +++ b/ts/components/BonusCard/BonusCardScreenComponent.tsx @@ -1,10 +1,10 @@ import { HeaderActionProps } from "@pagopa/io-app-design-system"; -import { default as React, ReactNode } from "react"; +import { ReactNode } from "react"; import { Dimensions } from "react-native"; import Animated, { useAnimatedRef } from "react-native-reanimated"; +import { useHeaderSecondLevel } from "../../hooks/useHeaderSecondLevel"; import { SupportRequestParams } from "../../hooks/useStartSupportRequest"; import { IOScrollView, IOScrollViewActions } from "../ui/IOScrollView"; -import { useHeaderSecondLevel } from "../../hooks/useHeaderSecondLevel"; import { BonusCard } from "./BonusCard"; type BaseProps = { diff --git a/ts/components/BonusCard/BonusCardShape.tsx b/ts/components/BonusCard/BonusCardShape.tsx index 4b8f280c1b6..90a4c9f1dcb 100644 --- a/ts/components/BonusCard/BonusCardShape.tsx +++ b/ts/components/BonusCard/BonusCardShape.tsx @@ -1,5 +1,4 @@ import { IOColors, useIOTheme } from "@pagopa/io-app-design-system"; -import React from "react"; import { StyleSheet, View } from "react-native"; import { Circle, ClipPath, Defs, Path, Rect, Svg } from "react-native-svg"; import { isDesignSystemEnabledSelector } from "../../store/reducers/persistedPreferences"; diff --git a/ts/components/BonusCard/BonusCardStatus.tsx b/ts/components/BonusCard/BonusCardStatus.tsx index bf27ba75772..85ec2855aad 100644 --- a/ts/components/BonusCard/BonusCardStatus.tsx +++ b/ts/components/BonusCard/BonusCardStatus.tsx @@ -1,9 +1,10 @@ import { IOColors } from "@pagopa/io-app-design-system"; -import React from "react"; + +import { ReactNode } from "react"; import { StyleSheet, View } from "react-native"; import Placeholder from "rn-placeholder"; -import { isDesignSystemEnabledSelector } from "../../store/reducers/persistedPreferences"; import { useIOSelector } from "../../store/hooks"; +import { isDesignSystemEnabledSelector } from "../../store/reducers/persistedPreferences"; type LoadingProps = { isLoading: true; @@ -11,7 +12,7 @@ type LoadingProps = { type BaseProps = { isLoading?: never; - children: React.ReactNode; + children: ReactNode; }; export type BonusCardStatus = LoadingProps | BaseProps; diff --git a/ts/components/BonusCard/__tests__/BonusCard.test.tsx b/ts/components/BonusCard/__tests__/BonusCard.test.tsx index 1b0010f27aa..42502bcd646 100644 --- a/ts/components/BonusCard/__tests__/BonusCard.test.tsx +++ b/ts/components/BonusCard/__tests__/BonusCard.test.tsx @@ -1,6 +1,5 @@ import { LabelMini } from "@pagopa/io-app-design-system"; import { render } from "@testing-library/react-native"; -import React from "react"; import { Provider } from "react-redux"; import configureMockStore from "redux-mock-store"; import I18n from "../../../i18n"; diff --git a/ts/components/BonusCard/__tests__/BonusCardCounter.test.tsx b/ts/components/BonusCard/__tests__/BonusCardCounter.test.tsx index b4e5ec5515c..78996ef07c9 100644 --- a/ts/components/BonusCard/__tests__/BonusCardCounter.test.tsx +++ b/ts/components/BonusCard/__tests__/BonusCardCounter.test.tsx @@ -1,5 +1,4 @@ import { render } from "@testing-library/react-native"; -import React from "react"; import { Provider } from "react-redux"; import { Store, createStore } from "redux"; import { applicationChangeState } from "../../../store/actions/application"; diff --git a/ts/components/BonusCard/__tests__/BonusCardStatus.test.tsx b/ts/components/BonusCard/__tests__/BonusCardStatus.test.tsx index 368a5845768..2f43a978f34 100644 --- a/ts/components/BonusCard/__tests__/BonusCardStatus.test.tsx +++ b/ts/components/BonusCard/__tests__/BonusCardStatus.test.tsx @@ -1,5 +1,4 @@ import { render } from "@testing-library/react-native"; -import React from "react"; import { Provider } from "react-redux"; import { Store, createStore } from "redux"; import I18n from "../../../i18n"; diff --git a/ts/components/BulletList.tsx b/ts/components/BulletList.tsx index b8660e7038d..d851c21d0f0 100644 --- a/ts/components/BulletList.tsx +++ b/ts/components/BulletList.tsx @@ -7,7 +7,7 @@ import { IOStyles, VSpacer } from "@pagopa/io-app-design-system"; -import React, { ComponentProps, memo, useCallback } from "react"; +import { ComponentProps, memo, useCallback } from "react"; import { View } from "react-native"; const BULLET_ITEM = "\u2022"; diff --git a/ts/components/CalendarList.tsx b/ts/components/CalendarList.tsx index b68a52748e6..390a8c2e31e 100644 --- a/ts/components/CalendarList.tsx +++ b/ts/components/CalendarList.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { Calendar } from "react-native-calendar-events"; import { ContentWrapper, diff --git a/ts/components/CalendarsListContainer.tsx b/ts/components/CalendarsListContainer.tsx index 4ce306c152d..dfc121438f7 100644 --- a/ts/components/CalendarsListContainer.tsx +++ b/ts/components/CalendarsListContainer.tsx @@ -1,5 +1,5 @@ import * as pot from "@pagopa/ts-commons/lib/pot"; -import React, { memo, useCallback, useEffect, useState } from "react"; +import { Fragment, memo, useCallback, useEffect, useState } from "react"; import RNCalendarEvents, { Calendar } from "react-native-calendar-events"; import { ListItemHeader, @@ -133,7 +133,7 @@ const CalendarsListContainer = ({ return ( pot.isSome(calendarsByAccount) && calendarsByAccount.value.map((section, index) => ( - + type="radioListItem" @@ -144,7 +144,7 @@ const CalendarsListContainer = ({ /> {/* not show the end spacer if the element is the last */} {index < calendarsByAccount.value.length - 1 && } - + )) ); }; diff --git a/ts/components/Carousel.tsx b/ts/components/Carousel.tsx index 531bec6834e..9afa092e0a7 100644 --- a/ts/components/Carousel.tsx +++ b/ts/components/Carousel.tsx @@ -1,5 +1,5 @@ import { IOAppMargin, WithTestID } from "@pagopa/io-app-design-system"; -import React, { +import { JSXElementConstructor, ReactElement, Ref, diff --git a/ts/components/DebugInfoOverlay.tsx b/ts/components/DebugInfoOverlay.tsx index 377dc5c18a6..e36d5c1ccff 100644 --- a/ts/components/DebugInfoOverlay.tsx +++ b/ts/components/DebugInfoOverlay.tsx @@ -6,8 +6,8 @@ import { hexToRgba, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; -import { useState } from "react"; + +import { FunctionComponent, useState } from "react"; import { Platform, Pressable, SafeAreaView, StyleSheet } from "react-native"; import { widthPercentageToDP } from "react-native-responsive-screen"; import { connect } from "react-redux"; @@ -56,7 +56,7 @@ const styles = StyleSheet.create({ } }); -const DebugInfoOverlay: React.FunctionComponent = (props: Props) => { +const DebugInfoOverlay: FunctionComponent = (props: Props) => { const theme = useIOTheme(); const appVersion = getAppVersion(); const [showRootName, setShowRootName] = useState(true); diff --git a/ts/components/FlagSecure.tsx b/ts/components/FlagSecure.tsx index 5a0ffa4e1a2..4607fe0c7e5 100644 --- a/ts/components/FlagSecure.tsx +++ b/ts/components/FlagSecure.tsx @@ -1,5 +1,4 @@ -import * as React from "react"; -import { useEffect } from "react"; +import { FunctionComponent, useEffect } from "react"; import FlagSecure from "react-native-flag-secure-android"; import { connect } from "react-redux"; import { isAllowedSnapshotCurrentScreen } from "../store/reducers/allowedSnapshotScreens"; @@ -14,7 +13,7 @@ type Props = ReturnType; * @param props * @constructor */ -const FlagSecureComponent: React.FunctionComponent = props => { +const FlagSecureComponent: FunctionComponent = props => { useEffect(() => { if (props.isAllowedSnapshotCurrentScreen) { FlagSecure.deactivate(); diff --git a/ts/components/ForceScrollDownView.tsx b/ts/components/ForceScrollDownView.tsx index e58b866d6c3..97363012304 100644 --- a/ts/components/ForceScrollDownView.tsx +++ b/ts/components/ForceScrollDownView.tsx @@ -1,4 +1,12 @@ -import React from "react"; +import { IOSpringValues, IconButtonSolid } from "@pagopa/io-app-design-system"; +import { + ReactNode, + useCallback, + useEffect, + useMemo, + useRef, + useState +} from "react"; import { LayoutChangeEvent, NativeScrollEvent, @@ -7,14 +15,13 @@ import { ScrollViewProps, StyleSheet } from "react-native"; -import { IOSpringValues, IconButtonSolid } from "@pagopa/io-app-design-system"; import { ScaleInOutAnimation } from "./animations/ScaleInOutAnimation"; type ForceScrollDownViewProps = { /** * The content to display inside the scroll view. */ - children: React.ReactNode; + children: ReactNode; /** * The distance from the bottom of the scrollable content at which the "scroll to bottom" button * should become hidden. Defaults to 100. @@ -44,37 +51,37 @@ const ForceScrollDownView = ({ scrollEnabled = true, onThresholdCrossed }: ForceScrollDownViewProps) => { - const scrollViewRef = React.useRef(null); + const scrollViewRef = useRef(null); /** * The height of the scroll view, used to determine whether or not the scrollable content fits inside * the scroll view and whether the "scroll to bottom" button should be displayed. */ - const [scrollViewHeight, setScrollViewHeight] = React.useState(); + const [scrollViewHeight, setScrollViewHeight] = useState(); /** * The height of the scrollable content, used to determine whether or not the "scroll to bottom" button * should be displayed. */ - const [contentHeight, setContentHeight] = React.useState(); + const [contentHeight, setContentHeight] = useState(); /** * Whether or not the scroll view has crossed the threshold from the bottom. */ - const [isThresholdCrossed, setThresholdCrossed] = React.useState(false); + const [isThresholdCrossed, setThresholdCrossed] = useState(false); /** * Whether or not the "scroll to bottom" button should be visible. This is controlled by the threshold * and the current scroll position. */ - const [isButtonVisible, setButtonVisible] = React.useState(true); + const [isButtonVisible, setButtonVisible] = useState(true); /** * A callback that is called whenever the scroll view is scrolled. It checks whether or not the * scroll view has crossed the threshold from the bottom and updates the state accordingly. * The callback is designed to updatr button visibility only when crossing the threshold. */ - const handleScroll = React.useCallback( + const handleScroll = useCallback( (event: NativeSyntheticEvent) => { const { layoutMeasurement, contentOffset, contentSize } = event.nativeEvent; @@ -99,7 +106,7 @@ const ForceScrollDownView = ({ /** * A side effect that calls the `onThresholdCrossed` callback whenever the value of `isThresholdCrossed` changes. */ - React.useEffect(() => { + useEffect(() => { onThresholdCrossed?.(isThresholdCrossed); }, [onThresholdCrossed, isThresholdCrossed]); @@ -107,7 +114,7 @@ const ForceScrollDownView = ({ * A callback that is called whenever the size of the scrollable content changes. It updates the * state with the new content height. */ - const handleContentSizeChange = React.useCallback( + const handleContentSizeChange = useCallback( (_contentWidth: number, contentHeight: number) => { setContentHeight(contentHeight); }, @@ -118,7 +125,7 @@ const ForceScrollDownView = ({ * A callback that is called whenever the size of the scroll view changes. It updates the state * with the new scroll view height. */ - const handleLayout = React.useCallback((event: LayoutChangeEvent) => { + const handleLayout = useCallback((event: LayoutChangeEvent) => { setScrollViewHeight(event.nativeEvent.layout.height); }, []); @@ -126,7 +133,7 @@ const ForceScrollDownView = ({ * A callback that is called when the "scroll to bottom" button is pressed. It scrolls the * scroll view to the bottom and hides the button. */ - const handleScrollDownPress = React.useCallback(() => { + const handleScrollDownPress = useCallback(() => { setButtonVisible(false); scrollViewRef.current?.scrollToEnd(); }, [scrollViewRef]); @@ -136,7 +143,7 @@ const ForceScrollDownView = ({ * when the scrollable content cannot fit inside the scroll view and the button is enabled * (`scrollEnabled` is `true`). */ - const needsScroll = React.useMemo( + const needsScroll = useMemo( () => scrollViewHeight != null && contentHeight != null && diff --git a/ts/components/GoBackButton.tsx b/ts/components/GoBackButton.tsx index 22a6ff972e6..df01d722327 100644 --- a/ts/components/GoBackButton.tsx +++ b/ts/components/GoBackButton.tsx @@ -1,5 +1,5 @@ import { CommonActions } from "@react-navigation/native"; -import * as React from "react"; +import { PureComponent } from "react"; import { BackHandler, NativeEventSubscription, Platform } from "react-native"; import { IconButton } from "@pagopa/io-app-design-system"; import I18n from "../i18n"; @@ -13,7 +13,7 @@ interface OwnProps { type Props = OwnProps; -class GoBackButton extends React.PureComponent { +class GoBackButton extends PureComponent { private subscription: NativeEventSubscription | undefined; public static defaultProps: Partial = { white: false diff --git a/ts/components/IOMarkdown/index.tsx b/ts/components/IOMarkdown/index.tsx index a8d58c0e51f..7ebaf1e3e0e 100644 --- a/ts/components/IOMarkdown/index.tsx +++ b/ts/components/IOMarkdown/index.tsx @@ -1,4 +1,4 @@ -import React, { memo } from "react"; +import { memo } from "react"; import { View } from "react-native"; import { IOMarkdownRenderRules } from "./types"; import { getRenderMarkdown, parse } from "./markdownRenderer"; diff --git a/ts/components/IOMarkdown/renderRules.tsx b/ts/components/IOMarkdown/renderRules.tsx index 090db9e1c8a..186dbd91544 100644 --- a/ts/components/IOMarkdown/renderRules.tsx +++ b/ts/components/IOMarkdown/renderRules.tsx @@ -35,7 +35,7 @@ import { TxtStrNode, TxtStrongNode } from "@textlint/ast-node-types"; -import React, { Fragment, useLayoutEffect, useState } from "react"; +import { Fragment, useLayoutEffect, useState } from "react"; import { Dimensions, Image, Text, View } from "react-native"; import I18n from "../../i18n"; import { openWebUrl } from "../../utils/url"; diff --git a/ts/components/IdpSuccessfulAuthentication.tsx b/ts/components/IdpSuccessfulAuthentication.tsx index fa2a5f89165..53033498ccf 100644 --- a/ts/components/IdpSuccessfulAuthentication.tsx +++ b/ts/components/IdpSuccessfulAuthentication.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { AccessibilityInfo } from "react-native"; import { profileNameSelector } from "../store/reducers/profile"; import I18n from "../i18n"; diff --git a/ts/components/IdpsGrid.tsx b/ts/components/IdpsGrid.tsx index 2addd50363c..43c750bc70b 100644 --- a/ts/components/IdpsGrid.tsx +++ b/ts/components/IdpsGrid.tsx @@ -2,7 +2,7 @@ * A component that show a Grid with every Identity Provider passed in the idps * array property. When an Identity Provider is selected a callback function is called. */ -import * as React from "react"; + import { FlatList, ImageSourcePropType, @@ -13,22 +13,19 @@ import { } from "react-native"; import { - VSpacer, IOSpacingScale, + IOVisualCostants, ModuleIDP, - IOVisualCostants + VSpacer } from "@pagopa/io-app-design-system"; +import { ComponentProps, FunctionComponent, ReactElement } from "react"; import { LocalIdpsFallback } from "../utils/idps"; type OwnProps = { contentContainerStyle?: StyleProp; - footerComponent?: React.ComponentProps< - typeof FlatList - >["ListFooterComponent"]; + footerComponent?: ComponentProps["ListFooterComponent"]; headerComponentStyle?: StyleProp; - headerComponent?: React.ComponentProps< - typeof FlatList - >["ListHeaderComponent"]; + headerComponent?: ComponentProps["ListHeaderComponent"]; // Array of Identity Provider to show in the grid. idps: ReadonlyArray; // A callback function called when an Identity Provider is selected @@ -50,7 +47,7 @@ const keyExtractor = (idp: LocalIdpsFallback): string => idp.id; const renderItem = (props: Props) => - (info: ListRenderItemInfo): React.ReactElement => { + (info: ListRenderItemInfo): ReactElement => { const { onIdpSelected } = props; const { item } = info; const { id, name, logo, localLogo } = item; @@ -69,7 +66,7 @@ const renderItem = ); }; -const IdpsGrid: React.FunctionComponent = (props: Props) => ( +const IdpsGrid: FunctionComponent = (props: Props) => ( { +export default class ItemSeparatorComponent extends PureComponent { public render() { return ( ; + ComponentPropsWithRef; inputProps?: TextInputAdditionalProps; isValid?: boolean; label?: string; @@ -127,12 +127,12 @@ function getColorsByProps({ } const NavigationEventHandler = ({ onPress }: { onPress: () => void }) => { - useFocusEffect(React.useCallback(() => onPress, [onPress])); + useFocusEffect(useCallback(() => onPress, [onPress])); return <>; }; -export const LabelledItem: React.FC = ({ +export const LabelledItem: FC = ({ iconPosition = "left", ...props }: Props) => { diff --git a/ts/components/LandingCardComponent.tsx b/ts/components/LandingCardComponent.tsx index 19f22956374..f034c808084 100644 --- a/ts/components/LandingCardComponent.tsx +++ b/ts/components/LandingCardComponent.tsx @@ -2,7 +2,7 @@ * This component renders the card displayed in the landing page carousel */ -import * as React from "react"; +import { forwardRef } from "react"; import { View, ScrollView, useWindowDimensions } from "react-native"; import { Body, @@ -24,48 +24,46 @@ type Props = { const VERTICAL_SPACING = 16; -export const LandingCardComponent = React.forwardRef( - (props, ref) => { - const screenDimension = useWindowDimensions(); - const screenWidth = screenDimension.width; - const { - accessibilityLabel, - accessibilityHint, - pictogramName, - title, - content - } = props; +export const LandingCardComponent = forwardRef((props, ref) => { + const screenDimension = useWindowDimensions(); + const screenWidth = screenDimension.width; + const { + accessibilityLabel, + accessibilityHint, + pictogramName, + title, + content + } = props; - return ( - + - - - -

- {title} -

- - - {content} - - -
-
- ); - } -); + + +

+ {title} +

+ + + {content} + + +
+
+ ); +}); diff --git a/ts/components/LoadingErrorComponent.tsx b/ts/components/LoadingErrorComponent.tsx index 8fe565d6d07..196168d1976 100644 --- a/ts/components/LoadingErrorComponent.tsx +++ b/ts/components/LoadingErrorComponent.tsx @@ -1,6 +1,6 @@ import { Millisecond } from "@pagopa/ts-commons/lib/units"; -import * as React from "react"; -import { useEffect } from "react"; + +import { createRef, FunctionComponent, useEffect } from "react"; import { ActivityIndicator, SafeAreaView, View } from "react-native"; import { WithTestID } from "../types/WithTestID"; import { setAccessibilityFocus } from "../utils/accessibility"; @@ -18,8 +18,8 @@ export type LoadingErrorProps = WithTestID<{ onAbort?: () => void; }>; -const errorRef = React.createRef(); -const loadingRef = React.createRef(); +const errorRef = createRef(); +const loadingRef = createRef(); const renderError = (props: LoadingErrorProps) => ( = props => { useEffect(() => { diff --git a/ts/components/LoadingSpinnerOverlay.tsx b/ts/components/LoadingSpinnerOverlay.tsx index f90cb318c3e..ce23ba8c9fc 100644 --- a/ts/components/LoadingSpinnerOverlay.tsx +++ b/ts/components/LoadingSpinnerOverlay.tsx @@ -5,7 +5,8 @@ import { hexToRgba, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; + +import { ReactNode } from "react"; import { StyleSheet, View } from "react-native"; import I18n from "../i18n"; import { IOStyles } from "./core/variables/IOStyles"; @@ -19,7 +20,7 @@ const styles = StyleSheet.create({ }); type Props = Readonly<{ - children?: React.ReactNode; + children?: ReactNode; isLoading: boolean; loadingCaption?: string; loadingOpacity?: number; diff --git a/ts/components/PagoPATestIndicator.tsx b/ts/components/PagoPATestIndicator.tsx index 829be62b5d3..20eaf7f4e32 100644 --- a/ts/components/PagoPATestIndicator.tsx +++ b/ts/components/PagoPATestIndicator.tsx @@ -1,5 +1,4 @@ import { IOColors, Icon, hexToRgba } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { StyleSheet, Text, View } from "react-native"; const debugItemBgColor = hexToRgba(IOColors.white, 0.4); diff --git a/ts/components/PagoPATestIndicatorOverlay.tsx b/ts/components/PagoPATestIndicatorOverlay.tsx index a68b0837fee..f57fa9f1917 100644 --- a/ts/components/PagoPATestIndicatorOverlay.tsx +++ b/ts/components/PagoPATestIndicatorOverlay.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { SafeAreaView, StyleSheet } from "react-native"; import PagoPATestIndicator from "./PagoPATestIndicator"; diff --git a/ts/components/QrCodeImage.tsx b/ts/components/QrCodeImage.tsx index aed11f8fe8f..d2d80c2bde4 100644 --- a/ts/components/QrCodeImage.tsx +++ b/ts/components/QrCodeImage.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { useMemo, memo } from "react"; import { useWindowDimensions, View } from "react-native"; import QRCode, { QRCodeProps } from "react-native-qrcode-svg"; import Placeholder from "rn-placeholder"; @@ -30,7 +30,7 @@ const QrCodeImage = ({ accessibilityLabel = defaultAccessibilityLabel }: QrCodeImageProps) => { const { width } = useWindowDimensions(); - const realSize = React.useMemo(() => { + const realSize = useMemo(() => { if (typeof size === "number") { return size; } @@ -61,5 +61,5 @@ const QrCodeImage = ({ ); }; -const MemoizedQrCodeImage = React.memo(QrCodeImage); +const MemoizedQrCodeImage = memo(QrCodeImage); export { MemoizedQrCodeImage as QrCodeImage }; diff --git a/ts/components/SectionStatus/__tests__/index.test.tsx b/ts/components/SectionStatus/__tests__/index.test.tsx index 3123e573464..f848514bb11 100644 --- a/ts/components/SectionStatus/__tests__/index.test.tsx +++ b/ts/components/SectionStatus/__tests__/index.test.tsx @@ -1,6 +1,5 @@ import { fireEvent } from "@testing-library/react-native"; import * as O from "fp-ts/lib/Option"; -import * as React from "react"; import configureMockStore from "redux-mock-store"; import { IOColors } from "@pagopa/io-app-design-system"; import { ToolEnum } from "../../../../definitions/content/AssistanceToolConfig"; diff --git a/ts/components/SectionStatus/index.tsx b/ts/components/SectionStatus/index.tsx index 97f68ad87f0..2b24c97047d 100644 --- a/ts/components/SectionStatus/index.tsx +++ b/ts/components/SectionStatus/index.tsx @@ -1,4 +1,11 @@ -import React, { ComponentProps, useCallback, useEffect, useRef } from "react"; +import { + ComponentProps, + RefObject, + useCallback, + useEffect, + useRef +} from "react"; + import { View } from "react-native"; import { Alert } from "@pagopa/io-app-design-system"; import { LevelEnum } from "../../../definitions/content/SectionStatus"; @@ -17,7 +24,7 @@ import { useIONavigation } from "../../navigation/params/AppParamsList"; type Props = { sectionKey: SectionStatusKey; - onSectionRef?: (ref: React.RefObject) => void; + onSectionRef?: (ref: RefObject) => void; }; const statusVariantMap: Record< diff --git a/ts/components/SectionStatus/modal/index.tsx b/ts/components/SectionStatus/modal/index.tsx index f47db63ab9a..761cd1e928a 100644 --- a/ts/components/SectionStatus/modal/index.tsx +++ b/ts/components/SectionStatus/modal/index.tsx @@ -1,4 +1,11 @@ -import React, { ComponentProps, useCallback, useEffect, useRef } from "react"; +import { + ComponentProps, + RefObject, + useCallback, + useEffect, + useRef +} from "react"; + import { AccessibilityInfo, View } from "react-native"; import { Alert, IOColors } from "@pagopa/io-app-design-system"; import { useSafeAreaInsets } from "react-native-safe-area-context"; @@ -20,7 +27,7 @@ import { isMixpanelEnabled as isMixpanelEnabledSelector } from "../../../store/r type Props = { sectionKey: SectionStatusKey; - onSectionRef?: (ref: React.RefObject) => void; + onSectionRef?: (ref: RefObject) => void; trackingAction?: () => void; sticky?: boolean; }; diff --git a/ts/components/StatusMessages.tsx b/ts/components/StatusMessages.tsx index eb8b07c04e2..bf7ec6e9d7e 100644 --- a/ts/components/StatusMessages.tsx +++ b/ts/components/StatusMessages.tsx @@ -1,11 +1,11 @@ -import React from "react"; import { AlertEdgeToEdgeProps, AlertEdgeToEdgeWrapper } from "@pagopa/io-app-design-system"; +import { PropsWithChildren } from "react"; import { useStatusAlertProps } from "../hooks/useStatusAlertProps"; -type StatusMessagesProps = React.PropsWithChildren; +type StatusMessagesProps = PropsWithChildren; export const StatusMessages = ({ children }: StatusMessagesProps) => { const alertProps: AlertEdgeToEdgeProps | undefined = useStatusAlertProps(); diff --git a/ts/components/TosWebviewComponent.tsx b/ts/components/TosWebviewComponent.tsx index 1ea4b4a61b3..31ab5cb3375 100644 --- a/ts/components/TosWebviewComponent.tsx +++ b/ts/components/TosWebviewComponent.tsx @@ -1,7 +1,7 @@ import { FooterActions, IOStyles } from "@pagopa/io-app-design-system"; import * as E from "fp-ts/lib/Either"; import { pipe } from "fp-ts/lib/function"; -import React, { FunctionComponent, memo, useCallback, useState } from "react"; +import { FunctionComponent, memo, useCallback, useState } from "react"; import { View, ViewProps } from "react-native"; import WebView, { WebViewMessageEvent } from "react-native-webview"; import { WebViewSource } from "react-native-webview/lib/WebViewTypes"; diff --git a/ts/components/TosWebviewErrorComponent.tsx b/ts/components/TosWebviewErrorComponent.tsx index cc578e3cb0c..7080dbd29c7 100644 --- a/ts/components/TosWebviewErrorComponent.tsx +++ b/ts/components/TosWebviewErrorComponent.tsx @@ -5,7 +5,6 @@ import { Pictogram, VSpacer } from "@pagopa/io-app-design-system"; -import React from "react"; import { View } from "react-native"; import I18n from "../i18n"; diff --git a/ts/components/TouchableDefaultOpacity.tsx b/ts/components/TouchableDefaultOpacity.tsx index 06b0739375f..8f893b0230e 100644 --- a/ts/components/TouchableDefaultOpacity.tsx +++ b/ts/components/TouchableDefaultOpacity.tsx @@ -1,15 +1,15 @@ -import * as React from "react"; +import { ComponentPropsWithRef, FunctionComponent } from "react"; import { TouchableOpacity, TouchableOpacityProps } from "react-native"; const defaultActiveOpacity = 1.0; -export type TouchableDefaultOpacityProps = React.ComponentPropsWithRef< +export type TouchableDefaultOpacityProps = ComponentPropsWithRef< typeof TouchableOpacity & TouchableOpacityProps >; /** * return TouchableOpacity component where the activeOpacity is 1.0 by default * instead of 0.2 https://github.com/facebook/react-native/blob/3042407f43b69994abc00350681f1f0a79683bfd/Libraries/Components/Touchable/TouchableOpacity.js#L149 */ -const TouchableDefaultOpacity: React.FunctionComponent< +const TouchableDefaultOpacity: FunctionComponent< TouchableDefaultOpacityProps > = props => ( { const [loading, setLoading] = useState(true); const [hasError, setHasError] = useState(false); - const ref = React.createRef(); + const ref = createRef(); const handleReload = () => { setHasError(false); diff --git a/ts/components/__tests__/ForceScrollDownView.test.tsx b/ts/components/__tests__/ForceScrollDownView.test.tsx index 6483c91041a..9138141b10a 100644 --- a/ts/components/__tests__/ForceScrollDownView.test.tsx +++ b/ts/components/__tests__/ForceScrollDownView.test.tsx @@ -1,5 +1,6 @@ import { fireEvent, render } from "@testing-library/react-native"; -import React, { PropsWithChildren } from "react"; +import { PropsWithChildren, ReactElement } from "react"; + import { Text } from "react-native"; import { Provider } from "react-redux"; import { createStore } from "redux"; @@ -99,7 +100,7 @@ describe("ForceScrollDownView", () => { }); }); -export const renderComponent = (component: React.ReactElement) => { +export const renderComponent = (component: ReactElement) => { const globalState = appReducer(undefined, applicationChangeState("active")); const store = createStore(appReducer, globalState as any); diff --git a/ts/components/__tests__/IOMarkdown.test.tsx b/ts/components/__tests__/IOMarkdown.test.tsx index 4b2bb98bc25..e875cb23999 100644 --- a/ts/components/__tests__/IOMarkdown.test.tsx +++ b/ts/components/__tests__/IOMarkdown.test.tsx @@ -1,5 +1,4 @@ import { render } from "@testing-library/react-native"; -import React from "react"; import IOMarkdown from "../IOMarkdown"; const markdownString: string = ` diff --git a/ts/components/__tests__/LoadingSpinnerOverlay.test.tsx b/ts/components/__tests__/LoadingSpinnerOverlay.test.tsx index 98acfdc04b3..e8ee2cf984b 100644 --- a/ts/components/__tests__/LoadingSpinnerOverlay.test.tsx +++ b/ts/components/__tests__/LoadingSpinnerOverlay.test.tsx @@ -1,11 +1,11 @@ -import * as React from "react"; -import { Text } from "react-native"; import { render } from "@testing-library/react-native"; -import configureMockStore from "redux-mock-store"; +import { ReactNode } from "react"; +import { Text } from "react-native"; import { Provider } from "react-redux"; -import { appReducer } from "../../store/reducers"; +import configureMockStore from "redux-mock-store"; import { applicationChangeState } from "../../store/actions/application"; import { preferencesDesignSystemSetEnabled } from "../../store/actions/persistedPreferences"; +import { appReducer } from "../../store/reducers"; import { GlobalState } from "../../store/reducers/types"; import LoadingSpinnerOverlay from "../LoadingSpinnerOverlay"; @@ -50,7 +50,7 @@ describe("LoadingSpinnerOverlay", () => { const renderComponent = ( isLoading: boolean, - children?: React.ReactNode, + children?: ReactNode, loadingCaption?: string, loadingOpacity?: number, onCancel?: () => void diff --git a/ts/components/__tests__/TosWebviewComponent.test.tsx b/ts/components/__tests__/TosWebviewComponent.test.tsx index 3060cef6412..c2df2e75fae 100644 --- a/ts/components/__tests__/TosWebviewComponent.test.tsx +++ b/ts/components/__tests__/TosWebviewComponent.test.tsx @@ -1,5 +1,4 @@ import { fireEvent, render } from "@testing-library/react-native"; -import * as React from "react"; // import WebView from "react-native-webview"; import renderer from "react-test-renderer"; // import * as O from "fp-ts/lib/Option"; diff --git a/ts/components/__tests__/WebviewComponent.test.tsx b/ts/components/__tests__/WebviewComponent.test.tsx index 9b0fc0c36b2..8348fbb83d5 100644 --- a/ts/components/__tests__/WebviewComponent.test.tsx +++ b/ts/components/__tests__/WebviewComponent.test.tsx @@ -1,7 +1,6 @@ import { render } from "@testing-library/react-native"; import { Provider } from "react-redux"; import configureMockStore from "redux-mock-store"; -import React from "react"; import WebviewComponent from "../WebviewComponent"; import { appReducer } from "../../store/reducers"; import { applicationChangeState } from "../../store/actions/application"; diff --git a/ts/components/animations/ScaleInOutAnimation.tsx b/ts/components/animations/ScaleInOutAnimation.tsx index ae68d0c92d4..d6dfb2b345e 100644 --- a/ts/components/animations/ScaleInOutAnimation.tsx +++ b/ts/components/animations/ScaleInOutAnimation.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { ReactNode } from "react"; import { ViewStyle } from "react-native"; import Animated, { AnimateStyle, @@ -14,7 +14,7 @@ type Props = { springConfig?: WithSpringConfig; delayOut?: number; delayIn?: number; - children: React.ReactNode; + children: ReactNode; style?: ViewStyle; }; diff --git a/ts/components/bottomSheet/BottomSheetHeader.tsx b/ts/components/bottomSheet/BottomSheetHeader.tsx index 1d08d838f5c..193eda25070 100644 --- a/ts/components/bottomSheet/BottomSheetHeader.tsx +++ b/ts/components/bottomSheet/BottomSheetHeader.tsx @@ -1,5 +1,10 @@ -import * as React from "react"; -import { useEffect } from "react"; +import { + createRef, + FunctionComponent, + isValidElement, + ReactNode, + useEffect +} from "react"; import { View, StyleSheet } from "react-native"; import { Millisecond } from "@pagopa/ts-commons/lib/units"; import { @@ -27,16 +32,16 @@ const styles = StyleSheet.create({ }); type Props = { - title: string | React.ReactNode; + title: string | ReactNode; onClose: () => void; }; -export const BottomSheetHeader: React.FunctionComponent = ({ +export const BottomSheetHeader: FunctionComponent = ({ title, onClose }: Props) => { const isDesignSystemEnabled = useIOSelector(isDesignSystemEnabledSelector); - const headerRef = React.createRef(); + const headerRef = createRef(); useEffect(() => { setAccessibilityFocus(headerRef, 1000 as Millisecond); @@ -44,7 +49,7 @@ export const BottomSheetHeader: React.FunctionComponent = ({ return ( - {React.isValidElement(title) ? ( + {isValidElement(title) ? ( title ) : ( { diff --git a/ts/components/cie/CieNotSupported.tsx b/ts/components/cie/CieNotSupported.tsx index b07f3d98c1f..312c71b86ce 100644 --- a/ts/components/cie/CieNotSupported.tsx +++ b/ts/components/cie/CieNotSupported.tsx @@ -11,7 +11,7 @@ import { } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; import { useFocusEffect, useNavigation } from "@react-navigation/native"; -import React, { useRef } from "react"; +import { useRef } from "react"; import { Platform, View } from "react-native"; import I18n from "../../i18n"; import { useIOSelector } from "../../store/hooks"; diff --git a/ts/components/cie/CieRequestAuthenticationOverlay.tsx b/ts/components/cie/CieRequestAuthenticationOverlay.tsx index fdf8022daee..f95e51d8a48 100644 --- a/ts/components/cie/CieRequestAuthenticationOverlay.tsx +++ b/ts/components/cie/CieRequestAuthenticationOverlay.tsx @@ -1,5 +1,12 @@ -import * as React from "react"; -import { createRef, useEffect } from "react"; +import { + createRef, + Dispatch, + ReactElement, + SetStateAction, + useCallback, + useEffect, + useState +} from "react"; import { View, Platform, StyleSheet } from "react-native"; import WebView from "react-native-webview"; import { @@ -118,8 +125,8 @@ type RequestInfoLoadingState = { type RequestInfo = RequestInfoLoadingState | RequestInfoAuthorizedState; function retryRequest( - setInternalState: React.Dispatch>, - setRequestInfo: React.Dispatch> + setInternalState: Dispatch>, + setRequestInfo: Dispatch> ) { setInternalState(generateRetryState); setRequestInfo(requestInfo => ({ @@ -134,11 +141,11 @@ export enum CieEntityIds { } const CieWebView = (props: Props) => { - const [internalState, setInternalState] = React.useState( + const [internalState, setInternalState] = useState( generateResetState() ); - const [requestInfo, setRequestInfo] = React.useState({ + const [requestInfo, setRequestInfo] = useState({ requestState: "LOADING", nativeAttempts: 0 }); @@ -157,7 +164,7 @@ const CieWebView = (props: Props) => { const webView = createRef(); const { onSuccess } = props; - const handleOnError = React.useCallback( + const handleOnError = useCallback( ( e: Error | LoginUtilsError | WebViewErrorEvent | WebViewHttpErrorEvent ) => { @@ -333,9 +340,7 @@ const ErrorComponent = ( * @param props * @constructor */ -export const CieRequestAuthenticationOverlay = ( - props: Props -): React.ReactElement => { +export const CieRequestAuthenticationOverlay = (props: Props): ReactElement => { // Disable android back button useHardwareBackButton(() => { props.onClose(); diff --git a/ts/components/core/selection/RadioButtonList.tsx b/ts/components/core/selection/RadioButtonList.tsx index e4c004d3d18..82674aef8f5 100644 --- a/ts/components/core/selection/RadioButtonList.tsx +++ b/ts/components/core/selection/RadioButtonList.tsx @@ -1,5 +1,4 @@ import { StyleSheet, View } from "react-native"; -import * as React from "react"; import { ReactNode } from "react"; import { H6, IOColors, Icon } from "@pagopa/io-app-design-system"; import { IOStyles } from "../variables/IOStyles"; diff --git a/ts/components/countdown/CountdownProvider.tsx b/ts/components/countdown/CountdownProvider.tsx index 0083d52d2f6..f1cfb20b919 100644 --- a/ts/components/countdown/CountdownProvider.tsx +++ b/ts/components/countdown/CountdownProvider.tsx @@ -1,10 +1,4 @@ -import React, { - createContext, - useContext, - useState, - ReactNode, - useRef -} from "react"; +import { createContext, useContext, useState, ReactNode, useRef } from "react"; import BackgroundTimer from "react-native-background-timer"; type CountdownContextType = { diff --git a/ts/components/debug/DebugDataIndicator.tsx b/ts/components/debug/DebugDataIndicator.tsx index 0f028c14547..c754ef6c884 100644 --- a/ts/components/debug/DebugDataIndicator.tsx +++ b/ts/components/debug/DebugDataIndicator.tsx @@ -6,7 +6,6 @@ import { hexToRgba } from "@pagopa/io-app-design-system"; import _ from "lodash"; -import * as React from "react"; import { Pressable, StyleSheet } from "react-native"; import { useIOSelector } from "../../store/hooks"; import { debugDataSelector } from "../../store/reducers/debug"; diff --git a/ts/components/debug/DebugDataOverlay.tsx b/ts/components/debug/DebugDataOverlay.tsx index 3b01112e977..b94b9f79f56 100644 --- a/ts/components/debug/DebugDataOverlay.tsx +++ b/ts/components/debug/DebugDataOverlay.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { ScrollView, StyleSheet, diff --git a/ts/components/debug/DebugPrettyPrint.tsx b/ts/components/debug/DebugPrettyPrint.tsx index 8c9ab56e8ba..92c17545cef 100644 --- a/ts/components/debug/DebugPrettyPrint.tsx +++ b/ts/components/debug/DebugPrettyPrint.tsx @@ -10,7 +10,7 @@ import { IconButton, useIOToast } from "@pagopa/io-app-design-system"; -import React from "react"; +import { useState, useMemo } from "react"; import { StyleSheet, View } from "react-native"; import RNFS from "react-native-fs"; import Share from "react-native-share"; @@ -44,9 +44,9 @@ type Props = Prettify< export const DebugPrettyPrint = withDebugEnabled( ({ title, data, expandable = true, isExpanded = false }: Props) => { const toast = useIOToast(); - const [expanded, setExpanded] = React.useState(isExpanded); + const [expanded, setExpanded] = useState(isExpanded); - const content = React.useMemo(() => { + const content = useMemo(() => { if ((expandable && !expanded) || !expandable) { return null; } diff --git a/ts/components/debug/DebugView.tsx b/ts/components/debug/DebugView.tsx index 1ef44f14007..9a6739f0470 100644 --- a/ts/components/debug/DebugView.tsx +++ b/ts/components/debug/DebugView.tsx @@ -3,7 +3,8 @@ import { IOVisualCostants, ListItemHeader } from "@pagopa/io-app-design-system"; -import React from "react"; + +import { PropsWithChildren } from "react"; import { View } from "react-native"; import { withDebugEnabled } from "./withDebugEnabled"; @@ -20,7 +21,7 @@ export const DebugView = withDebugEnabled( children, title = "Debug", ignoreHorizontalMargins = false - }: React.PropsWithChildren) => ( + }: PropsWithChildren) => ( (WrappedComponent: React.ComponentType

) => + (WrappedComponent: ComponentType

) => (props: P) => { const isDebug = useIOSelector(isDebugModeEnabledSelector); if (!isDebug) { diff --git a/ts/components/error/WorkunitGenericFailure.tsx b/ts/components/error/WorkunitGenericFailure.tsx index ccfa0b58d4a..2383cc750cc 100644 --- a/ts/components/error/WorkunitGenericFailure.tsx +++ b/ts/components/error/WorkunitGenericFailure.tsx @@ -1,5 +1,6 @@ import { FooterActions } from "@pagopa/io-app-design-system"; -import * as React from "react"; + +import { ReactElement } from "react"; import { SafeAreaView } from "react-native"; import { connect } from "react-redux"; import { Dispatch } from "redux"; @@ -25,7 +26,7 @@ const loadLocales = () => ({ * @constructor * @param props */ -const WorkunitGenericFailure = (props: Props): React.ReactElement => { +const WorkunitGenericFailure = (props: Props): ReactElement => { const { headerTitle, title, close } = loadLocales(); return ( diff --git a/ts/components/helpers/withLightModalContext.tsx b/ts/components/helpers/withLightModalContext.tsx index c22588f2ffd..afde35de73d 100644 --- a/ts/components/helpers/withLightModalContext.tsx +++ b/ts/components/helpers/withLightModalContext.tsx @@ -4,17 +4,17 @@ */ import hoistNonReactStatics from "hoist-non-react-statics"; -import React from "react"; +import { Component, ComponentType } from "react"; import { LightModalConsumer, LightModalContextInterface } from "../ui/LightModal"; export function withLightModalContext

( - WrappedComponent: React.ComponentType

+ WrappedComponent: ComponentType

) { - class WithLightModalContext extends React.Component

{ + class WithLightModalContext extends Component

{ public render() { return ( diff --git a/ts/components/helpers/withLoadingSpinner.tsx b/ts/components/helpers/withLoadingSpinner.tsx index 5a3e39b844d..71d784a2010 100644 --- a/ts/components/helpers/withLoadingSpinner.tsx +++ b/ts/components/helpers/withLoadingSpinner.tsx @@ -1,5 +1,6 @@ import hoistNonReactStatics from "hoist-non-react-statics"; -import * as React from "react"; + +import { Component, ComponentType } from "react"; import LoadingSpinnerOverlay from "../LoadingSpinnerOverlay"; /** @@ -15,8 +16,8 @@ export function withLoadingSpinner< loadingOpacity?: number; onCancel?: any; }> ->(WrappedComponent: React.ComponentType

) { - class WithLoadingSpinner extends React.Component

{ +>(WrappedComponent: ComponentType

) { + class WithLoadingSpinner extends Component

{ public render() { const { isLoading, loadingCaption, loadingOpacity, onCancel } = this.props; diff --git a/ts/components/helpers/withUseTabItemPressWhenScreenActive.tsx b/ts/components/helpers/withUseTabItemPressWhenScreenActive.tsx index 2fa793b9b34..6c37ada60e8 100644 --- a/ts/components/helpers/withUseTabItemPressWhenScreenActive.tsx +++ b/ts/components/helpers/withUseTabItemPressWhenScreenActive.tsx @@ -1,13 +1,14 @@ -import React, { useState } from "react"; +import { ComponentType, Dispatch, SetStateAction, useState } from "react"; + import { useTabItemPressWhenScreenActive } from "../../hooks/useTabItemPressWhenScreenActive"; export type TabBarItemPressType = { - setTabPressCallback: React.Dispatch void>>; - setHasInternalTab: React.Dispatch>; + setTabPressCallback: Dispatch void>>; + setHasInternalTab: Dispatch>; }; export function withUseTabItemPressWhenScreenActive

( - WrappedComponent: React.ComponentType

+ WrappedComponent: ComponentType

) { return (props: any) => { const [callback, setTabPressCallback] = useState<() => void>(() => void 0); diff --git a/ts/components/infoScreen/InfoScreenComponent.tsx b/ts/components/infoScreen/InfoScreenComponent.tsx index c5fd14a2c90..0c48fb4719b 100644 --- a/ts/components/infoScreen/InfoScreenComponent.tsx +++ b/ts/components/infoScreen/InfoScreenComponent.tsx @@ -1,15 +1,16 @@ import { Body, H4, VSpacer } from "@pagopa/io-app-design-system"; import { useFocusEffect } from "@react-navigation/native"; -import * as React from "react"; + +import { createRef, FunctionComponent, ReactNode, useCallback } from "react"; import { StyleSheet, Text, View } from "react-native"; import themeVariables from "../../theme/variables"; import { setAccessibilityFocus } from "../../utils/accessibility"; type Props = { - image: React.ReactNode; + image: ReactNode; title: string; // this is necessary in order to render text with different formatting - body?: string | React.ReactNode; + body?: string | ReactNode; }; const styles = StyleSheet.create({ @@ -24,7 +25,7 @@ const styles = StyleSheet.create({ } }); -const renderNode = (body: string | React.ReactNode) => { +const renderNode = (body: string | ReactNode) => { if (typeof body === "string") { return ( @@ -42,10 +43,10 @@ const renderNode = (body: string | React.ReactNode) => { * @param props * @constructor */ -export const InfoScreenComponent: React.FunctionComponent = props => { - const elementRef = React.createRef(); +export const InfoScreenComponent: FunctionComponent = props => { + const elementRef = createRef(); useFocusEffect( - React.useCallback(() => setAccessibilityFocus(elementRef), [elementRef]) + useCallback(() => setAccessibilityFocus(elementRef), [elementRef]) ); return ( diff --git a/ts/components/infoScreen/imageRendering.tsx b/ts/components/infoScreen/imageRendering.tsx index 1e066db10fa..3245565ccad 100644 --- a/ts/components/infoScreen/imageRendering.tsx +++ b/ts/components/infoScreen/imageRendering.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { Dimensions, Image, diff --git a/ts/components/screens/BadgeComponent.tsx b/ts/components/screens/BadgeComponent.tsx index fd4f3dd4b78..168d1858ba8 100644 --- a/ts/components/screens/BadgeComponent.tsx +++ b/ts/components/screens/BadgeComponent.tsx @@ -2,7 +2,7 @@ * A component to render the circolar badge * TODO: use the same component on all lists (messages, transaction): https://www.pivotaltracker.com/story/show/167064275 */ -import * as React from "react"; +import { PureComponent } from "react"; import { Circle, Svg } from "react-native-svg"; import customVariables from "../../theme/variables"; @@ -12,7 +12,7 @@ type Props = { color?: string; }; -export class BadgeComponent extends React.PureComponent { +export class BadgeComponent extends PureComponent { public render() { return ( diff --git a/ts/components/screens/BaseHeader.tsx b/ts/components/screens/BaseHeader.tsx index d5b0f0e2aed..6385e130fe8 100644 --- a/ts/components/screens/BaseHeader.tsx +++ b/ts/components/screens/BaseHeader.tsx @@ -1,27 +1,36 @@ import { Millisecond } from "@pagopa/ts-commons/lib/units"; import { pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; -import * as React from "react"; -import { FC, Ref } from "react"; -import { - View, - AccessibilityInfo, - ColorValue, - StyleSheet, - Text -} from "react-native"; -import { connect } from "react-redux"; + import { - IOColors, - IOIcons, + Body, + HSpacer, Icon, IconButton, - HSpacer, + IOColors, + IOIcons, IOSpacer, - IOStyles, - Body + IOStyles } from "@pagopa/io-app-design-system"; import { useFocusEffect } from "@react-navigation/native"; +import { + ComponentProps, + createRef, + FC, + PureComponent, + ReactNode, + Ref, + RefObject, + useCallback +} from "react"; +import { + AccessibilityInfo, + ColorValue, + StyleSheet, + Text, + View +} from "react-native"; +import { connect } from "react-redux"; import I18n from "../../i18n"; import { navigateBack } from "../../store/actions/navigation"; import { Dispatch } from "../../store/actions/types"; @@ -80,13 +89,13 @@ interface OwnProps { dark?: boolean; // Used only for Icons color TODO Think to use titleColor as unique prop for icons color too headerTitle?: string; backgroundColor?: ColorValue; - goBack?: React.ComponentProps["goBack"]; + goBack?: ComponentProps["goBack"]; primary?: boolean; // Used only for Icons color TODO Think to use titleColor as unique prop for icons color too hideSafeArea?: boolean; appLogo?: boolean; onShowHelp?: () => void; // A property to set a custom AppHeader body - body?: React.ReactNode; + body?: ReactNode; isSearchAvailable?: { enabled: true; searchType?: SearchType; @@ -98,7 +107,7 @@ interface OwnProps { onPress: () => void; accessibilityLabel: string; }; - customGoBack?: React.ReactNode; + customGoBack?: ReactNode; titleColor?: IOColors; backButtonTestID?: string; } @@ -119,8 +128,8 @@ const noReferenceTimeout = 150 as Millisecond; * library, please use `useHeaderSecondLevel` and configure the navigator with `headerShown` * set to `true`. If in doubt, please ask for help or read the available documentation. */ -class BaseHeaderComponent extends React.PureComponent { - private firstElementRef = React.createRef(); +class BaseHeaderComponent extends PureComponent { + private firstElementRef = createRef(); public constructor(props: Props) { super(props); @@ -182,7 +191,7 @@ class BaseHeaderComponent extends React.PureComponent { return; } setAccessibilityFocus( - this.firstElementRef as React.RefObject, + this.firstElementRef as RefObject, setAccessibilityTimeout, this.props.onAccessibilityNavigationHeaderFocus ); @@ -381,7 +390,7 @@ class BaseHeaderComponent extends React.PureComponent { const NavigationEventHandler = ({ onFocus }: { onFocus: () => void }) => { useFocusEffect( - React.useCallback(() => { + useCallback(() => { onFocus(); }, [onFocus]) ); diff --git a/ts/components/screens/BaseScreenComponent/__tests__/BaseScreenComponent.test.tsx b/ts/components/screens/BaseScreenComponent/__tests__/BaseScreenComponent.test.tsx index 6d945053252..aabad20fe90 100644 --- a/ts/components/screens/BaseScreenComponent/__tests__/BaseScreenComponent.test.tsx +++ b/ts/components/screens/BaseScreenComponent/__tests__/BaseScreenComponent.test.tsx @@ -1,6 +1,5 @@ import { fireEvent } from "@testing-library/react-native"; import * as O from "fp-ts/lib/Option"; -import React from "react"; import { Store } from "redux"; import configureMockStore from "redux-mock-store"; import { ToolEnum } from "../../../../../definitions/content/AssistanceToolConfig"; diff --git a/ts/components/screens/BaseScreenComponent/index.tsx b/ts/components/screens/BaseScreenComponent/index.tsx index cf16250ccd3..1d919596dee 100644 --- a/ts/components/screens/BaseScreenComponent/index.tsx +++ b/ts/components/screens/BaseScreenComponent/index.tsx @@ -1,4 +1,5 @@ -import React, { ComponentProps, PropsWithChildren } from "react"; +import { ComponentProps, PropsWithChildren, ReactNode } from "react"; + import { ColorValue, View } from "react-native"; import { ToolEnum } from "../../../../definitions/content/AssistanceToolConfig"; import { TranslationKeys } from "../../../../locales/locales"; @@ -31,7 +32,7 @@ interface OwnProps { accessibilityLabel?: string; contextualHelp?: ContextualHelpProps; contextualHelpMarkdown?: ContextualHelpPropsMarkdown; - headerBody?: React.ReactNode; + headerBody?: ReactNode; headerBackgroundColor?: ColorValue; hideBaseHeader?: boolean; appLogo?: boolean; diff --git a/ts/components/screens/CustomWizardScreen.tsx b/ts/components/screens/CustomWizardScreen.tsx index bd4486feb07..bd22fe2d4a0 100644 --- a/ts/components/screens/CustomWizardScreen.tsx +++ b/ts/components/screens/CustomWizardScreen.tsx @@ -14,7 +14,6 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import { SafeAreaView } from "react-native-safe-area-context"; -import * as React from "react"; import { StyleSheet, View } from "react-native"; export type CustomWizardScreenProps = { diff --git a/ts/components/screens/GenericErrorComponent.tsx b/ts/components/screens/GenericErrorComponent.tsx index 2f958db2123..a12116e8f7b 100644 --- a/ts/components/screens/GenericErrorComponent.tsx +++ b/ts/components/screens/GenericErrorComponent.tsx @@ -9,8 +9,8 @@ import { import { useFocusEffect } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import * as React from "react"; -import { useMemo } from "react"; + +import { createRef, Fragment, RefObject, useCallback, useMemo } from "react"; import { Image, ImageSourcePropType, @@ -33,7 +33,7 @@ type Props = WithTestID< subText?: string; retryButtonTitle?: string; cancelButtonTitle?: string; - ref?: React.RefObject; + ref?: RefObject; }> >; @@ -45,7 +45,7 @@ const styles = StyleSheet.create({ ** @deprecated Use `OperationResultScreen` instead */ const GenericErrorComponent = (props: Props) => { - const ref = useMemo(() => props.ref ?? React.createRef(), [props.ref]); + const ref = useMemo(() => props.ref ?? createRef(), [props.ref]); const renderFooterButtons = () => props.onCancel ? ( @@ -84,7 +84,7 @@ const GenericErrorComponent = (props: Props) => { ); useFocusEffect( - React.useCallback(() => { + useCallback(() => { if (props.avoidNavigationEvents !== true) { setAccessibilityFocus(ref); } @@ -92,7 +92,7 @@ const GenericErrorComponent = (props: Props) => { ); return ( - + { {renderFooterButtons()} - + ); }; diff --git a/ts/components/screens/ListItemComponent.tsx b/ts/components/screens/ListItemComponent.tsx index 408ed1bd8ab..3a433d44750 100644 --- a/ts/components/screens/ListItemComponent.tsx +++ b/ts/components/screens/ListItemComponent.tsx @@ -10,7 +10,7 @@ import { NativeSwitch, VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; +import { Component } from "react"; import { AccessibilityRole, AccessibilityState, @@ -93,7 +93,7 @@ const styles = StyleSheet.create({ * * @deprecated It should be more appropriate to use a proper list item or just let the Flatlist handle the rendering. */ -export default class ListItemComponent extends React.Component { +export default class ListItemComponent extends Component { public render() { const ICON_SIZE: IOIconSizeScale = this.props.iconSize ? this.props.iconSize diff --git a/ts/components/screens/LoadingScreenContent.tsx b/ts/components/screens/LoadingScreenContent.tsx index f80998e3bca..2708e6342d3 100644 --- a/ts/components/screens/LoadingScreenContent.tsx +++ b/ts/components/screens/LoadingScreenContent.tsx @@ -8,7 +8,8 @@ import { useIOTheme, VStack } from "@pagopa/io-app-design-system"; -import * as React from "react"; + +import { ReactNode, useEffect } from "react"; import { AccessibilityInfo, Platform, StyleSheet, View } from "react-native"; import { SafeAreaView } from "react-native-safe-area-context"; import { LoadingIndicator } from "../../components/ui/LoadingIndicator"; @@ -29,7 +30,7 @@ const SPACE_BETWEEN_SPINNER_AND_TEXT = 24; type LoadingScreenContentProps = WithTestID<{ contentTitle: string; - children?: React.ReactNode; + children?: ReactNode; headerVisible?: boolean; animatedPictogramSource?: AnimatedPictogramSource; }>; @@ -44,7 +45,7 @@ export const LoadingScreenContent = (props: LoadingScreenContentProps) => { animatedPictogramSource } = props; - React.useEffect(() => { + useEffect(() => { // Since the screen is shown for a very short time, // we prefer to announce the content to the screen reader, // instead of focusing the first element. diff --git a/ts/components/screens/LogoutScreen.tsx b/ts/components/screens/LogoutScreen.tsx index 9fe00595547..e995b49075e 100644 --- a/ts/components/screens/LogoutScreen.tsx +++ b/ts/components/screens/LogoutScreen.tsx @@ -1,5 +1,4 @@ import { connect } from "react-redux"; -import * as React from "react"; import { useEffect } from "react"; import { Dispatch } from "../../store/actions/types"; import { logoutRequest } from "../../store/actions/authentication"; diff --git a/ts/components/screens/OperationResultScreenContent.tsx b/ts/components/screens/OperationResultScreenContent.tsx index b118aaee76e..fe162995686 100644 --- a/ts/components/screens/OperationResultScreenContent.tsx +++ b/ts/components/screens/OperationResultScreenContent.tsx @@ -14,7 +14,7 @@ import { VSpacer, WithTestID } from "@pagopa/io-app-design-system"; -import React, { +import { cloneElement, forwardRef, isValidElement, diff --git a/ts/components/screens/PinCreation/PinCarouselItem.tsx b/ts/components/screens/PinCreation/PinCarouselItem.tsx index 61e83468f19..667e6c2b7e2 100644 --- a/ts/components/screens/PinCreation/PinCarouselItem.tsx +++ b/ts/components/screens/PinCreation/PinCarouselItem.tsx @@ -6,7 +6,7 @@ import { Body, WithTestID } from "@pagopa/io-app-design-system"; -import React, { RefObject, memo } from "react"; +import { RefObject, memo } from "react"; import { Dimensions, View } from "react-native"; const { width } = Dimensions.get("screen"); diff --git a/ts/components/screens/PinCreation/PinCreation.tsx b/ts/components/screens/PinCreation/PinCreation.tsx index 5e14b599b05..4653985c215 100644 --- a/ts/components/screens/PinCreation/PinCreation.tsx +++ b/ts/components/screens/PinCreation/PinCreation.tsx @@ -9,7 +9,7 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import { Millisecond } from "@pagopa/ts-commons/lib/units"; -import React, { useCallback, useRef, useState } from "react"; +import { useCallback, useRef, useState } from "react"; import { View, Alert as NativeAlert, Dimensions, Platform } from "react-native"; import { FlatList } from "react-native-gesture-handler"; import { defaultPin } from "../../../config"; diff --git a/ts/components/screens/PinCreation/usePinValidationBottomSheet.tsx b/ts/components/screens/PinCreation/usePinValidationBottomSheet.tsx index 3d4c9f76905..9dbdf2beace 100644 --- a/ts/components/screens/PinCreation/usePinValidationBottomSheet.tsx +++ b/ts/components/screens/PinCreation/usePinValidationBottomSheet.tsx @@ -1,5 +1,5 @@ import { VSpacer, Body } from "@pagopa/io-app-design-system"; -import React, { memo } from "react"; +import { memo } from "react"; import { View } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import I18n from "../../../i18n"; diff --git a/ts/components/screens/TopScreenComponent.tsx b/ts/components/screens/TopScreenComponent.tsx index 8596b5822af..eea3b70c91e 100644 --- a/ts/components/screens/TopScreenComponent.tsx +++ b/ts/components/screens/TopScreenComponent.tsx @@ -1,5 +1,5 @@ -import * as React from "react"; import type { IOColors, IOIcons } from "@pagopa/io-app-design-system"; +import { ComponentProps, PropsWithChildren, PureComponent } from "react"; import { FAQsCategoriesType } from "../../utils/faq"; import { AccessibilityEvents } from "./BaseHeader"; import BaseScreenComponent from "./BaseScreenComponent"; @@ -31,19 +31,16 @@ type BaseScreenComponentProps = | "hideSafeArea"; type Props = OwnProps & - Pick< - React.ComponentProps, - BaseScreenComponentProps - >; + Pick, BaseScreenComponentProps>; -export type TopScreenComponentProps = React.PropsWithChildren; +export type TopScreenComponentProps = PropsWithChildren; /** * It wraps a `BaseScreenComponent` with a title and an optional subtitle * @deprecated This component wraps the `BaseScreenComponent` component, which is marked as deprecated. * Please read the `BaseScreenComponent` deprecation note to understand how to replace it. */ -class TopScreenComponent extends React.PureComponent { +class TopScreenComponent extends PureComponent { public render() { const { dark, diff --git a/ts/components/screens/__tests__/LoadingScreenContent.test.tsx b/ts/components/screens/__tests__/LoadingScreenContent.test.tsx index 16c1167f5eb..2143a93a342 100644 --- a/ts/components/screens/__tests__/LoadingScreenContent.test.tsx +++ b/ts/components/screens/__tests__/LoadingScreenContent.test.tsx @@ -1,32 +1,32 @@ -import React from "react"; +import { ComponentProps } from "react"; import { Text } from "react-native"; import { createStore } from "redux"; -import LoadingScreenContent from "../LoadingScreenContent"; -import { appReducer } from "../../../store/reducers"; import { applicationChangeState } from "../../../store/actions/application"; -import { renderScreenWithNavigationStoreContext } from "../../../utils/testWrapper"; -import { GlobalState } from "../../../store/reducers/types"; import { preferencesDesignSystemSetEnabled } from "../../../store/actions/persistedPreferences"; +import { appReducer } from "../../../store/reducers"; +import { GlobalState } from "../../../store/reducers/types"; +import { renderScreenWithNavigationStoreContext } from "../../../utils/testWrapper"; +import LoadingScreenContent from "../LoadingScreenContent"; describe("LoadingScreenContent", () => { it("should match the snapshot with title, no children, header hidden", () => { const defaultProps = { contentTitle: "Test Content Title" - } as React.ComponentProps; + } as ComponentProps; expect(renderComponent(defaultProps)).toMatchSnapshot(); }); it("should match the snapshot with title, no children, header shown", () => { const defaultProps = { contentTitle: "Test Content Title", headerVisible: true - } as React.ComponentProps; + } as ComponentProps; expect(renderComponent(defaultProps)).toMatchSnapshot(); }); it("should match the snapshot with title, a child, header hidden", () => { const defaultProps = { contentTitle: "Test Content Title", children: {"My test child"} - } as React.ComponentProps; + } as ComponentProps; expect(renderComponent(defaultProps)).toMatchSnapshot(); }); it("should match the snapshot with title, a child, header shown", () => { @@ -34,14 +34,12 @@ describe("LoadingScreenContent", () => { contentTitle: "Test Content Title", children: {"My test child"}, headerVisible: true - } as React.ComponentProps; + } as ComponentProps; expect(renderComponent(defaultProps)).toMatchSnapshot(); }); }); -function renderComponent( - props: React.ComponentProps -) { +function renderComponent(props: ComponentProps) { const globalState = appReducer(undefined, applicationChangeState("active")); const designSystemEnabledState = appReducer( globalState, diff --git a/ts/components/screens/__tests__/OperationResultScreenContent.test.tsx b/ts/components/screens/__tests__/OperationResultScreenContent.test.tsx index f4b2b893537..3f9fa67bfef 100644 --- a/ts/components/screens/__tests__/OperationResultScreenContent.test.tsx +++ b/ts/components/screens/__tests__/OperationResultScreenContent.test.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { ComponentProps } from "react"; import { createStore } from "redux"; import ROUTES from "../../../navigation/routes"; import { applicationChangeState } from "../../../store/actions/application"; @@ -32,7 +32,7 @@ describe("OperationResultScreenContent", () => { }); function renderComponent( - props: React.ComponentProps + props: ComponentProps ) { const globalState = appReducer(undefined, applicationChangeState("active")); return renderScreenWithNavigationStoreContext( diff --git a/ts/components/screens/__tests__/PinCreation.test.tsx b/ts/components/screens/__tests__/PinCreation.test.tsx index 2161eb87013..40462cde6d2 100644 --- a/ts/components/screens/__tests__/PinCreation.test.tsx +++ b/ts/components/screens/__tests__/PinCreation.test.tsx @@ -1,5 +1,4 @@ import { render, fireEvent } from "@testing-library/react-native"; -import React from "react"; import { Provider } from "react-redux"; import { PreloadedState, createStore } from "redux"; import { Alert } from "react-native"; diff --git a/ts/components/search/SearchButton.tsx b/ts/components/search/SearchButton.tsx index 90204e25411..36dc519b6e4 100644 --- a/ts/components/search/SearchButton.tsx +++ b/ts/components/search/SearchButton.tsx @@ -1,5 +1,5 @@ import debounce from "lodash/debounce"; -import * as React from "react"; +import { Component } from "react"; import { connect } from "react-redux"; import { pipe } from "fp-ts/lib/function"; @@ -33,7 +33,7 @@ type State = { debouncedSearchText: O.Option; }; -class SearchButton extends React.Component { +class SearchButton extends Component { constructor(props: Props) { super(props); this.state = { diff --git a/ts/components/ui/ActivityIndicator.tsx b/ts/components/ui/ActivityIndicator.tsx index 68688ad935b..9488f64b86a 100644 --- a/ts/components/ui/ActivityIndicator.tsx +++ b/ts/components/ui/ActivityIndicator.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { ActivityIndicator as RNActivityIndicator, ActivityIndicatorProps diff --git a/ts/components/ui/AlertModal.tsx b/ts/components/ui/AlertModal.tsx index 0cf5dd53906..599b683a409 100644 --- a/ts/components/ui/AlertModal.tsx +++ b/ts/components/ui/AlertModal.tsx @@ -4,7 +4,6 @@ import { IOVisualCostants, hexToRgba } from "@pagopa/io-app-design-system"; -import React from "react"; import { StyleSheet, View } from "react-native"; import { useHardwareBackButton } from "../../hooks/useHardwareBackButton"; import themeVariables from "../../theme/variables"; diff --git a/ts/components/ui/AnimatedPictogramComponent.tsx b/ts/components/ui/AnimatedPictogramComponent.tsx index 1a4cf352354..ac5e0cdc2fb 100644 --- a/ts/components/ui/AnimatedPictogramComponent.tsx +++ b/ts/components/ui/AnimatedPictogramComponent.tsx @@ -1,7 +1,7 @@ -import React from "react"; import LottieView from "lottie-react-native"; +import { ComponentProps } from "react"; -export type AnimatedPictogramSource = React.ComponentProps< +export type AnimatedPictogramSource = ComponentProps< typeof LottieView >["source"]; diff --git a/ts/components/ui/AppHeader.tsx b/ts/components/ui/AppHeader.tsx index 91191a01aea..a50a69799d7 100644 --- a/ts/components/ui/AppHeader.tsx +++ b/ts/components/ui/AppHeader.tsx @@ -1,10 +1,11 @@ /** * A customized Header component. */ -import * as React from "react"; -import { View, ColorValue, ViewProps, StatusBar } from "react-native"; -import { useSafeAreaInsets } from "react-native-safe-area-context"; + import { IOStyles, IOVisualCostants } from "@pagopa/io-app-design-system"; +import { PropsWithChildren } from "react"; +import { ColorValue, StatusBar, View, ViewProps } from "react-native"; +import { useSafeAreaInsets } from "react-native-safe-area-context"; import variables from "../../theme/variables"; type Props = ViewProps & { @@ -12,7 +13,7 @@ type Props = ViewProps & { hideSafeArea?: boolean; }; -const AppHeader = (props: React.PropsWithChildren) => { +const AppHeader = (props: PropsWithChildren) => { const { top } = useSafeAreaInsets(); return ( ; + viewRef?: RefObject; // A11y related props accessibilityLabel?: string; accessibilityHint?: string; diff --git a/ts/components/ui/BoxedRefreshIndicator.tsx b/ts/components/ui/BoxedRefreshIndicator.tsx index fd10012aa4e..ca4e53fae0d 100644 --- a/ts/components/ui/BoxedRefreshIndicator.tsx +++ b/ts/components/ui/BoxedRefreshIndicator.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { ReactNode } from "react"; import { StyleSheet, View } from "react-native"; import { LoadingIndicator } from "./LoadingIndicator"; @@ -12,8 +12,8 @@ const styles = StyleSheet.create({ }); type Props = { - action?: React.ReactNode; - caption?: React.ReactNode; + action?: ReactNode; + caption?: ReactNode; }; const BoxedRefreshIndicator = ({ action, caption }: Props) => ( diff --git a/ts/components/ui/CircularProgress.tsx b/ts/components/ui/CircularProgress.tsx index a72849012a2..abbd79f456c 100644 --- a/ts/components/ui/CircularProgress.tsx +++ b/ts/components/ui/CircularProgress.tsx @@ -1,4 +1,5 @@ -import React, { useEffect } from "react"; +import { ReactNode, useEffect } from "react"; + import { StyleSheet, View, ColorValue } from "react-native"; import Animated, { useAnimatedProps, @@ -15,7 +16,7 @@ type CircularProgressProps = { strokeColor: ColorValue; strokeBgColor: ColorValue; strokeWidth: number; - children?: React.ReactNode; + children?: ReactNode; }; export const CircularProgress = ({ diff --git a/ts/components/ui/Dismissable.tsx b/ts/components/ui/Dismissable.tsx index 9a9354b3612..017804d3721 100644 --- a/ts/components/ui/Dismissable.tsx +++ b/ts/components/ui/Dismissable.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { ReactNode } from "react"; import { Dimensions } from "react-native"; import { Gesture, GestureDetector } from "react-native-gesture-handler"; import Animated, { @@ -16,7 +16,7 @@ const windowWidth = Dimensions.get("window").width; type Dismissable = WithTestID<{ onDismiss?: () => void; dismissThreshold?: number; - children: React.ReactNode; + children: ReactNode; }>; /** diff --git a/ts/components/ui/FocusAwareStatusBar.tsx b/ts/components/ui/FocusAwareStatusBar.tsx index 42a85f1a432..f032bffd77d 100644 --- a/ts/components/ui/FocusAwareStatusBar.tsx +++ b/ts/components/ui/FocusAwareStatusBar.tsx @@ -1,5 +1,4 @@ import { useIsFocused } from "@react-navigation/native"; -import * as React from "react"; import { StatusBar, StatusBarProps } from "react-native"; /** diff --git a/ts/components/ui/FooterActions.tsx b/ts/components/ui/FooterActions.tsx index ee60f98ff09..f5c5e0bfb6e 100644 --- a/ts/components/ui/FooterActions.tsx +++ b/ts/components/ui/FooterActions.tsx @@ -12,7 +12,6 @@ import { useIOExperimentalDesign, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { ComponentProps, Fragment, PropsWithChildren, useState } from "react"; import { ColorValue, diff --git a/ts/components/ui/HeaderFirstLevel.tsx b/ts/components/ui/HeaderFirstLevel.tsx index 116e149280d..6485d7d7a56 100644 --- a/ts/components/ui/HeaderFirstLevel.tsx +++ b/ts/components/ui/HeaderFirstLevel.tsx @@ -9,7 +9,6 @@ import { alertEdgeToEdgeInsetTransitionConfig, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { createRef, useEffect, useLayoutEffect } from "react"; import { AccessibilityInfo, diff --git a/ts/components/ui/IOScrollView.tsx b/ts/components/ui/IOScrollView.tsx index d6767dfbaff..1d2c3c22fde 100644 --- a/ts/components/ui/IOScrollView.tsx +++ b/ts/components/ui/IOScrollView.tsx @@ -14,14 +14,16 @@ import { useIOTheme } from "@pagopa/io-app-design-system"; import { useNavigation } from "@react-navigation/native"; -import * as React from "react"; + import { + useMemo, ComponentProps, Fragment, PropsWithChildren, useLayoutEffect, useState } from "react"; + import { ColorValue, LayoutChangeEvent, @@ -246,7 +248,7 @@ export const IOScrollView = ({ ) })); - const ignoreSafeAreaMargin = React.useMemo(() => { + const ignoreSafeAreaMargin = useMemo(() => { if (alertProps !== undefined) { return true; } diff --git a/ts/components/ui/IOScrollViewCentredContent.tsx b/ts/components/ui/IOScrollViewCentredContent.tsx index b6ae00ce6de..6045c78b07d 100644 --- a/ts/components/ui/IOScrollViewCentredContent.tsx +++ b/ts/components/ui/IOScrollViewCentredContent.tsx @@ -8,7 +8,6 @@ import { Pictogram, VStack } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { ComponentProps } from "react"; import { View } from "react-native"; import { IOScrollView, IOScrollViewActions } from "./IOScrollView"; diff --git a/ts/components/ui/IOScrollViewWithLargeHeader.tsx b/ts/components/ui/IOScrollViewWithLargeHeader.tsx index 7439b7f5fc6..2f74f45f131 100644 --- a/ts/components/ui/IOScrollViewWithLargeHeader.tsx +++ b/ts/components/ui/IOScrollViewWithLargeHeader.tsx @@ -11,7 +11,8 @@ import { useIOTheme } from "@pagopa/io-app-design-system"; import { useNavigation } from "@react-navigation/native"; -import React, { ComponentProps, forwardRef, useState } from "react"; +import { ComponentProps, forwardRef, ReactNode, useState } from "react"; + import { LayoutChangeEvent, View } from "react-native"; import { BackProps, @@ -32,7 +33,7 @@ export type LargeHeaderTitleProps = { type Props = WithTestID< { - children?: React.ReactNode; + children?: ReactNode; actions?: ComponentProps["actions"]; title: LargeHeaderTitleProps; description?: string | Array; diff --git a/ts/components/ui/IOScrollViewWithListItems.tsx b/ts/components/ui/IOScrollViewWithListItems.tsx index 457c0f495f8..c105b47eb97 100644 --- a/ts/components/ui/IOScrollViewWithListItems.tsx +++ b/ts/components/ui/IOScrollViewWithListItems.tsx @@ -8,7 +8,6 @@ import { ListItemInfo, VSpacer } from "@pagopa/io-app-design-system"; -import React from "react"; import { View } from "react-native"; import { IOScrollView, IOScrollViewActions } from "./IOScrollView"; diff --git a/ts/components/ui/LightModal.tsx b/ts/components/ui/LightModal.tsx index 3c44343f393..a64e3a4f81d 100644 --- a/ts/components/ui/LightModal.tsx +++ b/ts/components/ui/LightModal.tsx @@ -3,7 +3,7 @@ * on top of the root component. */ -import React from "react"; +import { Component, createContext } from "react"; import { Animated, Dimensions, @@ -13,7 +13,6 @@ import { View } from "react-native"; import { isScreenReaderEnabled } from "../../utils/accessibility"; - export type LightModalContextInterface = Readonly<{ component: React.ReactNode; showModal: (component: React.ReactNode) => void; @@ -27,16 +26,15 @@ export type LightModalContextInterface = Readonly<{ setOnHiddenModal: (callback: () => void) => void; }>; -export const LightModalContext = - React.createContext({ - component: null, - showModal: () => undefined, - showModalFadeInAnimation: () => undefined, - showAnimatedModal: () => undefined, - hideModal: () => undefined, - onHiddenModal: () => undefined, - setOnHiddenModal: () => undefined - }); +export const LightModalContext = createContext({ + component: null, + showModal: () => undefined, + showModalFadeInAnimation: () => undefined, + showAnimatedModal: () => undefined, + hideModal: () => undefined, + onHiddenModal: () => undefined, + setOnHiddenModal: () => undefined +}); type Props = Record; @@ -134,7 +132,7 @@ export type AnimationLightModal = export const LightModalConsumer = LightModalContext.Consumer; -export class LightModalProvider extends React.Component< +export class LightModalProvider extends Component< React.PropsWithChildren, State > { diff --git a/ts/components/ui/LoadingIndicator.tsx b/ts/components/ui/LoadingIndicator.tsx index 944ee3628a4..961b44cc037 100644 --- a/ts/components/ui/LoadingIndicator.tsx +++ b/ts/components/ui/LoadingIndicator.tsx @@ -1,14 +1,11 @@ -import * as React from "react"; import { LoadingSpinner } from "@pagopa/io-app-design-system"; +import { ComponentProps } from "react"; import I18n from "../../i18n"; import { WithTestID } from "../../types/WithTestID"; import { useInteractiveElementDefaultColor } from "../../utils/hooks/theme"; export type LoadingIndicator = WithTestID< - Exclude< - React.ComponentProps, - "size" | "color" | "duration" - > + Exclude, "size" | "color" | "duration"> >; export const LoadingIndicator = ({ diff --git a/ts/components/ui/LogoPaymentExtended.tsx b/ts/components/ui/LogoPaymentExtended.tsx index eb7113f522e..bdcd1e6684c 100644 --- a/ts/components/ui/LogoPaymentExtended.tsx +++ b/ts/components/ui/LogoPaymentExtended.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { Image } from "react-native"; import paypalLogoImage from "../../../img/wallet/payment-methods/paypal-logo.png"; // sadly no svg is available for paypal, since on Figma an image is used diff --git a/ts/components/ui/Markdown/LegacyMarkdown.tsx b/ts/components/ui/Markdown/LegacyMarkdown.tsx index 00c70414536..38efd70ed1f 100644 --- a/ts/components/ui/Markdown/LegacyMarkdown.tsx +++ b/ts/components/ui/Markdown/LegacyMarkdown.tsx @@ -1,6 +1,6 @@ import { pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; -import React from "react"; +import { createRef, PureComponent, Fragment } from "react"; import { ActivityIndicator, AppState, @@ -208,8 +208,8 @@ type State = { /** * A component to render the message markdown as HTML inside a WebView */ -class LegacyMarkdown extends React.PureComponent { - private webViewRef = React.createRef(); +class LegacyMarkdown extends PureComponent { + private webViewRef = createRef(); private subscription: NativeEventSubscription | undefined; constructor(props: Props) { @@ -294,7 +294,7 @@ class LegacyMarkdown extends React.PureComponent { }; return ( - + {this.state.isLoading && ( { )} - + ); } diff --git a/ts/components/ui/Markdown/LoadingSkeleton.tsx b/ts/components/ui/Markdown/LoadingSkeleton.tsx index 7471032ab66..6616c14a4f7 100644 --- a/ts/components/ui/Markdown/LoadingSkeleton.tsx +++ b/ts/components/ui/Markdown/LoadingSkeleton.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { Fragment } from "react"; import { View } from "react-native"; import Placeholder from "rn-placeholder"; import { IOColors, VSpacer } from "@pagopa/io-app-design-system"; @@ -36,7 +36,7 @@ export const LoadingSkeleton = ({ accessibilityElementsHidden={true} > {[...Array(lines)].map((_, i) => ( - + {i + 1 < lines && } - + ))} diff --git a/ts/components/ui/Markdown/Markdown.tsx b/ts/components/ui/Markdown/Markdown.tsx index 89983dba5c0..67a7d50c0a5 100644 --- a/ts/components/ui/Markdown/Markdown.tsx +++ b/ts/components/ui/Markdown/Markdown.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect, useRef, useState } from "react"; +import { useCallback, useEffect, useRef, useState } from "react"; import { AppState, AppStateStatus, diff --git a/ts/components/ui/Markdown/MarkdownWebviewComponent.tsx b/ts/components/ui/Markdown/MarkdownWebviewComponent.tsx index 75be6f68349..a3f75fd0429 100644 --- a/ts/components/ui/Markdown/MarkdownWebviewComponent.tsx +++ b/ts/components/ui/Markdown/MarkdownWebviewComponent.tsx @@ -2,7 +2,7 @@ import { useLinkTo } from "@react-navigation/native"; import * as E from "fp-ts/lib/Either"; import { pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; -import React, { LegacyRef } from "react"; +import { LegacyRef } from "react"; import { StyleProp, ViewStyle } from "react-native"; import { WebView } from "react-native-webview"; import { WebViewMessageEvent } from "react-native-webview/lib/WebViewTypes"; diff --git a/ts/components/ui/Overlay.tsx b/ts/components/ui/Overlay.tsx index 13d2bed023d..2f245c516d1 100644 --- a/ts/components/ui/Overlay.tsx +++ b/ts/components/ui/Overlay.tsx @@ -1,6 +1,6 @@ -import * as React from "react"; import { StyleSheet, View } from "react-native"; import { IOColors } from "@pagopa/io-app-design-system"; +import { ReactNode } from "react"; const styles = StyleSheet.create({ container: { @@ -23,8 +23,8 @@ const styles = StyleSheet.create({ type Props = Readonly<{ backgroundColor?: string; - children?: React.ReactNode; - foreground?: React.ReactNode; + children?: ReactNode; + foreground?: ReactNode; opacity?: number; }>; diff --git a/ts/components/ui/ProgressIndicator.tsx b/ts/components/ui/ProgressIndicator.tsx index 646aedffce9..b7768e4b16b 100644 --- a/ts/components/ui/ProgressIndicator.tsx +++ b/ts/components/ui/ProgressIndicator.tsx @@ -1,9 +1,9 @@ -import * as React from "react"; import { ProgressLoader } from "@pagopa/io-app-design-system"; +import { ComponentProps } from "react"; import { useInteractiveElementDefaultColor } from "../../utils/hooks/theme"; export type ProgressIndicator = Exclude< - React.ComponentProps, + ComponentProps, "color" >; diff --git a/ts/components/ui/RNavScreenWithLargeHeader.tsx b/ts/components/ui/RNavScreenWithLargeHeader.tsx index 140a4eb1193..aa14ebedcf7 100644 --- a/ts/components/ui/RNavScreenWithLargeHeader.tsx +++ b/ts/components/ui/RNavScreenWithLargeHeader.tsx @@ -7,7 +7,8 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import { useNavigation } from "@react-navigation/native"; -import React, { ComponentProps, useLayoutEffect, useState } from "react"; +import { ComponentProps, ReactNode, useLayoutEffect, useState } from "react"; + import { LayoutChangeEvent, View } from "react-native"; import Animated, { useAnimatedScrollHandler, @@ -29,8 +30,8 @@ export type LargeHeaderTitleProps = { }; type Props = { - children: React.ReactNode; - fixedBottomSlot?: React.ReactNode; + children: ReactNode; + fixedBottomSlot?: ReactNode; title: LargeHeaderTitleProps; description?: string; goBack?: BackProps["goBack"]; diff --git a/ts/components/ui/RefreshIndicator.tsx b/ts/components/ui/RefreshIndicator.tsx index 8922d8565a4..48e1bfab106 100644 --- a/ts/components/ui/RefreshIndicator.tsx +++ b/ts/components/ui/RefreshIndicator.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { View, ActivityIndicator, Platform, StyleSheet } from "react-native"; import { IOColors } from "@pagopa/io-app-design-system"; diff --git a/ts/components/ui/TabIconComponent.tsx b/ts/components/ui/TabIconComponent.tsx index 7194c7586ff..9996446acc4 100644 --- a/ts/components/ui/TabIconComponent.tsx +++ b/ts/components/ui/TabIconComponent.tsx @@ -1,5 +1,5 @@ import { ColorValue, View } from "react-native"; -import React from "react"; +import { memo } from "react"; import { AnimatedIcon, IONavIcons } from "@pagopa/io-app-design-system"; type TabIconComponent = { @@ -13,7 +13,7 @@ type TabIconComponent = { * Generic tab icon with badge indicator */ -export const TabIconComponent = React.memo( +export const TabIconComponent = memo( ({ focused, iconName, iconNameFocused, color }: TabIconComponent) => ( // accessibilityLabel={""} in order to read the font icon, without modify the library element diff --git a/ts/components/ui/__test__/ActivityIndicator.test.tsx b/ts/components/ui/__test__/ActivityIndicator.test.tsx index 9334069b2f0..308515d9d90 100644 --- a/ts/components/ui/__test__/ActivityIndicator.test.tsx +++ b/ts/components/ui/__test__/ActivityIndicator.test.tsx @@ -1,5 +1,4 @@ import TestRenderer from "react-test-renderer"; -import React from "react"; import ActivityIndicator from "../ActivityIndicator"; describe("ActivityIndicator", () => { diff --git a/ts/components/ui/__test__/BoxedRefreshIndicator.test.tsx b/ts/components/ui/__test__/BoxedRefreshIndicator.test.tsx index 4280076184c..cb48f890366 100644 --- a/ts/components/ui/__test__/BoxedRefreshIndicator.test.tsx +++ b/ts/components/ui/__test__/BoxedRefreshIndicator.test.tsx @@ -1,11 +1,11 @@ -import * as React from "react"; -import { Text } from "react-native"; import { render } from "@testing-library/react-native"; -import configureMockStore from "redux-mock-store"; +import { ReactNode } from "react"; +import { Text } from "react-native"; import { Provider } from "react-redux"; -import { appReducer } from "../../../store/reducers"; +import configureMockStore from "redux-mock-store"; import { applicationChangeState } from "../../../store/actions/application"; import { preferencesDesignSystemSetEnabled } from "../../../store/actions/persistedPreferences"; +import { appReducer } from "../../../store/reducers"; import { GlobalState } from "../../../store/reducers/types"; import BoxedRefreshIndicator from "../BoxedRefreshIndicator"; @@ -22,10 +22,7 @@ describe("BoxedRefreshIndicator", () => { }); }); -const renderComponent = ( - action?: React.ReactNode, - caption?: React.ReactNode -) => { +const renderComponent = (action?: ReactNode, caption?: ReactNode) => { const initialState = appReducer(undefined, applicationChangeState("active")); const dsState = appReducer( initialState, diff --git a/ts/components/ui/__test__/Dismissable.test.tsx b/ts/components/ui/__test__/Dismissable.test.tsx index bc7d8b01e81..d94f9a679ef 100644 --- a/ts/components/ui/__test__/Dismissable.test.tsx +++ b/ts/components/ui/__test__/Dismissable.test.tsx @@ -1,5 +1,4 @@ import { render } from "@testing-library/react-native"; -import React from "react"; import { PanGesture, State } from "react-native-gesture-handler"; import { fireGestureHandler, diff --git a/ts/components/ui/__test__/IOScrollViewCentredContent.test.tsx b/ts/components/ui/__test__/IOScrollViewCentredContent.test.tsx index 9195eea757f..5475ff311e5 100644 --- a/ts/components/ui/__test__/IOScrollViewCentredContent.test.tsx +++ b/ts/components/ui/__test__/IOScrollViewCentredContent.test.tsx @@ -1,5 +1,5 @@ import { constUndefined } from "fp-ts/lib/function"; -import React, { ComponentProps } from "react"; +import { ComponentProps } from "react"; import { createStore } from "redux"; import ROUTES from "../../../navigation/routes"; import { applicationChangeState } from "../../../store/actions/application"; diff --git a/ts/components/ui/__test__/IOScrollViewWithListItems.test.tsx b/ts/components/ui/__test__/IOScrollViewWithListItems.test.tsx index 92c4d51d7d8..fd8d6e06330 100644 --- a/ts/components/ui/__test__/IOScrollViewWithListItems.test.tsx +++ b/ts/components/ui/__test__/IOScrollViewWithListItems.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { fireEvent } from "@testing-library/react-native"; import { createStore } from "redux"; import { IOScrollViewWithListItems } from "../IOScrollViewWithListItems"; diff --git a/ts/components/ui/__test__/Overlay.test.tsx b/ts/components/ui/__test__/Overlay.test.tsx index 930cbc12f71..99560f884c7 100644 --- a/ts/components/ui/__test__/Overlay.test.tsx +++ b/ts/components/ui/__test__/Overlay.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { render } from "@testing-library/react-native"; import { Text } from "react-native"; import { Overlay } from "../Overlay"; diff --git a/ts/components/ui/utils/components/LogoPaymentWithFallback.tsx b/ts/components/ui/utils/components/LogoPaymentWithFallback.tsx index 140d0db89a7..0215b7b987e 100644 --- a/ts/components/ui/utils/components/LogoPaymentWithFallback.tsx +++ b/ts/components/ui/utils/components/LogoPaymentWithFallback.tsx @@ -11,7 +11,6 @@ import { } from "@pagopa/io-app-design-system"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import * as React from "react"; import { findFirstCaseInsensitive } from "../../../../utils/object"; export type LogoPaymentWithFallback = { diff --git a/ts/components/ui/utils/hooks/useSineWaveAnimation.ts b/ts/components/ui/utils/hooks/useSineWaveAnimation.ts index 4aee3ab1f24..6e454144cf7 100644 --- a/ts/components/ui/utils/hooks/useSineWaveAnimation.ts +++ b/ts/components/ui/utils/hooks/useSineWaveAnimation.ts @@ -1,4 +1,4 @@ -import React from "react"; +import { useEffect } from "react"; import { ViewStyle } from "react-native"; import { AnimatedStyleProp, @@ -37,7 +37,7 @@ const useSineWaveAnimation = ({ ] })); - React.useEffect(() => { + useEffect(() => { if (enabled) { // eslint-disable-next-line functional/immutable-data translate.value = withRepeat( diff --git a/ts/features/barcode/components/AnimatedCameraMarker.tsx b/ts/features/barcode/components/AnimatedCameraMarker.tsx index 8a2906c71d6..dd00c2a3088 100644 --- a/ts/features/barcode/components/AnimatedCameraMarker.tsx +++ b/ts/features/barcode/components/AnimatedCameraMarker.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { StyleSheet, View } from "react-native"; import Animated, { FadeIn } from "react-native-reanimated"; import CameraMarkerCorner from "../../../../img/camera-marker-corner.svg"; diff --git a/ts/features/barcode/components/BarcodeScanBaseScreenComponent.tsx b/ts/features/barcode/components/BarcodeScanBaseScreenComponent.tsx index 5ac7e5dd407..d7112b31538 100644 --- a/ts/features/barcode/components/BarcodeScanBaseScreenComponent.tsx +++ b/ts/features/barcode/components/BarcodeScanBaseScreenComponent.tsx @@ -10,7 +10,14 @@ import { useNavigation, useRoute } from "@react-navigation/native"; -import React from "react"; + +import { + ComponentProps, + useCallback, + useEffect, + useMemo, + useState +} from "react"; import { AppState, StyleSheet, View } from "react-native"; import LinearGradient from "react-native-linear-gradient"; import { @@ -134,7 +141,7 @@ const BarcodeScanBaseScreenComponent = ({ const currentScreenName = useIOSelector(currentRouteSelector); - const [isAppInBackground, setIsAppInBackground] = React.useState( + const [isAppInBackground, setIsAppInBackground] = useState( AppState.currentState !== "active" ); @@ -150,7 +157,7 @@ const BarcodeScanBaseScreenComponent = ({ * * @returns {void} */ - React.useEffect(() => { + useEffect(() => { const subscription = AppState.addEventListener("change", nextAppState => { setIsAppInBackground(nextAppState !== "active"); }); @@ -161,7 +168,7 @@ const BarcodeScanBaseScreenComponent = ({ }, []); useFocusEffect( - React.useCallback(() => { + useCallback(() => { trackBarcodeScanScreenView(barcodeAnalyticsFlow); }, [barcodeAnalyticsFlow]) ); @@ -224,12 +231,12 @@ const BarcodeScanBaseScreenComponent = ({ /> ); - const openAppSetting = React.useCallback(async () => { + const openAppSetting = useCallback(async () => { // Open the custom settings if the app has one await openCameraSettings(); }, [openCameraSettings]); - const cameraView = React.useMemo(() => { + const cameraView = useMemo(() => { if (cameraPermissionStatus === "granted") { return cameraComponent; } @@ -288,15 +295,14 @@ const BarcodeScanBaseScreenComponent = ({ const shouldDisplayTorchButton = cameraPermissionStatus === "granted" && hasTorch; - const torchIconButton: React.ComponentProps< - typeof BaseHeader - >["customRightIcon"] = { - iconName: isTorchOn ? "lightFilled" : "light", - accessibilityLabel: isTorchOn - ? I18n.t("accessibility.buttons.torch.turnOff") - : I18n.t("accessibility.buttons.torch.turnOn"), - onPress: handleTorchToggle - }; + const torchIconButton: ComponentProps["customRightIcon"] = + { + iconName: isTorchOn ? "lightFilled" : "light", + accessibilityLabel: isTorchOn + ? I18n.t("accessibility.buttons.torch.turnOff") + : I18n.t("accessibility.buttons.torch.turnOn"), + onPress: handleTorchToggle + }; return ( diff --git a/ts/features/barcode/components/CameraPermissionView.tsx b/ts/features/barcode/components/CameraPermissionView.tsx index 22bf89b5a95..b672c5f7c63 100644 --- a/ts/features/barcode/components/CameraPermissionView.tsx +++ b/ts/features/barcode/components/CameraPermissionView.tsx @@ -1,14 +1,13 @@ -import { default as React } from "react"; -import { StyleSheet, View } from "react-native"; import { + BodySmall, ButtonSolid, ButtonSolidProps, - VSpacer, - Pictogram, - IOPictograms, H6, - BodySmall + IOPictograms, + Pictogram, + VSpacer } from "@pagopa/io-app-design-system"; +import { StyleSheet, View } from "react-native"; type Props = { title: string; diff --git a/ts/features/barcode/components/__tests__/BarcodeScanBaseScreenComponent.test.tsx b/ts/features/barcode/components/__tests__/BarcodeScanBaseScreenComponent.test.tsx index af10949a107..694318c51cd 100644 --- a/ts/features/barcode/components/__tests__/BarcodeScanBaseScreenComponent.test.tsx +++ b/ts/features/barcode/components/__tests__/BarcodeScanBaseScreenComponent.test.tsx @@ -1,5 +1,4 @@ import { fireEvent } from "@testing-library/react-native"; -import React from "react"; import { View } from "react-native"; import configureMockStore from "redux-mock-store"; import I18n from "../../../../i18n"; diff --git a/ts/features/barcode/hooks/useIOBarcodeCameraScanner.tsx b/ts/features/barcode/hooks/useIOBarcodeCameraScanner.tsx index e3b4aa7915d..5230d7ce13f 100644 --- a/ts/features/barcode/hooks/useIOBarcodeCameraScanner.tsx +++ b/ts/features/barcode/hooks/useIOBarcodeCameraScanner.tsx @@ -8,7 +8,15 @@ import * as A from "fp-ts/lib/Array"; import * as E from "fp-ts/lib/Either"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; + +import { + ReactNode, + useCallback, + useEffect, + useMemo, + useRef, + useState +} from "react"; import { Linking, StyleSheet, View } from "react-native"; import Animated, { FadeIn } from "react-native-reanimated"; import { @@ -83,7 +91,7 @@ export type IOBarcodeCameraScanner = { /** * Component that renders the camera */ - cameraComponent: React.ReactNode; + cameraComponent: ReactNode; /** * Camera permission status */ @@ -172,7 +180,7 @@ export const useIOBarcodeCameraScanner = ({ barcodeTypes, isLoading = false }: IOBarcodeCameraScannerConfiguration): IOBarcodeCameraScanner => { - const acceptedFormats = React.useMemo>( + const acceptedFormats = useMemo>( () => barcodeFormats || ["QR_CODE", "DATA_MATRIX"], [barcodeFormats] ); @@ -184,21 +192,21 @@ export const useIOBarcodeCameraScanner = ({ // Checks that the device has a torch const hasTorch = !!device?.hasTorch; - const [isTorchOn, setTorchOn] = React.useState(false); + const [isTorchOn, setTorchOn] = useState(false); // This handles the resting state of the scanner after a scan // It is necessary to avoid multiple scans of the same barcode - const scannerReactivateTimeoutHandler = React.useRef(); - const [isResting, setIsResting] = React.useState(false); + const scannerReactivateTimeoutHandler = useRef(); + const [isResting, setIsResting] = useState(false); const [cameraPermissionStatus, setCameraPermissionStatus] = - React.useState("not-determined"); + useState("not-determined"); /** * Handles the detected {@link Code} and converts it to {@link IOBarcode} * Returns an Either with the {@link BarcodeFailure} or the {@link IOBarcode} */ - const handleDetectedBarcode = React.useCallback( + const handleDetectedBarcode = useCallback( (detectedBarcode: Code): E.Either => pipe( convertToIOBarcodeFormat(detectedBarcode.type as BarcodeFormat), @@ -225,7 +233,7 @@ export const useIOBarcodeCameraScanner = ({ /** * Handles the scanned barcodes and calls the callbacks for the results */ - const handleScannedBarcodes = React.useCallback( + const handleScannedBarcodes = useCallback( (codes: Array) => pipe( retrieveNextBarcode(codes), @@ -278,7 +286,7 @@ export const useIOBarcodeCameraScanner = ({ /** * Hook that checks the camera permission on mount */ - React.useEffect(() => { + useEffect(() => { const permission = Camera.getCameraPermissionStatus(); setCameraPermissionStatus(permission); }, []); @@ -286,7 +294,7 @@ export const useIOBarcodeCameraScanner = ({ /** * Hook that clears the timeout handler on unmount */ - React.useEffect( + useEffect( () => () => { clearTimeout(scannerReactivateTimeoutHandler.current); }, diff --git a/ts/features/barcode/hooks/useIOBarcodeFileReader.tsx b/ts/features/barcode/hooks/useIOBarcodeFileReader.tsx index 16fb3bc796c..9cfe7011de0 100644 --- a/ts/features/barcode/hooks/useIOBarcodeFileReader.tsx +++ b/ts/features/barcode/hooks/useIOBarcodeFileReader.tsx @@ -6,7 +6,7 @@ import * as O from "fp-ts/lib/Option"; import * as T from "fp-ts/lib/Task"; import * as TE from "fp-ts/lib/TaskEither"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; +import { useState } from "react"; import { Alert, Linking, View } from "react-native"; import DocumentPicker, { DocumentPickerOptions, @@ -113,8 +113,8 @@ const useIOBarcodeFileReader = ({ barcodeTypes, barcodeAnalyticsFlow }: IOBarcodeFileReaderConfiguration): IOBarcodeFileReader => { - const [isFilePickerVisible, setFilePickerVisible] = React.useState(false); - const [isLoading, setIsLoading] = React.useState(false); + const [isFilePickerVisible, setFilePickerVisible] = useState(false); + const [isLoading, setIsLoading] = useState(false); const navigation = useNavigation>(); const handleBarcodeSuccess = (barcodes: Array) => { diff --git a/ts/features/barcode/screens/BarcodeScanScreen.tsx b/ts/features/barcode/screens/BarcodeScanScreen.tsx index 756027c2acd..c2074dcdd60 100644 --- a/ts/features/barcode/screens/BarcodeScanScreen.tsx +++ b/ts/features/barcode/screens/BarcodeScanScreen.tsx @@ -5,7 +5,6 @@ import { IOToast } from "@pagopa/io-app-design-system"; import { useNavigation } from "@react-navigation/native"; -import React from "react"; import { Alert, View } from "react-native"; import ReactNativeHapticFeedback, { HapticFeedbackTypes diff --git a/ts/features/bonus/cdc/components/CdcGenericError.tsx b/ts/features/bonus/cdc/components/CdcGenericError.tsx index 7ec39dc3553..f9411b374da 100644 --- a/ts/features/bonus/cdc/components/CdcGenericError.tsx +++ b/ts/features/bonus/cdc/components/CdcGenericError.tsx @@ -1,5 +1,4 @@ import { useNavigation } from "@react-navigation/native"; -import * as React from "react"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; import I18n from "../../../../i18n"; import { diff --git a/ts/features/bonus/cdc/components/CdcRequestCompleted.tsx b/ts/features/bonus/cdc/components/CdcRequestCompleted.tsx index 2224f5c0ceb..03950731ff4 100644 --- a/ts/features/bonus/cdc/components/CdcRequestCompleted.tsx +++ b/ts/features/bonus/cdc/components/CdcRequestCompleted.tsx @@ -1,5 +1,4 @@ import { useNavigation } from "@react-navigation/native"; -import * as React from "react"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; import I18n from "../../../../i18n"; import { diff --git a/ts/features/bonus/cdc/components/CdcRequestPartiallySuccess.tsx b/ts/features/bonus/cdc/components/CdcRequestPartiallySuccess.tsx index 9fc67d1d301..fb04a49fa64 100644 --- a/ts/features/bonus/cdc/components/CdcRequestPartiallySuccess.tsx +++ b/ts/features/bonus/cdc/components/CdcRequestPartiallySuccess.tsx @@ -1,5 +1,4 @@ import { useNavigation } from "@react-navigation/native"; -import * as React from "react"; import { Anno } from "../../../../../definitions/cdc/Anno"; import { isReady } from "../../../../common/model/RemoteValue"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; diff --git a/ts/features/bonus/cdc/components/CdcRequirementsError.tsx b/ts/features/bonus/cdc/components/CdcRequirementsError.tsx index 7c321e9deab..33f2d993068 100644 --- a/ts/features/bonus/cdc/components/CdcRequirementsError.tsx +++ b/ts/features/bonus/cdc/components/CdcRequirementsError.tsx @@ -1,6 +1,5 @@ import { FooterActions } from "@pagopa/io-app-design-system"; import { useNavigation } from "@react-navigation/native"; -import * as React from "react"; import { SafeAreaView } from "react-native"; import image from "../../../../../img/servicesStatus/error-detail-icon.png"; import { IOStyles } from "../../../../components/core/variables/IOStyles"; diff --git a/ts/features/bonus/cdc/components/CdcServiceCTA.tsx b/ts/features/bonus/cdc/components/CdcServiceCTA.tsx index 641d0c2b57e..9741ff42e67 100644 --- a/ts/features/bonus/cdc/components/CdcServiceCTA.tsx +++ b/ts/features/bonus/cdc/components/CdcServiceCTA.tsx @@ -6,8 +6,7 @@ import { } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; import { useFocusEffect } from "@react-navigation/native"; -import * as React from "react"; -import { useCallback } from "react"; +import { createRef, useCallback } from "react"; import { View } from "react-native"; import { StatoBeneficiarioEnum } from "../../../../../definitions/cdc/StatoBeneficiario"; import { BonusVisibilityEnum } from "../../../../../definitions/content/BonusVisibility"; @@ -80,7 +79,7 @@ type ErrorButtonProp = { onPress: () => void; }; const ErrorButton = (props: ErrorButtonProp) => { - const viewRef = React.createRef(); + const viewRef = createRef(); return ( diff --git a/ts/features/bonus/cdc/components/CdcWrongFormat.tsx b/ts/features/bonus/cdc/components/CdcWrongFormat.tsx index e9d68748047..25c8f10fd7e 100644 --- a/ts/features/bonus/cdc/components/CdcWrongFormat.tsx +++ b/ts/features/bonus/cdc/components/CdcWrongFormat.tsx @@ -1,5 +1,4 @@ import { useNavigation } from "@react-navigation/native"; -import * as React from "react"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; import I18n from "../../../../i18n"; import { diff --git a/ts/features/bonus/cdc/navigation/CdcStackNavigator.tsx b/ts/features/bonus/cdc/navigation/CdcStackNavigator.tsx index 265aef68509..096ed09aa3e 100644 --- a/ts/features/bonus/cdc/navigation/CdcStackNavigator.tsx +++ b/ts/features/bonus/cdc/navigation/CdcStackNavigator.tsx @@ -1,5 +1,4 @@ import { createStackNavigator } from "@react-navigation/stack"; -import * as React from "react"; import CdcBonusRequestInformationTos from "../screens/CdcBonusRequestInformationTos"; import CdcBonusRequestSelectYear from "../screens/CdcBonusRequestSelectYear"; import CdcBonusRequestSelectResidence from "../screens/CdcBonusRequestSelectResidence"; diff --git a/ts/features/bonus/cdc/screens/CdcBonusRequestBonusRequested.tsx b/ts/features/bonus/cdc/screens/CdcBonusRequestBonusRequested.tsx index c0b393e1209..1b70c57315b 100644 --- a/ts/features/bonus/cdc/screens/CdcBonusRequestBonusRequested.tsx +++ b/ts/features/bonus/cdc/screens/CdcBonusRequestBonusRequested.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { useEffect } from "react"; import { constNull } from "fp-ts/lib/function"; import { diff --git a/ts/features/bonus/cdc/screens/CdcBonusRequestInformationTos.tsx b/ts/features/bonus/cdc/screens/CdcBonusRequestInformationTos.tsx index d5fc2021fb6..77e9dbfdb29 100644 --- a/ts/features/bonus/cdc/screens/CdcBonusRequestInformationTos.tsx +++ b/ts/features/bonus/cdc/screens/CdcBonusRequestInformationTos.tsx @@ -5,7 +5,6 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import { useNavigation } from "@react-navigation/native"; -import * as React from "react"; import { Image, ImageSourcePropType, diff --git a/ts/features/bonus/cdc/screens/CdcBonusRequestSelectResidence.tsx b/ts/features/bonus/cdc/screens/CdcBonusRequestSelectResidence.tsx index b2d846048c6..1fbddc24424 100644 --- a/ts/features/bonus/cdc/screens/CdcBonusRequestSelectResidence.tsx +++ b/ts/features/bonus/cdc/screens/CdcBonusRequestSelectResidence.tsx @@ -7,7 +7,7 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import { useNavigation } from "@react-navigation/native"; -import * as React from "react"; +import { useState } from "react"; import { SafeAreaView, ScrollView, View } from "react-native"; import { RadioButtonList, @@ -43,7 +43,7 @@ const CdcBonusRequestSelectResidence = () => { IOStackNavigationProp >(); const dispatch = useIODispatch(); - const [isResidentInItaly, setIsResidentInItaly] = React.useState< + const [isResidentInItaly, setIsResidentInItaly] = useState< Record >({}); const cdcSelectedBonus = useIOSelector(cdcSelectedBonusSelector); diff --git a/ts/features/bonus/cdc/screens/CdcBonusRequestSelectYear.tsx b/ts/features/bonus/cdc/screens/CdcBonusRequestSelectYear.tsx index b6e665a584c..0404f4e9814 100644 --- a/ts/features/bonus/cdc/screens/CdcBonusRequestSelectYear.tsx +++ b/ts/features/bonus/cdc/screens/CdcBonusRequestSelectYear.tsx @@ -6,7 +6,6 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import { useNavigation } from "@react-navigation/native"; -import * as React from "react"; import { useEffect, useState } from "react"; import { SafeAreaView, ScrollView, View } from "react-native"; import { Anno } from "../../../../../definitions/cdc/Anno"; diff --git a/ts/features/bonus/cgn/components/CgnAnimatedBackground.tsx b/ts/features/bonus/cgn/components/CgnAnimatedBackground.tsx index 1733104bc69..d0933cfdc64 100644 --- a/ts/features/bonus/cgn/components/CgnAnimatedBackground.tsx +++ b/ts/features/bonus/cgn/components/CgnAnimatedBackground.tsx @@ -1,4 +1,3 @@ -import React from "react"; import WebView from "react-native-webview"; import { Point, generateRandomSvgMovement } from "../utils/svgBackground"; import { playSvg } from "./detail/CardSvgPayload"; diff --git a/ts/features/bonus/cgn/components/CgnCard.tsx b/ts/features/bonus/cgn/components/CgnCard.tsx index 8630cdb542b..254a6d4a97b 100644 --- a/ts/features/bonus/cgn/components/CgnCard.tsx +++ b/ts/features/bonus/cgn/components/CgnCard.tsx @@ -1,6 +1,5 @@ import { H6, IOColors, BodySmall, Tag } from "@pagopa/io-app-design-system"; import { format } from "date-fns"; -import * as React from "react"; import { Image, StyleSheet, View } from "react-native"; import cgnLogo from "../../../../../img/bonus/cgn/cgn_logo.png"; import eycaLogo from "../../../../../img/bonus/cgn/eyca_logo.png"; diff --git a/ts/features/bonus/cgn/components/CgnCardStatus.tsx b/ts/features/bonus/cgn/components/CgnCardStatus.tsx index cff1a453752..2034f400952 100644 --- a/ts/features/bonus/cgn/components/CgnCardStatus.tsx +++ b/ts/features/bonus/cgn/components/CgnCardStatus.tsx @@ -1,5 +1,5 @@ import { LabelMini, Tag } from "@pagopa/io-app-design-system"; -import React from "react"; +import { Fragment } from "react"; import { Card } from "../../../../../definitions/cgn/Card"; import { CardActivated } from "../../../../../definitions/cgn/CardActivated"; import { CardExpired } from "../../../../../definitions/cgn/CardExpired"; @@ -9,7 +9,7 @@ import { formatDateAsShortFormat } from "../../../../utils/dates"; export function CgnCardStatus({ card }: { card: Card }) { return ( - + {CardRevoked.is(card) && ( )} - + ); } diff --git a/ts/features/bonus/cgn/components/CgnServiceCTA.tsx b/ts/features/bonus/cgn/components/CgnServiceCTA.tsx index db7f88f51c3..b6119542b96 100644 --- a/ts/features/bonus/cgn/components/CgnServiceCTA.tsx +++ b/ts/features/bonus/cgn/components/CgnServiceCTA.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect, useRef } from "react"; +import { useCallback, useEffect, useRef } from "react"; import { Alert, Platform } from "react-native"; import { ButtonSolid, IOToast } from "@pagopa/io-app-design-system"; import { constNull } from "fp-ts/lib/function"; diff --git a/ts/features/bonus/cgn/components/CgnWalletCard.tsx b/ts/features/bonus/cgn/components/CgnWalletCard.tsx index 3a1f805d625..22d503f3c2d 100644 --- a/ts/features/bonus/cgn/components/CgnWalletCard.tsx +++ b/ts/features/bonus/cgn/components/CgnWalletCard.tsx @@ -1,7 +1,6 @@ import * as pot from "@pagopa/ts-commons/lib/pot"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import * as React from "react"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; import { useIOSelector } from "../../../../store/hooks"; import { profileSelector } from "../../../../store/reducers/profile"; diff --git a/ts/features/bonus/cgn/components/detail/CgnOwnershipInformation.tsx b/ts/features/bonus/cgn/components/detail/CgnOwnershipInformation.tsx index 5732b6a2fca..53dfbb25010 100644 --- a/ts/features/bonus/cgn/components/detail/CgnOwnershipInformation.tsx +++ b/ts/features/bonus/cgn/components/detail/CgnOwnershipInformation.tsx @@ -4,7 +4,8 @@ import { ListItemInfo } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; -import * as React from "react"; + +import { ReactElement } from "react"; import I18n from "../../../../../i18n"; import { useIOSelector } from "../../../../../store/hooks"; import { profileSelector } from "../../../../../store/reducers/profile"; @@ -14,7 +15,7 @@ import { capitalizeTextName } from "../../../../../utils/strings"; * Renders the CGN ownership block for detail screen, including Owner's Fiscal Code (The current user logged in) * @constructor */ -const CgnOwnershipInformation = (): React.ReactElement => { +const CgnOwnershipInformation = (): ReactElement => { const currentProfile = useIOSelector(profileSelector); return ( <> diff --git a/ts/features/bonus/cgn/components/detail/CgnStatusDetail.tsx b/ts/features/bonus/cgn/components/detail/CgnStatusDetail.tsx index fe14eaebc3b..a0c303a5ec8 100644 --- a/ts/features/bonus/cgn/components/detail/CgnStatusDetail.tsx +++ b/ts/features/bonus/cgn/components/detail/CgnStatusDetail.tsx @@ -1,24 +1,22 @@ -import * as React from "react"; import { Divider, ListItemHeader, ListItemInfo } from "@pagopa/io-app-design-system"; +import { FunctionComponent } from "react"; import { Card } from "../../../../../../definitions/cgn/Card"; -import I18n from "../../../../../i18n"; -import { localeDateFormat } from "../../../../../utils/locale"; +import { CardActivated } from "../../../../../../definitions/cgn/CardActivated"; +import { CardExpired } from "../../../../../../definitions/cgn/CardExpired"; import { CardPending } from "../../../../../../definitions/cgn/CardPending"; import { CardRevoked } from "../../../../../../definitions/cgn/CardRevoked"; -import { CardExpired } from "../../../../../../definitions/cgn/CardExpired"; -import { CardActivated } from "../../../../../../definitions/cgn/CardActivated"; +import I18n from "../../../../../i18n"; +import { localeDateFormat } from "../../../../../utils/locale"; type Props = { cgnDetail: Card; }; -const CgnStatusDetail: React.FunctionComponent = ({ - cgnDetail -}: Props) => ( +const CgnStatusDetail: FunctionComponent = ({ cgnDetail }: Props) => ( <> {!CardPending.is(cgnDetail) && ( diff --git a/ts/features/bonus/cgn/components/detail/CgnUnsubscribe.tsx b/ts/features/bonus/cgn/components/detail/CgnUnsubscribe.tsx index 53b7cdd954b..6b280b7bea2 100644 --- a/ts/features/bonus/cgn/components/detail/CgnUnsubscribe.tsx +++ b/ts/features/bonus/cgn/components/detail/CgnUnsubscribe.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { ListItemAction } from "@pagopa/io-app-design-system"; import I18n from "../../../../../i18n"; diff --git a/ts/features/bonus/cgn/components/detail/__test__/CgnCardComponent.test.tsx b/ts/features/bonus/cgn/components/detail/__test__/CgnCardComponent.test.tsx index 0f338269d0a..1f3a05eac32 100644 --- a/ts/features/bonus/cgn/components/detail/__test__/CgnCardComponent.test.tsx +++ b/ts/features/bonus/cgn/components/detail/__test__/CgnCardComponent.test.tsx @@ -1,5 +1,4 @@ import { render } from "@testing-library/react-native"; -import * as React from "react"; import { Provider } from "react-redux"; import configureMockStore from "redux-mock-store"; import { Card } from "../../../../../../../definitions/cgn/Card"; diff --git a/ts/features/bonus/cgn/components/detail/__test__/CgnStatusDetail.test.tsx b/ts/features/bonus/cgn/components/detail/__test__/CgnStatusDetail.test.tsx index 6bb30e0239e..a8014c1f098 100644 --- a/ts/features/bonus/cgn/components/detail/__test__/CgnStatusDetail.test.tsx +++ b/ts/features/bonus/cgn/components/detail/__test__/CgnStatusDetail.test.tsx @@ -1,5 +1,4 @@ import { render } from "@testing-library/react-native"; -import * as React from "react"; import { Card } from "../../../../../../../definitions/cgn/Card"; import { StatusEnum as CgnActivatedStatusEnum } from "../../../../../../../definitions/cgn/CardActivated"; import I18n from "../../../../../../i18n"; diff --git a/ts/features/bonus/cgn/components/detail/eyca/EycaDetailComponent.tsx b/ts/features/bonus/cgn/components/detail/eyca/EycaDetailComponent.tsx index 21503679ebe..0ffd2501c44 100644 --- a/ts/features/bonus/cgn/components/detail/eyca/EycaDetailComponent.tsx +++ b/ts/features/bonus/cgn/components/detail/eyca/EycaDetailComponent.tsx @@ -1,6 +1,6 @@ import { pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; -import * as React from "react"; + import { useEffect } from "react"; import { connect } from "react-redux"; import { @@ -53,9 +53,7 @@ const EycaDetailComponent = (props: Props) => { /> ); - const renderComponentEycaStatus = ( - eyca: EycaCard - ): React.JSX.Element | null => { + const renderComponentEycaStatus = (eyca: EycaCard): JSX.Element | null => { switch (eyca.status) { case "ACTIVATED": case "REVOKED": diff --git a/ts/features/bonus/cgn/components/detail/eyca/EycaInformationComponent.tsx b/ts/features/bonus/cgn/components/detail/eyca/EycaInformationComponent.tsx index ab0dac14cff..4e8fe9b1d96 100644 --- a/ts/features/bonus/cgn/components/detail/eyca/EycaInformationComponent.tsx +++ b/ts/features/bonus/cgn/components/detail/eyca/EycaInformationComponent.tsx @@ -1,5 +1,5 @@ -import * as React from "react"; -import { ButtonOutline, VSpacer, IOToast } from "@pagopa/io-app-design-system"; +import { ButtonOutline, IOToast, VSpacer } from "@pagopa/io-app-design-system"; +import { FunctionComponent, useState } from "react"; import LegacyMarkdown from "../../../../../../components/ui/Markdown/LegacyMarkdown"; import I18n from "../../../../../../i18n"; import { useIOBottomSheetAutoresizableModal } from "../../../../../../utils/hooks/bottomSheet"; @@ -10,8 +10,8 @@ import { EYCA_WEBSITE_BASE_URL } from "../../../utils/constants"; * this component shows information about EYCA card. It is included within a bottom sheet * @constructor */ -const EycaInformationComponent: React.FunctionComponent = () => { - const [isMarkdownloaded, setMarkdownloaded] = React.useState(false); +const EycaInformationComponent: FunctionComponent = () => { + const [isMarkdownloaded, setMarkdownloaded] = useState(false); return ( <> = ({ +export const CgnMerchantDiscountItem: FunctionComponent = ({ discount }: Props) => { const navigation = diff --git a/ts/features/bonus/cgn/components/merchants/CgnMerchantsFilters.tsx b/ts/features/bonus/cgn/components/merchants/CgnMerchantsFilters.tsx index dc08faf7441..7146a7acd4c 100644 --- a/ts/features/bonus/cgn/components/merchants/CgnMerchantsFilters.tsx +++ b/ts/features/bonus/cgn/components/merchants/CgnMerchantsFilters.tsx @@ -5,8 +5,8 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import _ from "lodash"; -import * as React from "react"; -import { useMemo, useState } from "react"; + +import { FunctionComponent, useMemo, useState } from "react"; import { FlatList, Keyboard, @@ -34,7 +34,7 @@ type Props = { /** * This component is unused and could be deprecated since it's not used in the app. */ -const CgnMerchantsFilters: React.FunctionComponent = (props: Props) => { +const CgnMerchantsFilters: FunctionComponent = (props: Props) => { const [searchValue, setSearchValue] = useState(""); const [address, setAddress] = useState(""); const [checkedCategories, setCheckedCategories] = useState< diff --git a/ts/features/bonus/cgn/components/merchants/CgnMerchantsListView.tsx b/ts/features/bonus/cgn/components/merchants/CgnMerchantsListView.tsx index 6ffbb98850d..3fadfb9cbc7 100644 --- a/ts/features/bonus/cgn/components/merchants/CgnMerchantsListView.tsx +++ b/ts/features/bonus/cgn/components/merchants/CgnMerchantsListView.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { ListRenderItem, View } from "react-native"; import { Badge, H6, ListItemNav } from "@pagopa/io-app-design-system"; import { IOStyles } from "../../../../../components/core/variables/IOStyles"; diff --git a/ts/features/bonus/cgn/components/merchants/MerchantSearchResultListItem.tsx b/ts/features/bonus/cgn/components/merchants/MerchantSearchResultListItem.tsx index 92f7daba08c..695bf027d0a 100644 --- a/ts/features/bonus/cgn/components/merchants/MerchantSearchResultListItem.tsx +++ b/ts/features/bonus/cgn/components/merchants/MerchantSearchResultListItem.tsx @@ -6,7 +6,6 @@ import { IOStyles, ListItemNav } from "@pagopa/io-app-design-system"; -import React from "react"; import { Keyboard, Text, View, StyleSheet } from "react-native"; import I18n from "../../../../../i18n"; import { useIONavigation } from "../../../../../navigation/params/AppParamsList"; diff --git a/ts/features/bonus/cgn/components/merchants/ModuleCgnDiscount.tsx b/ts/features/bonus/cgn/components/merchants/ModuleCgnDiscount.tsx index 06266d234ef..01cd83a696f 100644 --- a/ts/features/bonus/cgn/components/merchants/ModuleCgnDiscount.tsx +++ b/ts/features/bonus/cgn/components/merchants/ModuleCgnDiscount.tsx @@ -12,7 +12,6 @@ import { useScaleAnimation } from "@pagopa/io-app-design-system"; import * as O from "fp-ts/lib/Option"; -import * as React from "react"; import { Pressable, StyleSheet, View } from "react-native"; import Animated from "react-native-reanimated"; import { Discount } from "../../../../../../definitions/cgn/merchants/Discount"; diff --git a/ts/features/bonus/cgn/components/merchants/___tests___/ModuleCgnDiscount.test.tsx b/ts/features/bonus/cgn/components/merchants/___tests___/ModuleCgnDiscount.test.tsx index 4411cb19ce2..3ba319c0369 100644 --- a/ts/features/bonus/cgn/components/merchants/___tests___/ModuleCgnDiscount.test.tsx +++ b/ts/features/bonus/cgn/components/merchants/___tests___/ModuleCgnDiscount.test.tsx @@ -1,6 +1,5 @@ import { NonEmptyString } from "@pagopa/ts-commons/lib/strings"; import { fireEvent, render } from "@testing-library/react-native"; -import React from "react"; import { Discount } from "../../../../../../../definitions/cgn/merchants/Discount"; import { ProductCategoryEnum } from "../../../../../../../definitions/cgn/merchants/ProductCategory"; import I18n from "../../../../../../i18n"; diff --git a/ts/features/bonus/cgn/components/merchants/discount/CgnDiscountContent.tsx b/ts/features/bonus/cgn/components/merchants/discount/CgnDiscountContent.tsx index 7f3b61df6cb..9c4e8344f27 100644 --- a/ts/features/bonus/cgn/components/merchants/discount/CgnDiscountContent.tsx +++ b/ts/features/bonus/cgn/components/merchants/discount/CgnDiscountContent.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { ContentWrapper, Divider, diff --git a/ts/features/bonus/cgn/components/merchants/discount/CgnDiscountExpireProgressBar.tsx b/ts/features/bonus/cgn/components/merchants/discount/CgnDiscountExpireProgressBar.tsx index 4b76548d257..d23619df92c 100644 --- a/ts/features/bonus/cgn/components/merchants/discount/CgnDiscountExpireProgressBar.tsx +++ b/ts/features/bonus/cgn/components/merchants/discount/CgnDiscountExpireProgressBar.tsx @@ -1,6 +1,6 @@ import { BodySmall, VSpacer } from "@pagopa/io-app-design-system"; import { format } from "date-fns"; -import * as React from "react"; +import { useState, useEffect } from "react"; import { StyleSheet, View } from "react-native"; import I18n from "../../../../../../i18n"; import { ProgressBar } from "../../../../common/components/ProgressBar"; @@ -16,9 +16,9 @@ export const CgnDiscountExpireProgressBar = ({ secondsExpirationTotal, setIsExpired }: Props) => { - const [seconds, setSeconds] = React.useState(secondsToExpiration); + const [seconds, setSeconds] = useState(secondsToExpiration); const isCodeExpired = seconds <= 0; - React.useEffect(() => { + useEffect(() => { const timer = setInterval(() => { setSeconds(currentSecs => currentSecs - 1); }, 1000); diff --git a/ts/features/bonus/cgn/components/merchants/discount/CgnDiscountHeader.tsx b/ts/features/bonus/cgn/components/merchants/discount/CgnDiscountHeader.tsx index 1fa27a9b3f7..00780d2e482 100644 --- a/ts/features/bonus/cgn/components/merchants/discount/CgnDiscountHeader.tsx +++ b/ts/features/bonus/cgn/components/merchants/discount/CgnDiscountHeader.tsx @@ -7,7 +7,6 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import { useHeaderHeight } from "@react-navigation/elements"; -import React from "react"; import { StyleSheet, View } from "react-native"; import { Discount } from "../../../../../../../definitions/cgn/merchants/Discount"; import I18n from "../../../../../../i18n"; diff --git a/ts/features/bonus/cgn/components/merchants/discount/___tests___/CgnDiscountHeader.test.tsx b/ts/features/bonus/cgn/components/merchants/discount/___tests___/CgnDiscountHeader.test.tsx index 7c729567319..372918a6362 100644 --- a/ts/features/bonus/cgn/components/merchants/discount/___tests___/CgnDiscountHeader.test.tsx +++ b/ts/features/bonus/cgn/components/merchants/discount/___tests___/CgnDiscountHeader.test.tsx @@ -1,6 +1,5 @@ import { NonEmptyString } from "@pagopa/ts-commons/lib/strings"; import { render } from "@testing-library/react-native"; -import React from "react"; import { Discount } from "../../../../../../../../definitions/cgn/merchants/Discount"; import { ProductCategoryEnum } from "../../../../../../../../definitions/cgn/merchants/ProductCategory"; import I18n from "../../../../../../../i18n"; diff --git a/ts/features/bonus/cgn/components/merchants/search/CategoryCheckbox.tsx b/ts/features/bonus/cgn/components/merchants/search/CategoryCheckbox.tsx index e54b37f2a6d..b7b88d75e40 100644 --- a/ts/features/bonus/cgn/components/merchants/search/CategoryCheckbox.tsx +++ b/ts/features/bonus/cgn/components/merchants/search/CategoryCheckbox.tsx @@ -2,7 +2,6 @@ import { IOCategoryIcons, ListItemCheckbox } from "@pagopa/io-app-design-system"; -import * as React from "react"; type Props = { text: string; diff --git a/ts/features/bonus/cgn/components/merchants/search/DistanceSlider.tsx b/ts/features/bonus/cgn/components/merchants/search/DistanceSlider.tsx index 998e0054295..d6a3c385ea6 100644 --- a/ts/features/bonus/cgn/components/merchants/search/DistanceSlider.tsx +++ b/ts/features/bonus/cgn/components/merchants/search/DistanceSlider.tsx @@ -1,5 +1,4 @@ import { View } from "react-native"; -import * as React from "react"; import { SliderComponent } from "@react-native-community/slider"; import { H6, IOColors } from "@pagopa/io-app-design-system"; import I18n from "../../../../../../i18n"; diff --git a/ts/features/bonus/cgn/components/merchants/search/OrderOption.tsx b/ts/features/bonus/cgn/components/merchants/search/OrderOption.tsx index 503960246c0..51103f250a7 100644 --- a/ts/features/bonus/cgn/components/merchants/search/OrderOption.tsx +++ b/ts/features/bonus/cgn/components/merchants/search/OrderOption.tsx @@ -1,5 +1,4 @@ import { H6, Icon } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { Pressable } from "react-native"; type Props = { diff --git a/ts/features/bonus/cgn/navigation/navigator.tsx b/ts/features/bonus/cgn/navigation/navigator.tsx index e5779b0d675..0da4c3a7fc1 100644 --- a/ts/features/bonus/cgn/navigation/navigator.tsx +++ b/ts/features/bonus/cgn/navigation/navigator.tsx @@ -1,6 +1,5 @@ import { PathConfigMap } from "@react-navigation/core"; import { createStackNavigator } from "@react-navigation/stack"; -import * as React from "react"; import { AppParamsList } from "../../../../navigation/params/AppParamsList"; import { isGestureEnabled } from "../../../../utils/navigation"; import CgnDetailScreen from "../screens/CgnDetailScreen"; diff --git a/ts/features/bonus/cgn/screens/CgnDetailScreen.tsx b/ts/features/bonus/cgn/screens/CgnDetailScreen.tsx index 880793297d6..1e992c3bdb9 100644 --- a/ts/features/bonus/cgn/screens/CgnDetailScreen.tsx +++ b/ts/features/bonus/cgn/screens/CgnDetailScreen.tsx @@ -7,7 +7,8 @@ import { } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; import { useNavigation } from "@react-navigation/native"; -import React from "react"; + +import { ReactElement } from "react"; import { View } from "react-native"; import { connect } from "react-redux"; import { Card } from "../../../../../definitions/cgn/Card"; @@ -83,7 +84,7 @@ function getLogoUris(card: Card | undefined, eycaDetails: EycaDetailsState) { /** * Screen to display all the information about the active CGN */ -const CgnDetailScreen = (props: Props): React.ReactElement => { +const CgnDetailScreen = (props: Props): ReactElement => { const navigation = useNavigation>(); diff --git a/ts/features/bonus/cgn/screens/__test__/CgnMerchantSearchScreen.test.tsx b/ts/features/bonus/cgn/screens/__test__/CgnMerchantSearchScreen.test.tsx index 85f8ee0160b..10712214585 100644 --- a/ts/features/bonus/cgn/screens/__test__/CgnMerchantSearchScreen.test.tsx +++ b/ts/features/bonus/cgn/screens/__test__/CgnMerchantSearchScreen.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { applyMiddleware, createStore } from "redux"; import createSagaMiddleware from "redux-saga"; import { fireEvent } from "@testing-library/react-native"; diff --git a/ts/features/bonus/cgn/screens/activation/CgnActivationCompletedScreen.tsx b/ts/features/bonus/cgn/screens/activation/CgnActivationCompletedScreen.tsx index c2f24ea5eac..fe221d48213 100644 --- a/ts/features/bonus/cgn/screens/activation/CgnActivationCompletedScreen.tsx +++ b/ts/features/bonus/cgn/screens/activation/CgnActivationCompletedScreen.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { useCallback } from "react"; import { cgnActivationComplete } from "../../store/actions/activation"; import I18n from "../../../../../i18n"; import { useIODispatch } from "../../../../../store/hooks"; @@ -10,7 +10,7 @@ import { OperationResultScreenContent } from "../../../../../components/screens/ */ const CgnActivationCompletedScreen = () => { const dispatch = useIODispatch(); - const onConfirm = React.useCallback(() => { + const onConfirm = useCallback(() => { dispatch(cgnActivationComplete()); }, [dispatch]); diff --git a/ts/features/bonus/cgn/screens/activation/CgnActivationIneligibleScreen.tsx b/ts/features/bonus/cgn/screens/activation/CgnActivationIneligibleScreen.tsx index baf5ee88bba..17cdde4532c 100644 --- a/ts/features/bonus/cgn/screens/activation/CgnActivationIneligibleScreen.tsx +++ b/ts/features/bonus/cgn/screens/activation/CgnActivationIneligibleScreen.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { useCallback } from "react"; import { cgnActivationCancel } from "../../store/actions/activation"; import I18n from "../../../../../i18n"; import { useIODispatch } from "../../../../../store/hooks"; @@ -10,10 +10,7 @@ import { OperationResultScreenContent } from "../../../../../components/screens/ */ const CgnActivationIneligibleScreen = () => { const dispatch = useIODispatch(); - const onExit = React.useCallback( - () => dispatch(cgnActivationCancel()), - [dispatch] - ); + const onExit = useCallback(() => dispatch(cgnActivationCancel()), [dispatch]); return ( { const dispatch = useIODispatch(); - const onExit = React.useCallback( - () => dispatch(cgnActivationCancel()), - [dispatch] - ); + const onExit = useCallback(() => dispatch(cgnActivationCancel()), [dispatch]); return ( { const dispatch = useIODispatch(); - const onExit = React.useCallback( - () => dispatch(cgnActivationCancel()), - [dispatch] - ); + const onExit = useCallback(() => dispatch(cgnActivationCancel()), [dispatch]); return ( { const dispatch = useIODispatch(); const navigation = useIONavigation(); - const navigateToDetail = React.useCallback(() => { + const navigateToDetail = useCallback(() => { dispatch(cgnActivationCancel()); navigation.navigate(CGN_ROUTES.DETAILS.MAIN, { screen: CGN_ROUTES.DETAILS.DETAILS diff --git a/ts/features/bonus/cgn/screens/activation/CgnCTAStartActivationScreen.tsx b/ts/features/bonus/cgn/screens/activation/CgnCTAStartActivationScreen.tsx index 532898094b9..eb087795a54 100644 --- a/ts/features/bonus/cgn/screens/activation/CgnCTAStartActivationScreen.tsx +++ b/ts/features/bonus/cgn/screens/activation/CgnCTAStartActivationScreen.tsx @@ -1,6 +1,6 @@ import { useNavigation } from "@react-navigation/native"; -import * as React from "react"; -import { useRef } from "react"; + +import { FC, useEffect, useRef } from "react"; import { Alert } from "react-native"; import { connect } from "react-redux"; import { Dispatch } from "redux"; @@ -26,7 +26,7 @@ export type Props = ReturnType & /** * this is a dummy screen reachable only from a message CTA */ -const CgnCTAStartOnboardingComponent: React.FC = (props: Props) => { +const CgnCTAStartOnboardingComponent: FC = (props: Props) => { const isFirstRender = useRef(true); // load available bonus when component is focused @@ -34,7 +34,7 @@ const CgnCTAStartOnboardingComponent: React.FC = (props: Props) => { const { availableBonus, startCgn, cgnBonus } = props; - React.useEffect(() => { + useEffect(() => { // cgnActivationStart navigate to ToS screen that needs cgb bonus from available bonus list if (availableBonus.length > 0 && cgnBonus && isFirstRender.current) { startCgn(); diff --git a/ts/features/bonus/cgn/screens/activation/CgnInformationScreen.tsx b/ts/features/bonus/cgn/screens/activation/CgnInformationScreen.tsx index 64b9a644396..5043fdeb1c8 100644 --- a/ts/features/bonus/cgn/screens/activation/CgnInformationScreen.tsx +++ b/ts/features/bonus/cgn/screens/activation/CgnInformationScreen.tsx @@ -1,18 +1,18 @@ -import * as React from "react"; +import { FunctionComponent } from "react"; import { connect } from "react-redux"; +import { useHardwareBackButton } from "../../../../../hooks/useHardwareBackButton"; import I18n from "../../../../../i18n"; import { Dispatch } from "../../../../../store/actions/types"; import { GlobalState } from "../../../../../store/reducers/types"; import { emptyContextualHelp } from "../../../../../utils/emptyContextualHelp"; -import { ID_CGN_TYPE } from "../../../common/utils"; import BonusInformationComponent from "../../../common/components/BonusInformationComponent"; +import { availableBonusTypesSelectorFromId } from "../../../common/store/selectors"; +import { ID_CGN_TYPE } from "../../../common/utils"; import { cgnActivationBack, cgnActivationCancel, cgnRequestActivation } from "../../store/actions/activation"; -import { useHardwareBackButton } from "../../../../../hooks/useHardwareBackButton"; -import { availableBonusTypesSelectorFromId } from "../../../common/store/selectors"; export type Props = ReturnType & ReturnType; @@ -20,7 +20,7 @@ export type Props = ReturnType & /** * This Screen shows all the information about the cgn program, with the rules and t&c. */ -const CgnInformationScreen: React.FunctionComponent = (props: Props) => { +const CgnInformationScreen: FunctionComponent = (props: Props) => { const onConfirm = () => props.userActivateCgn(); useHardwareBackButton(() => { props.onBack(); diff --git a/ts/features/bonus/cgn/screens/discount/CGNDiscountExpiredScreen.tsx b/ts/features/bonus/cgn/screens/discount/CGNDiscountExpiredScreen.tsx index 19178f8e0c1..9c7133838ce 100644 --- a/ts/features/bonus/cgn/screens/discount/CGNDiscountExpiredScreen.tsx +++ b/ts/features/bonus/cgn/screens/discount/CGNDiscountExpiredScreen.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { OperationResultScreenContent } from "../../../../../components/screens/OperationResultScreenContent"; import { useIONavigation } from "../../../../../navigation/params/AppParamsList"; import I18n from "../../../../../i18n"; diff --git a/ts/features/bonus/cgn/screens/discount/CgnDiscountCodeScreen.tsx b/ts/features/bonus/cgn/screens/discount/CgnDiscountCodeScreen.tsx index 35d06547c6a..0b9ef0ed831 100644 --- a/ts/features/bonus/cgn/screens/discount/CgnDiscountCodeScreen.tsx +++ b/ts/features/bonus/cgn/screens/discount/CgnDiscountCodeScreen.tsx @@ -9,7 +9,7 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import { Second } from "@pagopa/ts-commons/lib/units"; -import * as React from "react"; +import { useState, useEffect } from "react"; import { StyleSheet, View } from "react-native"; import { Otp } from "../../../../../../definitions/cgn/Otp"; import { isReady } from "../../../../../common/model/RemoteValue"; @@ -48,8 +48,7 @@ const CgnDiscountCodeScreen = () => { const dispatch = useIODispatch(); const discountCode = useIOSelector(cgnSelectedDiscountCodeSelector); const discountOtp = useIOSelector(cgnOtpDataSelector); - const [isDiscountCodeExpired, setIsDiscountCodeExpired] = - React.useState(false); + const [isDiscountCodeExpired, setIsDiscountCodeExpired] = useState(false); const navigation = useIONavigation(); const theme = useIOTheme(); @@ -75,7 +74,7 @@ const CgnDiscountCodeScreen = () => { clipboardSetStringWithFeedback(discountCode); }; - React.useEffect(() => { + useEffect(() => { if (isReady(discountOtp)) { setIsDiscountCodeExpired(getOtpExpirationTotal(discountOtp.value) <= 0); } diff --git a/ts/features/bonus/cgn/screens/discount/CgnDiscountDetailScreen.tsx b/ts/features/bonus/cgn/screens/discount/CgnDiscountDetailScreen.tsx index 5295fa93cc4..3c39683ebb6 100644 --- a/ts/features/bonus/cgn/screens/discount/CgnDiscountDetailScreen.tsx +++ b/ts/features/bonus/cgn/screens/discount/CgnDiscountDetailScreen.tsx @@ -8,7 +8,7 @@ import { } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; import { useNavigation } from "@react-navigation/native"; -import * as React from "react"; +import { useState, useMemo, useCallback, useEffect } from "react"; import { LayoutChangeEvent, Platform, StyleSheet, View } from "react-native"; import Animated, { Easing, @@ -64,7 +64,7 @@ const CgnDiscountDetailScreen = () => { ? merchantDetailsRemoteValue.value : undefined; - const [titleHeight, setTitleHeight] = React.useState(0); + const [titleHeight, setTitleHeight] = useState(0); const translationY = useSharedValue(0); const gradientOpacity = useSharedValue(1); const insets = useSafeAreaInsets(); @@ -74,14 +74,14 @@ const CgnDiscountDetailScreen = () => { const discountOtp = useIOSelector(cgnOtpDataSelector); const discountCode = useIOSelector(cgnSelectedDiscountCodeSelector); const profile = pot.toUndefined(useIOSelector(profileSelector)); - const cgnUserAgeRange = React.useMemo( + const cgnUserAgeRange = useMemo( () => getCgnUserAgeRange(profile?.date_of_birth), [profile] ); const loading = isLoading(bucketResponse) || isLoading(discountOtp); - const mixpanelCgnEvent = React.useCallback( + const mixpanelCgnEvent = useCallback( (eventName: string) => void mixpanelTrack(eventName, { userAge: cgnUserAgeRange, @@ -110,7 +110,7 @@ const CgnDiscountDetailScreen = () => { }) })); - const gradientAreaHeight: number = React.useMemo( + const gradientAreaHeight: number = useMemo( () => endMargins.screenEndSafeArea + buttonSolidHeight + gradientSafeAreaHeight, [endMargins] @@ -202,7 +202,7 @@ const CgnDiscountDetailScreen = () => { supportRequest: true }); - React.useEffect(() => { + useEffect(() => { dispatch(resetMerchantDiscountCode()); dispatch(resetOtpState()); }, [dispatch]); diff --git a/ts/features/bonus/cgn/screens/eyca/activation/EycaActivationLoading.tsx b/ts/features/bonus/cgn/screens/eyca/activation/EycaActivationLoading.tsx index b47e8814156..0d5b64444c2 100644 --- a/ts/features/bonus/cgn/screens/eyca/activation/EycaActivationLoading.tsx +++ b/ts/features/bonus/cgn/screens/eyca/activation/EycaActivationLoading.tsx @@ -1,22 +1,20 @@ -import * as React from "react"; +import { FunctionComponent } from "react"; import { connect } from "react-redux"; -import { GlobalState } from "../../../../../../store/reducers/types"; -import { Dispatch } from "../../../../../../store/actions/types"; +import { isError, isLoading } from "../../../../../../common/model/RemoteValue"; import { LoadingErrorComponent } from "../../../../../../components/LoadingErrorComponent"; import I18n from "../../../../../../i18n"; -import { eycaActivationStatusSelector } from "../../../store/reducers/eyca/activation"; +import { Dispatch } from "../../../../../../store/actions/types"; +import { GlobalState } from "../../../../../../store/reducers/types"; import { cgnEycaActivation, cgnEycaActivationCancel } from "../../../store/actions/eyca/activation"; -import { isError, isLoading } from "../../../../../../common/model/RemoteValue"; +import { eycaActivationStatusSelector } from "../../../store/reducers/eyca/activation"; type Props = ReturnType & ReturnType; -const EycaActivationLoading: React.FunctionComponent = ( - props: Props -) => ( +const EycaActivationLoading: FunctionComponent = (props: Props) => ( { const insets = useSafeAreaInsets(); const dispatch = useIODispatch(); - const [isPullRefresh, setIsPullRefresh] = React.useState(false); + const [isPullRefresh, setIsPullRefresh] = useState(false); const potCategories = useIOSelector(cgnCategoriesListSelector); const isDesignSystemEnabled = useIOSelector(isDesignSystemEnabledSelector); @@ -61,20 +61,17 @@ export const CgnMerchantCategoriesListScreen = () => { dispatch(cgnCategories.request()); }; - React.useEffect(loadCategories, [dispatch]); + useEffect(loadCategories, [dispatch]); - const isError = React.useMemo( - () => pot.isError(potCategories), - [potCategories] - ); + const isError = useMemo(() => pot.isError(potCategories), [potCategories]); - React.useEffect(() => { + useEffect(() => { if (isError) { IOToast.error(I18n.t("global.genericError")); } }, [isError]); - React.useEffect(() => { + useEffect(() => { if (pot.isSome(potCategories) && !pot.isLoading(potCategories)) { setIsPullRefresh(false); } @@ -121,7 +118,7 @@ export const CgnMerchantCategoriesListScreen = () => { }; const categoriesToArray: ReadonlyArray = - React.useMemo( + useMemo( () => [...(pot.isSome(potCategories) ? potCategories.value : [])], [potCategories] ); diff --git a/ts/features/bonus/cgn/screens/merchants/CgnMerchantDetailScreen.tsx b/ts/features/bonus/cgn/screens/merchants/CgnMerchantDetailScreen.tsx index f8978172d2d..44308e3749e 100644 --- a/ts/features/bonus/cgn/screens/merchants/CgnMerchantDetailScreen.tsx +++ b/ts/features/bonus/cgn/screens/merchants/CgnMerchantDetailScreen.tsx @@ -10,15 +10,10 @@ import { ListItemInfo, VSpacer } from "@pagopa/io-app-design-system"; -import Placeholder from "rn-placeholder"; import { Route, useRoute } from "@react-navigation/native"; -import * as React from "react"; -import { useCallback, useEffect, useMemo } from "react"; -import Animated, { - useAnimatedScrollHandler, - useSharedValue -} from "react-native-reanimated"; -import { useSafeAreaInsets } from "react-native-safe-area-context"; +import Placeholder from "rn-placeholder"; + +import { useCallback, useEffect, useMemo, useState } from "react"; import { Image, LayoutChangeEvent, @@ -26,18 +21,23 @@ import { StyleSheet, View } from "react-native"; +import Animated, { + useAnimatedScrollHandler, + useSharedValue +} from "react-native-reanimated"; +import { useSafeAreaInsets } from "react-native-safe-area-context"; import { Discount } from "../../../../../../definitions/cgn/merchants/Discount"; import { Merchant } from "../../../../../../definitions/cgn/merchants/Merchant"; import { isReady } from "../../../../../common/model/RemoteValue"; import { IOStyles } from "../../../../../components/core/variables/IOStyles"; +import { useHeaderSecondLevel } from "../../../../../hooks/useHeaderSecondLevel"; import I18n from "../../../../../i18n"; import { useIODispatch, useIOSelector } from "../../../../../store/hooks"; +import { openWebUrl } from "../../../../../utils/url"; +import { CgnAddressListItem } from "../../components/merchants/CgnAddressListItem"; import { CgnMerchantDiscountItem } from "../../components/merchants/CgnMerchantsDiscountItem"; import { cgnSelectedMerchant } from "../../store/actions/merchants"; import { cgnSelectedMerchantSelector } from "../../store/reducers/merchants"; -import { CgnAddressListItem } from "../../components/merchants/CgnAddressListItem"; -import { useHeaderSecondLevel } from "../../../../../hooks/useHeaderSecondLevel"; -import { openWebUrl } from "../../../../../utils/url"; export type CgnMerchantDetailScreenNavigationParams = Readonly<{ merchantID: Merchant["id"]; @@ -51,7 +51,7 @@ const CgnMerchantDetailScreen = () => { const scrollTranslationY = useSharedValue(0); - const [titleHeight, setTitleHeight] = React.useState(0); + const [titleHeight, setTitleHeight] = useState(0); const dispatch = useIODispatch(); const route = @@ -65,7 +65,7 @@ const CgnMerchantDetailScreen = () => { dispatch(cgnSelectedMerchant.request(merchantID)); }, [merchantID, dispatch]); - const paddingBottom: number = React.useMemo( + const paddingBottom: number = useMemo( () => safeAreaInsets.bottom === 0 ? IOVisualCostants.appMarginDefault diff --git a/ts/features/bonus/cgn/screens/merchants/CgnMerchantLandingWebview.tsx b/ts/features/bonus/cgn/screens/merchants/CgnMerchantLandingWebview.tsx index f74e1e31c6a..334761961d9 100644 --- a/ts/features/bonus/cgn/screens/merchants/CgnMerchantLandingWebview.tsx +++ b/ts/features/bonus/cgn/screens/merchants/CgnMerchantLandingWebview.tsx @@ -1,10 +1,11 @@ import { Route, useRoute } from "@react-navigation/core"; -import * as React from "react"; + +import { FunctionComponent } from "react"; import { SafeAreaView } from "react-native"; -import I18n from "../../../../../i18n"; import { IOStyles } from "../../../../../components/core/variables/IOStyles"; import BaseScreenComponent from "../../../../../components/screens/BaseScreenComponent"; import WebviewComponent from "../../../../../components/WebviewComponent"; +import I18n from "../../../../../i18n"; import { IOStackNavigationProp } from "../../../../../navigation/params/AppParamsList"; import { CgnDetailsParamsList } from "../../navigation/params"; @@ -20,9 +21,7 @@ type Props = { >; }; -const CgnMerchantLandingWebview: React.FunctionComponent = ( - props: Props -) => { +const CgnMerchantLandingWebview: FunctionComponent = (props: Props) => { const route = useRoute< Route< diff --git a/ts/features/bonus/cgn/screens/merchants/CgnMerchantSearchScreen.tsx b/ts/features/bonus/cgn/screens/merchants/CgnMerchantSearchScreen.tsx index cf40b5d9c53..d8c80af81e4 100644 --- a/ts/features/bonus/cgn/screens/merchants/CgnMerchantSearchScreen.tsx +++ b/ts/features/bonus/cgn/screens/merchants/CgnMerchantSearchScreen.tsx @@ -10,13 +10,7 @@ import { SearchInputRef, VSpacer } from "@pagopa/io-app-design-system"; -import React, { - useCallback, - useEffect, - useMemo, - useRef, - useState -} from "react"; +import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { FlatList, ListRenderItemInfo, diff --git a/ts/features/bonus/cgn/screens/merchants/CgnMerchantsCategoriesSelectionScreen.tsx b/ts/features/bonus/cgn/screens/merchants/CgnMerchantsCategoriesSelectionScreen.tsx index 8283131a6c6..e916b8d89ef 100644 --- a/ts/features/bonus/cgn/screens/merchants/CgnMerchantsCategoriesSelectionScreen.tsx +++ b/ts/features/bonus/cgn/screens/merchants/CgnMerchantsCategoriesSelectionScreen.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { useCallback } from "react"; import { View } from "react-native"; import { H2, @@ -48,10 +48,7 @@ const tabOptions: Record = { }; const CgnTabBar = ({ state, navigation }: MaterialTopTabBarProps) => { - const isFocused = React.useCallback( - (i: number) => state.index === i, - [state] - ); + const isFocused = useCallback((i: number) => state.index === i, [state]); return ( diff --git a/ts/features/bonus/cgn/screens/merchants/CgnMerchantsListByCategory.tsx b/ts/features/bonus/cgn/screens/merchants/CgnMerchantsListByCategory.tsx index e5b6477f353..f2f44c0b031 100644 --- a/ts/features/bonus/cgn/screens/merchants/CgnMerchantsListByCategory.tsx +++ b/ts/features/bonus/cgn/screens/merchants/CgnMerchantsListByCategory.tsx @@ -11,8 +11,8 @@ import { import { Route, useNavigation, useRoute } from "@react-navigation/native"; import { pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; -import * as React from "react"; -import { useMemo } from "react"; + +import { useCallback, useEffect, useMemo, useState } from "react"; import { Dimensions, LayoutChangeEvent, @@ -60,7 +60,7 @@ export type CgnMerchantListByCategoryScreenNavigationParams = Readonly<{ const CgnMerchantsListByCategory = () => { const screenHeight = Dimensions.get("window").height; - const [titleHeight, setTitleHeight] = React.useState(0); + const [titleHeight, setTitleHeight] = useState(0); const translationY = useSharedValue(0); const getTitleHeight = (event: LayoutChangeEvent) => { @@ -107,7 +107,7 @@ const CgnMerchantsListByCategory = () => { [route] ); - const [isPullRefresh, setIsPullRefresh] = React.useState(false); + const [isPullRefresh, setIsPullRefresh] = useState(false); const initLoadingLists = () => { dispatch(cgnOfflineMerchants.request(categoryFilter)); @@ -115,7 +115,7 @@ const CgnMerchantsListByCategory = () => { setIsPullRefresh(false); }; - React.useEffect(initLoadingLists, [route, categoryFilter, dispatch]); + useEffect(initLoadingLists, [route, categoryFilter, dispatch]); // Mixes online and offline merchants to render on the same list // merchants are sorted by name @@ -128,7 +128,7 @@ const CgnMerchantsListByCategory = () => { [onlineMerchants, offlineMerchants] ); - const onItemPress = React.useCallback( + const onItemPress = useCallback( (id: Merchant["id"]) => { navigate(CGN_ROUTES.DETAILS.MERCHANTS.DETAIL, { merchantID: id @@ -165,7 +165,7 @@ const CgnMerchantsListByCategory = () => { } }); - const renderItem = React.useMemo( + const renderItem = useMemo( () => CgnMerchantListViewRenderItem({ onItemPress }), [onItemPress] ); diff --git a/ts/features/bonus/cgn/screens/merchants/CgnMerchantsListScreen.tsx b/ts/features/bonus/cgn/screens/merchants/CgnMerchantsListScreen.tsx index 818999acc34..d584b583d93 100644 --- a/ts/features/bonus/cgn/screens/merchants/CgnMerchantsListScreen.tsx +++ b/ts/features/bonus/cgn/screens/merchants/CgnMerchantsListScreen.tsx @@ -1,5 +1,4 @@ -import * as React from "react"; -import { useCallback, useMemo } from "react"; +import { FunctionComponent, useCallback, useMemo } from "react"; import { FlatList, RefreshControl, SafeAreaView } from "react-native"; import { connect } from "react-redux"; import { @@ -43,9 +42,7 @@ export type MerchantsAll = OfflineMerchant | OnlineMerchant; * @param props * @constructor */ -const CgnMerchantsListScreen: React.FunctionComponent = ( - props: Props -) => { +const CgnMerchantsListScreen: FunctionComponent = (props: Props) => { const { navigateToMerchantDetail } = props; // Mixes online and offline merchants to render on the same list @@ -68,14 +65,14 @@ const CgnMerchantsListScreen: React.FunctionComponent = ( useFocusEffect(initLoadingLists); - const onItemPress = React.useCallback( + const onItemPress = useCallback( (id: Merchant["id"]) => { navigateToMerchantDetail(id); }, [navigateToMerchantDetail] ); - const renderItem = React.useMemo( + const renderItem = useMemo( () => CgnMerchantListViewRenderItem({ onItemPress }), [onItemPress] ); diff --git a/ts/features/bonus/cgn/screens/merchants/CgnMerchantsTabsScreen.tsx b/ts/features/bonus/cgn/screens/merchants/CgnMerchantsTabsScreen.tsx index 57b81194ab1..c749ac721d4 100644 --- a/ts/features/bonus/cgn/screens/merchants/CgnMerchantsTabsScreen.tsx +++ b/ts/features/bonus/cgn/screens/merchants/CgnMerchantsTabsScreen.tsx @@ -1,21 +1,20 @@ -import * as React from "react"; -import { useContext, useState } from "react"; -import { connect } from "react-redux"; -import { SafeAreaView } from "react-native"; import { constNull } from "fp-ts/lib/function"; -import { GlobalState } from "../../../../../store/reducers/types"; -import { Dispatch } from "../../../../../store/actions/types"; -import BaseScreenComponent from "../../../../../components/screens/BaseScreenComponent"; +import { FunctionComponent, useContext, useState } from "react"; +import { SafeAreaView } from "react-native"; +import { connect } from "react-redux"; +import { Merchant } from "../../../../../../definitions/cgn/merchants/Merchant"; import { IOStyles } from "../../../../../components/core/variables/IOStyles"; -import I18n from "../../../../../i18n"; -import { emptyContextualHelp } from "../../../../../utils/emptyContextualHelp"; -import { navigateToCgnMerchantDetail } from "../../navigation/actions"; +import BaseScreenComponent from "../../../../../components/screens/BaseScreenComponent"; import { BottomTopAnimation, LightModalContext } from "../../../../../components/ui/LightModal"; +import I18n from "../../../../../i18n"; +import { Dispatch } from "../../../../../store/actions/types"; +import { GlobalState } from "../../../../../store/reducers/types"; +import { emptyContextualHelp } from "../../../../../utils/emptyContextualHelp"; import CgnMerchantsFilters from "../../components/merchants/CgnMerchantsFilters"; -import { Merchant } from "../../../../../../definitions/cgn/merchants/Merchant"; +import { navigateToCgnMerchantDetail } from "../../navigation/actions"; type Props = ReturnType & ReturnType; @@ -54,7 +53,7 @@ type Props = ReturnType & * @param props * @constructor */ -const CgnMerchantsTabsScreen: React.FunctionComponent = (_: Props) => { +const CgnMerchantsTabsScreen: FunctionComponent = (_: Props) => { const { showAnimatedModal, hideModal } = useContext(LightModalContext); const [selectedTab, __] = useState<"online" | "places">("online"); diff --git a/ts/features/bonus/common/components/AvailableBonusItem.tsx b/ts/features/bonus/common/components/AvailableBonusItem.tsx index aebfa021166..cd4ffcb11d7 100644 --- a/ts/features/bonus/common/components/AvailableBonusItem.tsx +++ b/ts/features/bonus/common/components/AvailableBonusItem.tsx @@ -1,5 +1,6 @@ import { Badge, Body, H6, HSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; + +import { FunctionComponent } from "react"; import { Image, Pressable, StyleSheet, View } from "react-native"; import { BonusAvailable } from "../../../../../definitions/content/BonusAvailable"; import { BonusAvailableContent } from "../../../../../definitions/content/BonusAvailableContent"; @@ -63,9 +64,7 @@ const renderBadge = (state: AvailableBonusItemState) => { * clicking the item user navigates to the request of the related bonus * @param props */ -export const AvailableBonusItem: React.FunctionComponent = ( - props: Props -) => { +export const AvailableBonusItem: FunctionComponent = (props: Props) => { const { bonusItem, state } = props; const disabledStyle = state !== "active" ? styles.disabled : {}; const bonusTypeLocalizedContent: BonusAvailableContent = diff --git a/ts/features/bonus/common/components/BonusInformationComponent.tsx b/ts/features/bonus/common/components/BonusInformationComponent.tsx index db42d0d16bb..99dce8617b2 100644 --- a/ts/features/bonus/common/components/BonusInformationComponent.tsx +++ b/ts/features/bonus/common/components/BonusInformationComponent.tsx @@ -13,8 +13,7 @@ import { import * as AR from "fp-ts/lib/Array"; import { constNull, pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; -import * as React from "react"; -import { ComponentProps } from "react"; +import { useContext, useMemo, ComponentProps } from "react"; import { Image } from "react-native"; import Animated, { Easing, @@ -132,7 +131,7 @@ const spaceBetweenActions: IOSpacer = 24; * A screen to explain how the bonus activation works and how it will be assigned */ const BonusInformationComponent = (props: Props) => { - const { showModal, hideModal } = React.useContext(LightModalContext); + const { showModal, hideModal } = useContext(LightModalContext); const bonusType = props.bonus; const bonusTypeLocalizedContent: BonusAvailableContent = bonusType[getRemoteLocale()]; @@ -141,7 +140,7 @@ const BonusInformationComponent = (props: Props) => { const gradientOpacity = useSharedValue(1); const scrollTranslationY = useSharedValue(0); - const bottomMargin: number = React.useMemo( + const bottomMargin: number = useMemo( () => safeAreaInsets.bottom === 0 ? IOVisualCostants.appMarginDefault @@ -155,12 +154,12 @@ const BonusInformationComponent = (props: Props) => { ? buttonSolidHeight * 2 : buttonSolidHeight; - const safeBottomAreaHeight: number = React.useMemo( + const safeBottomAreaHeight: number = useMemo( () => bottomMargin + buttonsSolidHeight + contentEndMargin, [bottomMargin, buttonsSolidHeight] ); - const gradientAreaHeight: number = React.useMemo( + const gradientAreaHeight: number = useMemo( () => bottomMargin + buttonsSolidHeight + gradientSafeArea, [bottomMargin, buttonsSolidHeight] ); diff --git a/ts/features/bonus/common/components/ProgressBar.tsx b/ts/features/bonus/common/components/ProgressBar.tsx index 83ccfbf05b1..d73cee7177b 100644 --- a/ts/features/bonus/common/components/ProgressBar.tsx +++ b/ts/features/bonus/common/components/ProgressBar.tsx @@ -1,5 +1,6 @@ import { IOColors } from "@pagopa/io-app-design-system"; -import * as React from "react"; +import { FunctionComponent } from "react"; + import { View, StyleSheet, DimensionValue } from "react-native"; type Props = { @@ -36,7 +37,7 @@ const calculateStylePercentage = ( * @param props * @constructor */ -export const ProgressBar: React.FunctionComponent = props => ( +export const ProgressBar: FunctionComponent = props => ( = props => { +const TosBonusComponent: FunctionComponent = props => { const handleBackPressed = () => { props.onClose(); return true; }; - const [isLoadEnd, setOnLoadEnd] = React.useState(false); - const [hasError, setHasError] = React.useState(false); - React.useEffect(() => { + const [isLoadEnd, setOnLoadEnd] = useState(false); + const [hasError, setHasError] = useState(false); + useEffect(() => { const subscription = BackHandler.addEventListener( "hardwareBackPress", handleBackPressed diff --git a/ts/features/bonus/common/navigation/navigator.tsx b/ts/features/bonus/common/navigation/navigator.tsx index 8fbfa158274..4ac2e272467 100644 --- a/ts/features/bonus/common/navigation/navigator.tsx +++ b/ts/features/bonus/common/navigation/navigator.tsx @@ -1,5 +1,4 @@ import { createStackNavigator } from "@react-navigation/stack"; -import * as React from "react"; import { isGestureEnabled } from "../../../../utils/navigation"; import AvailableBonusScreen from "../screens/AvailableBonusScreen"; diff --git a/ts/features/bonus/common/screens/AvailableBonusScreen.tsx b/ts/features/bonus/common/screens/AvailableBonusScreen.tsx index e3aa7e4de62..5ee27816b74 100644 --- a/ts/features/bonus/common/screens/AvailableBonusScreen.tsx +++ b/ts/features/bonus/common/screens/AvailableBonusScreen.tsx @@ -1,7 +1,8 @@ import { Divider, FooterActions, IOToast } from "@pagopa/io-app-design-system"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import * as React from "react"; + +import { FunctionComponent, PureComponent } from "react"; import { FlatList, Linking, @@ -67,7 +68,7 @@ const contextualHelpMarkdown: ContextualHelpPropsMarkdown = { * - if the bonus is active (is_active = true) at on press it shows an alert that invites the user to update * - if the bonus is not active at the on press it does nothing */ -class AvailableBonusScreen extends React.PureComponent { +class AvailableBonusScreen extends PureComponent { public componentDidMount() { const cdcBonus = this.props.availableBonusesList .filter(experimentalAndVisibleBonus) @@ -235,9 +236,7 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({ } }); -const AvailableBonusScreenFC: React.FunctionComponent = ( - props: Props -) => ( +const AvailableBonusScreenFC: FunctionComponent = (props: Props) => ( diff --git a/ts/features/cie/__tests__/CieIdErrorScreen.test.tsx b/ts/features/cie/__tests__/CieIdErrorScreen.test.tsx index a48589d964f..577a825eb05 100644 --- a/ts/features/cie/__tests__/CieIdErrorScreen.test.tsx +++ b/ts/features/cie/__tests__/CieIdErrorScreen.test.tsx @@ -1,5 +1,4 @@ import { fireEvent, render } from "@testing-library/react-native"; -import React from "react"; import CieIdErrorScreen from "../screens/errors/CieIdErrorScreen"; import * as useNavigateToLoginMethod from "../../../hooks/useNavigateToLoginMethod"; import ROUTES from "../../../navigation/routes"; diff --git a/ts/features/cie/__tests__/CieIdNotInstalled.test.tsx b/ts/features/cie/__tests__/CieIdNotInstalled.test.tsx index 23ac3e19dd3..30b05752039 100644 --- a/ts/features/cie/__tests__/CieIdNotInstalled.test.tsx +++ b/ts/features/cie/__tests__/CieIdNotInstalled.test.tsx @@ -1,6 +1,5 @@ import { Platform } from "react-native"; import { fireEvent, render } from "@testing-library/react-native"; -import React from "react"; import CieIdNotInstalled, { CIE_ID_ANDROID_COLL_LINK, CIE_ID_ANDROID_LINK, diff --git a/ts/features/cie/__tests__/CieIdNotInstalledScreen.test.tsx b/ts/features/cie/__tests__/CieIdNotInstalledScreen.test.tsx index 805005925a6..d2a55a3f6c6 100644 --- a/ts/features/cie/__tests__/CieIdNotInstalledScreen.test.tsx +++ b/ts/features/cie/__tests__/CieIdNotInstalledScreen.test.tsx @@ -1,5 +1,4 @@ import { render } from "@testing-library/react-native"; -import React from "react"; import CieIdNotInstalledScreen from "../screens/CieIdNotInstalledScreen"; const mockUseRoute = jest.fn(); diff --git a/ts/features/cie/__tests__/wizards.test.tsx b/ts/features/cie/__tests__/wizards.test.tsx index 0941808b307..3c8685b9ec8 100644 --- a/ts/features/cie/__tests__/wizards.test.tsx +++ b/ts/features/cie/__tests__/wizards.test.tsx @@ -1,5 +1,4 @@ import { fireEvent, render } from "@testing-library/react-native"; -import React from "react"; import CieIdWizard, { CIE_ID_LINK } from "../screens/wizards/CieIdWizard"; import CiePinWizard, { CIE_PIN_LINK } from "../screens/wizards/CiePinWizard"; import SpidWizard from "../screens/wizards/SpidWizard"; diff --git a/ts/features/cie/components/CieIdNotInstalled.tsx b/ts/features/cie/components/CieIdNotInstalled.tsx index 577f548fe9b..02435b0b0d8 100644 --- a/ts/features/cie/components/CieIdNotInstalled.tsx +++ b/ts/features/cie/components/CieIdNotInstalled.tsx @@ -1,11 +1,11 @@ -import React from "react"; -import { Platform } from "react-native"; import { useIOToast } from "@pagopa/io-app-design-system"; +import { Platform } from "react-native"; + import { OperationResultScreenContent } from "../../../components/screens/OperationResultScreenContent"; -import { useIONavigation } from "../../../navigation/params/AppParamsList"; import I18n from "../../../i18n"; -import { trackCieIdNotInstalledDownloadAction } from "../analytics"; +import { useIONavigation } from "../../../navigation/params/AppParamsList"; import { openWebUrl } from "../../../utils/url"; +import { trackCieIdNotInstalledDownloadAction } from "../analytics"; export const CIE_ID_IOS_LINK = "https://apps.apple.com/it/app/cieid/id1504644677"; diff --git a/ts/features/cie/screens/CieIdNotInstalledScreen.tsx b/ts/features/cie/screens/CieIdNotInstalledScreen.tsx index 61feb2f035d..e0d67c0b7c0 100644 --- a/ts/features/cie/screens/CieIdNotInstalledScreen.tsx +++ b/ts/features/cie/screens/CieIdNotInstalledScreen.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { RouteProp, useRoute } from "@react-navigation/native"; import CieIdNotInstalled from "../components/CieIdNotInstalled"; import { AuthenticationParamsList } from "../../../navigation/params/AuthenticationParamsList"; diff --git a/ts/features/cie/screens/errors/CieIdErrorScreen.tsx b/ts/features/cie/screens/errors/CieIdErrorScreen.tsx index d02044d39ed..8a286c35f54 100644 --- a/ts/features/cie/screens/errors/CieIdErrorScreen.tsx +++ b/ts/features/cie/screens/errors/CieIdErrorScreen.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; import useNavigateToLoginMethod, { IdpCIE diff --git a/ts/features/cie/screens/wizards/CieIdWizard.tsx b/ts/features/cie/screens/wizards/CieIdWizard.tsx index bd952d65f2c..3ef55bc1544 100644 --- a/ts/features/cie/screens/wizards/CieIdWizard.tsx +++ b/ts/features/cie/screens/wizards/CieIdWizard.tsx @@ -4,7 +4,7 @@ import { useIOToast, VSpacer } from "@pagopa/io-app-design-system"; -import React, { useEffect } from "react"; +import { useEffect } from "react"; import I18n from "../../../../i18n"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; import { IOScrollViewActions } from "../../../../components/ui/IOScrollView"; diff --git a/ts/features/cie/screens/wizards/CiePinWizard.tsx b/ts/features/cie/screens/wizards/CiePinWizard.tsx index dc43bc03cb4..343df82c1ed 100644 --- a/ts/features/cie/screens/wizards/CiePinWizard.tsx +++ b/ts/features/cie/screens/wizards/CiePinWizard.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useRef } from "react"; +import { useEffect, useRef } from "react"; import { ButtonLink, ContentWrapper, diff --git a/ts/features/cie/screens/wizards/IDActivationWizard.tsx b/ts/features/cie/screens/wizards/IDActivationWizard.tsx index ad69de39fa3..6eef3c8539f 100644 --- a/ts/features/cie/screens/wizards/IDActivationWizard.tsx +++ b/ts/features/cie/screens/wizards/IDActivationWizard.tsx @@ -5,7 +5,7 @@ import { useIOToast, VSpacer } from "@pagopa/io-app-design-system"; -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { IOScrollViewWithLargeHeader } from "../../../../components/ui/IOScrollViewWithLargeHeader"; import I18n from "../../../../i18n"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; diff --git a/ts/features/cie/screens/wizards/SpidWizard.tsx b/ts/features/cie/screens/wizards/SpidWizard.tsx index 48856544114..76f9144b71c 100644 --- a/ts/features/cie/screens/wizards/SpidWizard.tsx +++ b/ts/features/cie/screens/wizards/SpidWizard.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { IOScrollViewWithLargeHeader } from "../../../../components/ui/IOScrollViewWithLargeHeader"; import useNavigateToLoginMethod from "../../../../hooks/useNavigateToLoginMethod"; import I18n from "../../../../i18n"; diff --git a/ts/features/cieLogin/__tests__/CieIdAuthUrlError.test.tsx b/ts/features/cieLogin/__tests__/CieIdAuthUrlError.test.tsx index 9025ace7147..7109fd297a9 100644 --- a/ts/features/cieLogin/__tests__/CieIdAuthUrlError.test.tsx +++ b/ts/features/cieLogin/__tests__/CieIdAuthUrlError.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { fireEvent, render } from "@testing-library/react-native"; import i18n from "../../../i18n"; import ROUTES from "../../../navigation/routes"; diff --git a/ts/features/cieLogin/__tests__/CieIdLoginScreen.test.tsx b/ts/features/cieLogin/__tests__/CieIdLoginScreen.test.tsx index 684f2dea4d7..87ddffde059 100644 --- a/ts/features/cieLogin/__tests__/CieIdLoginScreen.test.tsx +++ b/ts/features/cieLogin/__tests__/CieIdLoginScreen.test.tsx @@ -1,6 +1,5 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ import { render } from "@testing-library/react-native"; -import React from "react"; import { Linking } from "react-native"; import CieIdLoginScreen from "../components/screens/CieIdLoginScreen"; import { withStore } from "../../../utils/jest/withStore"; diff --git a/ts/features/cieLogin/__tests__/CieIdLoginWebView.test.tsx b/ts/features/cieLogin/__tests__/CieIdLoginWebView.test.tsx index 33c52e684a3..45e994055f0 100644 --- a/ts/features/cieLogin/__tests__/CieIdLoginWebView.test.tsx +++ b/ts/features/cieLogin/__tests__/CieIdLoginWebView.test.tsx @@ -48,8 +48,6 @@ jest.mock("react-redux", () => ({ })); jest.mock("react-native-webview", () => { - // eslint-disable-next-line @typescript-eslint/no-var-requires - const React = require("react"); // eslint-disable-next-line @typescript-eslint/no-var-requires const { View } = require("react-native"); diff --git a/ts/features/cieLogin/components/CieIdLoginWebView.tsx b/ts/features/cieLogin/components/CieIdLoginWebView.tsx index 3ae4bda9f7b..8ede80a3576 100644 --- a/ts/features/cieLogin/components/CieIdLoginWebView.tsx +++ b/ts/features/cieLogin/components/CieIdLoginWebView.tsx @@ -1,10 +1,4 @@ -import React, { - useCallback, - useEffect, - useMemo, - useRef, - useState -} from "react"; +import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { URL } from "react-native-url-polyfill"; import { openCieIdApp } from "@pagopa/io-react-native-cieid"; import { Linking, Platform, StyleSheet, View } from "react-native"; diff --git a/ts/features/cieLogin/components/screens/CieIdAuthUrlError.tsx b/ts/features/cieLogin/components/screens/CieIdAuthUrlError.tsx index d74c4b42122..6240223a8c5 100644 --- a/ts/features/cieLogin/components/screens/CieIdAuthUrlError.tsx +++ b/ts/features/cieLogin/components/screens/CieIdAuthUrlError.tsx @@ -1,4 +1,4 @@ -import React, { useCallback } from "react"; +import { useCallback } from "react"; import { Route, useRoute } from "@react-navigation/native"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; import ROUTES from "../../../../navigation/routes"; diff --git a/ts/features/cieLogin/components/screens/CieIdLoginScreen.tsx b/ts/features/cieLogin/components/screens/CieIdLoginScreen.tsx index 12dd145f1ab..de28c1444a8 100644 --- a/ts/features/cieLogin/components/screens/CieIdLoginScreen.tsx +++ b/ts/features/cieLogin/components/screens/CieIdLoginScreen.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { RouteProp, useRoute } from "@react-navigation/native"; import { AuthenticationParamsList } from "../../../../navigation/params/AuthenticationParamsList"; import ROUTES from "../../../../navigation/routes"; diff --git a/ts/features/cieLogin/components/screens/CieLoginConfigScreen.tsx b/ts/features/cieLogin/components/screens/CieLoginConfigScreen.tsx index 4e18f72623a..2c45c7f4a61 100644 --- a/ts/features/cieLogin/components/screens/CieLoginConfigScreen.tsx +++ b/ts/features/cieLogin/components/screens/CieLoginConfigScreen.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from "react"; +import { useState, useEffect } from "react"; import { SafeAreaView, ScrollView } from "react-native"; import { ContentWrapper, OTPInput } from "@pagopa/io-app-design-system"; import BaseScreenComponent from "../../../../components/screens/BaseScreenComponent"; @@ -23,8 +23,8 @@ const PinView = (props: PinViewProps) => ( ); const CieLoginConfigScreen = () => { - const [locked, setLocked] = React.useState(true); - const [pin, setPin] = React.useState(""); + const [locked, setLocked] = useState(true); + const [pin, setPin] = useState(""); // constant day containig the current day in the format YYMMDD useEffect(() => { diff --git a/ts/features/cieLogin/components/screens/CieLoginConfigScreenContent.tsx b/ts/features/cieLogin/components/screens/CieLoginConfigScreenContent.tsx index ba9b5ca55a7..0c93baa31a9 100644 --- a/ts/features/cieLogin/components/screens/CieLoginConfigScreenContent.tsx +++ b/ts/features/cieLogin/components/screens/CieLoginConfigScreenContent.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { Divider, ListItemCheckbox } from "@pagopa/io-app-design-system"; import { CieEntityIds } from "../../../../components/cie/CieRequestAuthenticationOverlay"; import { cieLoginDisableUat, cieLoginEnableUat } from "../../store/actions"; diff --git a/ts/features/design-system/DesignSystem.tsx b/ts/features/design-system/DesignSystem.tsx index ae7184e4a69..bc42e08a970 100644 --- a/ts/features/design-system/DesignSystem.tsx +++ b/ts/features/design-system/DesignSystem.tsx @@ -8,7 +8,6 @@ import { VStack, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { SectionList, StatusBar, useColorScheme } from "react-native"; import { IOStyles } from "../../components/core/variables/IOStyles"; import { useScreenEndMargin } from "../../hooks/useScreenEndMargin"; diff --git a/ts/features/design-system/components/DSAssetViewerBox.tsx b/ts/features/design-system/components/DSAssetViewerBox.tsx index 993a2c92a09..442dd55fa62 100644 --- a/ts/features/design-system/components/DSAssetViewerBox.tsx +++ b/ts/features/design-system/components/DSAssetViewerBox.tsx @@ -1,15 +1,15 @@ -import * as React from "react"; +import { IOColors, hexToRgba, useIOTheme } from "@pagopa/io-app-design-system"; import { - Text, - View, - StyleSheet, - Image as NativeImage, + ImageBackground, ImageSourcePropType, - ImageBackground + Image as NativeImage, + StyleSheet, + Text, + View } from "react-native"; -import { IOColors, hexToRgba, useIOTheme } from "@pagopa/io-app-design-system"; /* Fake Transparent BG */ +import { ReactNode } from "react"; import FakeTransparentBg from "../../../../img/utils/transparent-background-pattern.png"; export const assetItemGutter = 16; @@ -87,7 +87,7 @@ const styles = StyleSheet.create({ type DSAssetViewerBoxProps = { name: string; - image: React.ReactNode; + image: ReactNode; /* "bleed" shows the pictogram without padding "hasBleed" shows the pictgram label on top right */ type?: "vector" | "raster" | "bleed" | "hasBleed"; diff --git a/ts/features/design-system/components/DSComponentViewerBox.tsx b/ts/features/design-system/components/DSComponentViewerBox.tsx index 48f090eb551..da67fbc6485 100644 --- a/ts/features/design-system/components/DSComponentViewerBox.tsx +++ b/ts/features/design-system/components/DSComponentViewerBox.tsx @@ -1,6 +1,6 @@ -import * as React from "react"; import { View, StyleSheet, Text } from "react-native"; import { IOColors, useIOTheme } from "@pagopa/io-app-design-system"; +import { ReactNode } from "react"; const styles = StyleSheet.create({ componentWrapperFullWidth: { @@ -30,7 +30,7 @@ type DSComponentViewerBoxProps = { colorMode?: "dark" | "light"; fullWidth?: boolean; reverse?: boolean; - children: React.ReactNode; + children: ReactNode; }; export const DSComponentViewerBox = ({ diff --git a/ts/features/design-system/components/DSFullWidthComponent.tsx b/ts/features/design-system/components/DSFullWidthComponent.tsx index 8d8aebfc0b8..4484f9bd32d 100644 --- a/ts/features/design-system/components/DSFullWidthComponent.tsx +++ b/ts/features/design-system/components/DSFullWidthComponent.tsx @@ -1,9 +1,9 @@ -import * as React from "react"; -import { View, StyleSheet } from "react-native"; +import { ReactNode } from "react"; +import { StyleSheet, View } from "react-native"; import customVariables from "../../../theme/variables"; type Props = { - children: React.ReactNode; + children: ReactNode; }; const styles = StyleSheet.create({ diff --git a/ts/features/design-system/components/DSIconViewerBox.tsx b/ts/features/design-system/components/DSIconViewerBox.tsx index 250c01d9432..256c43103a6 100644 --- a/ts/features/design-system/components/DSIconViewerBox.tsx +++ b/ts/features/design-system/components/DSIconViewerBox.tsx @@ -1,6 +1,6 @@ -import * as React from "react"; import { View, StyleSheet, Text } from "react-native"; import { IOColors, useIOTheme } from "@pagopa/io-app-design-system"; +import { ReactNode } from "react"; export const iconItemGutter = 8; @@ -62,7 +62,7 @@ const styles = StyleSheet.create({ type DSIconViewerBoxProps = { name: string; - image: React.ReactNode; + image: ReactNode; size?: "small" | "medium" | "large" | undefined; withDot?: boolean; }; diff --git a/ts/features/design-system/components/DSLogoPaymentViewerBox.tsx b/ts/features/design-system/components/DSLogoPaymentViewerBox.tsx index 899d91c16d4..4196f2d28d6 100644 --- a/ts/features/design-system/components/DSLogoPaymentViewerBox.tsx +++ b/ts/features/design-system/components/DSLogoPaymentViewerBox.tsx @@ -1,8 +1,8 @@ -import * as React from "react"; -import { View, StyleSheet, Text, ImageBackground } from "react-native"; import { IOColors, hexToRgba, useIOTheme } from "@pagopa/io-app-design-system"; +import { ImageBackground, StyleSheet, Text, View } from "react-native"; /* Fake Transparent BG */ +import { ReactNode } from "react"; import FakeTransparentBg from "../../../../img/utils/transparent-background-pattern.png"; export const logoItemGutter = 8; @@ -64,7 +64,7 @@ const styles = StyleSheet.create({ type DSLogoPaymentViewerBoxProps = { name: string; - image: React.ReactNode; + image: ReactNode; size: "medium" | "large" | "full"; }; diff --git a/ts/features/design-system/components/DSSpacerViewerBox.tsx b/ts/features/design-system/components/DSSpacerViewerBox.tsx index b4595ead4a2..4eb7d561bd6 100644 --- a/ts/features/design-system/components/DSSpacerViewerBox.tsx +++ b/ts/features/design-system/components/DSSpacerViewerBox.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { View, Text } from "react-native"; import { IOColors, diff --git a/ts/features/design-system/components/DesignSystemScreen.tsx b/ts/features/design-system/components/DesignSystemScreen.tsx index c76b3966a51..9ef596b7b5e 100644 --- a/ts/features/design-system/components/DesignSystemScreen.tsx +++ b/ts/features/design-system/components/DesignSystemScreen.tsx @@ -3,13 +3,14 @@ import { IOVisualCostants, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; + +import { ReactNode } from "react"; import { ScrollView, StatusBar, View, useColorScheme } from "react-native"; import { useScreenEndMargin } from "../../../hooks/useScreenEndMargin"; type Props = { title: string; - children: React.ReactNode; + children: ReactNode; noMargin?: boolean; }; diff --git a/ts/features/design-system/components/DesignSystemSection.tsx b/ts/features/design-system/components/DesignSystemSection.tsx index 0358e1fc3a5..8d0e81bd128 100644 --- a/ts/features/design-system/components/DesignSystemSection.tsx +++ b/ts/features/design-system/components/DesignSystemSection.tsx @@ -1,8 +1,9 @@ import { H3, VStack, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; +import { PropsWithChildren } from "react"; + import { View } from "react-native"; -type OwnProps = React.PropsWithChildren<{ +type OwnProps = PropsWithChildren<{ title: string; }>; diff --git a/ts/features/design-system/core/DSAccordion.tsx b/ts/features/design-system/core/DSAccordion.tsx index 92789b063a9..f1c92a54968 100644 --- a/ts/features/design-system/core/DSAccordion.tsx +++ b/ts/features/design-system/core/DSAccordion.tsx @@ -5,7 +5,6 @@ import { useIOTheme, Body } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { FlatList, ListRenderItemInfo, View } from "react-native"; import { DesignSystemScreen } from "../components/DesignSystemScreen"; diff --git a/ts/features/design-system/core/DSAdvice.tsx b/ts/features/design-system/core/DSAdvice.tsx index 81b6bc0f9b6..09eef7225d2 100644 --- a/ts/features/design-system/core/DSAdvice.tsx +++ b/ts/features/design-system/core/DSAdvice.tsx @@ -6,7 +6,6 @@ import { bannerBackgroundColours, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { Alert } from "react-native"; import { DSComponentViewerBox } from "../components/DSComponentViewerBox"; import { DesignSystemScreen } from "../components/DesignSystemScreen"; diff --git a/ts/features/design-system/core/DSAlert.tsx b/ts/features/design-system/core/DSAlert.tsx index fca332de23c..899ef4528c4 100644 --- a/ts/features/design-system/core/DSAlert.tsx +++ b/ts/features/design-system/core/DSAlert.tsx @@ -1,5 +1,4 @@ import { Alert, H4, VStack, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { DSFullWidthComponent } from "../components/DSFullWidthComponent"; /* Types */ diff --git a/ts/features/design-system/core/DSAnimatedPictograms.tsx b/ts/features/design-system/core/DSAnimatedPictograms.tsx index d8a353c99b1..868211b3062 100644 --- a/ts/features/design-system/core/DSAnimatedPictograms.tsx +++ b/ts/features/design-system/core/DSAnimatedPictograms.tsx @@ -7,7 +7,6 @@ import { hexToRgba, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { useCallback, useState } from "react"; import { View } from "react-native"; import { ScrollView } from "react-native-gesture-handler"; diff --git a/ts/features/design-system/core/DSBadges.tsx b/ts/features/design-system/core/DSBadges.tsx index ec4b090a3d7..e66a66c6ad5 100644 --- a/ts/features/design-system/core/DSBadges.tsx +++ b/ts/features/design-system/core/DSBadges.tsx @@ -8,7 +8,6 @@ import { VStack, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { View } from "react-native"; import { DSComponentViewerBox } from "../components/DSComponentViewerBox"; import { DesignSystemScreen } from "../components/DesignSystemScreen"; diff --git a/ts/features/design-system/core/DSBonusCardScreen.tsx b/ts/features/design-system/core/DSBonusCardScreen.tsx index 75bc358b603..8790facbab8 100644 --- a/ts/features/design-system/core/DSBonusCardScreen.tsx +++ b/ts/features/design-system/core/DSBonusCardScreen.tsx @@ -4,7 +4,6 @@ import { Tag, VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { Alert } from "react-native"; import { BonusCardScreenComponent } from "../../../components/BonusCard"; import I18n from "../../../i18n"; diff --git a/ts/features/design-system/core/DSBottomSheet.tsx b/ts/features/design-system/core/DSBottomSheet.tsx index 78b0df4728e..19b0066b99b 100644 --- a/ts/features/design-system/core/DSBottomSheet.tsx +++ b/ts/features/design-system/core/DSBottomSheet.tsx @@ -9,7 +9,6 @@ import { VStack, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { SafeAreaView, View } from "react-native"; import { useIOBottomSheetAutoresizableModal, diff --git a/ts/features/design-system/core/DSButtons.tsx b/ts/features/design-system/core/DSButtons.tsx index 14bfcb99a1a..cd44f618ac9 100644 --- a/ts/features/design-system/core/DSButtons.tsx +++ b/ts/features/design-system/core/DSButtons.tsx @@ -13,7 +13,6 @@ import { useIOExperimentalDesign, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { useState } from "react"; import { Alert, StyleSheet, View } from "react-native"; import { DSComponentViewerBox } from "../components/DSComponentViewerBox"; diff --git a/ts/features/design-system/core/DSCards.tsx b/ts/features/design-system/core/DSCards.tsx index c4a6a7e381e..a7436d4260e 100644 --- a/ts/features/design-system/core/DSCards.tsx +++ b/ts/features/design-system/core/DSCards.tsx @@ -7,7 +7,7 @@ import { VSpacer, VStack } from "@pagopa/io-app-design-system"; -import * as React from "react"; +import { useState } from "react"; import { Alert, Pressable, ScrollView } from "react-native"; import { CgnCard } from "../../bonus/cgn/components/CgnCard"; import { IdPayCard } from "../../idpay/wallet/components/IdPayCard"; @@ -446,7 +446,7 @@ const ItwCards = () => ( ); const ItwSkeumorphicCardPreview = (props: ItwSkeumorphicCardProps) => { - const [isFlipped, setIsFlipped] = React.useState(false); + const [isFlipped, setIsFlipped] = useState(false); return ( setIsFlipped(!isFlipped)} @@ -461,7 +461,7 @@ const ItwSkeumorphicCardPreview = (props: ItwSkeumorphicCardProps) => { // for testing reasons, abi codes can be found here: // https://www.comuniecitta.it/elenco-banche-per-codice-abi export const DSCards = () => { - const [page, setPage] = React.useState(0); + const [page, setPage] = useState(0); return ( diff --git a/ts/features/design-system/core/DSColors.tsx b/ts/features/design-system/core/DSColors.tsx index bea71d79901..d5ff751ab1f 100644 --- a/ts/features/design-system/core/DSColors.tsx +++ b/ts/features/design-system/core/DSColors.tsx @@ -16,7 +16,6 @@ import { themeStatusColorsLightMode, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { ColorValue, Dimensions, StyleSheet, Text, View } from "react-native"; import { IOStyles } from "../../../components/core/variables/IOStyles"; import themeVariables from "../../../theme/variables"; diff --git a/ts/features/design-system/core/DSDynamicBackground.tsx b/ts/features/design-system/core/DSDynamicBackground.tsx index 6584301922f..a4365fd921f 100644 --- a/ts/features/design-system/core/DSDynamicBackground.tsx +++ b/ts/features/design-system/core/DSDynamicBackground.tsx @@ -1,5 +1,3 @@ -import * as React from "react"; - import { Avatar, Body, diff --git a/ts/features/design-system/core/DSDynamicCardRotation.tsx b/ts/features/design-system/core/DSDynamicCardRotation.tsx index 0532ceacfe8..d2dc62482cd 100644 --- a/ts/features/design-system/core/DSDynamicCardRotation.tsx +++ b/ts/features/design-system/core/DSDynamicCardRotation.tsx @@ -16,7 +16,7 @@ import { useImage, vec } from "@shopify/react-native-skia"; -import * as React from "react"; + import { useState } from "react"; import { ColorValue, diff --git a/ts/features/design-system/core/DSEdgeToEdgeArea.tsx b/ts/features/design-system/core/DSEdgeToEdgeArea.tsx index 9aba982f6f1..5a8edba73d7 100644 --- a/ts/features/design-system/core/DSEdgeToEdgeArea.tsx +++ b/ts/features/design-system/core/DSEdgeToEdgeArea.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { ScrollView, Text, View } from "react-native"; import { SafeAreaView, diff --git a/ts/features/design-system/core/DSFooterActions.tsx b/ts/features/design-system/core/DSFooterActions.tsx index 7c9a8d7f04b..e2abd469d58 100644 --- a/ts/features/design-system/core/DSFooterActions.tsx +++ b/ts/features/design-system/core/DSFooterActions.tsx @@ -5,7 +5,7 @@ import { useFooterActionsMeasurements, useIOTheme } from "@pagopa/io-app-design-system"; -import React from "react"; +import { Fragment } from "react"; import { Alert, ScrollView, StyleSheet, Text, View } from "react-native"; const onButtonPress = () => { @@ -26,7 +26,7 @@ export const DSFooterActions = () => { }} > {[...Array(9)].map((_el, i) => ( - + { - + ))} { diff --git a/ts/features/design-system/core/DSFooterActionsInlineNotFixed.tsx b/ts/features/design-system/core/DSFooterActionsInlineNotFixed.tsx index 4275759fb16..95d3c722a7f 100644 --- a/ts/features/design-system/core/DSFooterActionsInlineNotFixed.tsx +++ b/ts/features/design-system/core/DSFooterActionsInlineNotFixed.tsx @@ -4,7 +4,7 @@ import { VSpacer, useIOTheme } from "@pagopa/io-app-design-system"; -import React from "react"; +import { Fragment } from "react"; import { Alert, ScrollView, StyleSheet, Text, View } from "react-native"; const onButtonPress = () => { @@ -17,7 +17,7 @@ export const DSFooterActionsInlineNotFixed = () => { return ( {[...Array(9)].map((_el, i) => ( - + { - + ))} { @@ -18,7 +18,7 @@ export const DSFooterActionsNotFixed = () => { {[...Array(9)].map((_el, i) => ( - + { - + ))} { {[...Array(9)].map((_el, i) => ( - + { - + ))} {/* Action Block Placeholder: START */} ( diff --git a/ts/features/design-system/core/DSHeaderSecondLevelWithSectionTitle.tsx b/ts/features/design-system/core/DSHeaderSecondLevelWithSectionTitle.tsx index 968e88ea3c1..c2f9c907079 100644 --- a/ts/features/design-system/core/DSHeaderSecondLevelWithSectionTitle.tsx +++ b/ts/features/design-system/core/DSHeaderSecondLevelWithSectionTitle.tsx @@ -1,5 +1,4 @@ import { Body, VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { IOScrollViewWithLargeHeader } from "../../../components/ui/IOScrollViewWithLargeHeader"; export const DSHeaderSecondLevelWithSectionTitle = () => ( diff --git a/ts/features/design-system/core/DSIOMarkdown.tsx b/ts/features/design-system/core/DSIOMarkdown.tsx index b0f01c0b1a0..b091f6dfe47 100644 --- a/ts/features/design-system/core/DSIOMarkdown.tsx +++ b/ts/features/design-system/core/DSIOMarkdown.tsx @@ -1,4 +1,3 @@ -import React from "react"; import IOMarkdown from "../../../components/IOMarkdown"; import { DesignSystemScreen } from "../components/DesignSystemScreen"; diff --git a/ts/features/design-system/core/DSIOScrollView.tsx b/ts/features/design-system/core/DSIOScrollView.tsx index cef573dd79f..c8968e7f202 100644 --- a/ts/features/design-system/core/DSIOScrollView.tsx +++ b/ts/features/design-system/core/DSIOScrollView.tsx @@ -6,7 +6,6 @@ import { VSpacer, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { Alert, View } from "react-native"; import { IOScrollView } from "../../../components/ui/IOScrollView"; diff --git a/ts/features/design-system/core/DSIOScrollViewCentredContent.tsx b/ts/features/design-system/core/DSIOScrollViewCentredContent.tsx index 16572a21c92..5da39dd6e2e 100644 --- a/ts/features/design-system/core/DSIOScrollViewCentredContent.tsx +++ b/ts/features/design-system/core/DSIOScrollViewCentredContent.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { Alert } from "react-native"; import { IOScrollViewCentredContent } from "../../../components/ui/IOScrollViewCentredContent"; import { useHeaderSecondLevel } from "../../../hooks/useHeaderSecondLevel"; diff --git a/ts/features/design-system/core/DSIOScrollViewWithLargeHeader.tsx b/ts/features/design-system/core/DSIOScrollViewWithLargeHeader.tsx index 0c360d8d555..74149feed4f 100644 --- a/ts/features/design-system/core/DSIOScrollViewWithLargeHeader.tsx +++ b/ts/features/design-system/core/DSIOScrollViewWithLargeHeader.tsx @@ -5,7 +5,6 @@ import { VSpacer, useIOTheme } from "@pagopa/io-app-design-system"; -import React from "react"; import { Alert } from "react-native"; import { IOScrollViewWithLargeHeader } from "../../../components/ui/IOScrollViewWithLargeHeader"; diff --git a/ts/features/design-system/core/DSIOScrollViewWithListItems.tsx b/ts/features/design-system/core/DSIOScrollViewWithListItems.tsx index 06cadac6f12..acbb8db9b6c 100644 --- a/ts/features/design-system/core/DSIOScrollViewWithListItems.tsx +++ b/ts/features/design-system/core/DSIOScrollViewWithListItems.tsx @@ -1,5 +1,4 @@ import { ListItemInfo } from "@pagopa/io-app-design-system"; -import React from "react"; import { Alert } from "react-native"; import { IOScrollViewWithListItems } from "../../../components/ui/IOScrollViewWithListItems"; import { useHeaderSecondLevel } from "../../../hooks/useHeaderSecondLevel"; diff --git a/ts/features/design-system/core/DSIOScrollViewWithoutActions.tsx b/ts/features/design-system/core/DSIOScrollViewWithoutActions.tsx index baf03ee0917..1d673dc0816 100644 --- a/ts/features/design-system/core/DSIOScrollViewWithoutActions.tsx +++ b/ts/features/design-system/core/DSIOScrollViewWithoutActions.tsx @@ -1,5 +1,4 @@ import { Body, H2, VSpacer, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { IOScrollView } from "../../../components/ui/IOScrollView"; export const DSIOScrollViewWithoutActions = () => { diff --git a/ts/features/design-system/core/DSIcons.tsx b/ts/features/design-system/core/DSIcons.tsx index 9b235b52602..5ef8ec8eb23 100644 --- a/ts/features/design-system/core/DSIcons.tsx +++ b/ts/features/design-system/core/DSIcons.tsx @@ -15,7 +15,6 @@ import { VStack, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { StyleSheet, View } from "react-native"; import { DSComponentViewerBox } from "../components/DSComponentViewerBox"; import { DSIconViewerBox, iconItemGutter } from "../components/DSIconViewerBox"; diff --git a/ts/features/design-system/core/DSIridescentTrustmark.tsx b/ts/features/design-system/core/DSIridescentTrustmark.tsx index 658ea7dcab9..c5471b29e4c 100644 --- a/ts/features/design-system/core/DSIridescentTrustmark.tsx +++ b/ts/features/design-system/core/DSIridescentTrustmark.tsx @@ -1,5 +1,3 @@ -import * as React from "react"; - import { H4, useIOTheme, VSpacer } from "@pagopa/io-app-design-system"; import DESIGN_SYSTEM_ROUTES from "../navigation/routes"; diff --git a/ts/features/design-system/core/DSLayout.tsx b/ts/features/design-system/core/DSLayout.tsx index 8ef0c147e53..11c9588d580 100644 --- a/ts/features/design-system/core/DSLayout.tsx +++ b/ts/features/design-system/core/DSLayout.tsx @@ -12,7 +12,6 @@ import { VStack, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { View } from "react-native"; import { DSComponentViewerBox } from "../components/DSComponentViewerBox"; import { DSSpacerViewerBox } from "../components/DSSpacerViewerBox"; diff --git a/ts/features/design-system/core/DSLegacyAdvice.tsx b/ts/features/design-system/core/DSLegacyAdvice.tsx index 358af47f65b..881165e8057 100644 --- a/ts/features/design-system/core/DSLegacyAdvice.tsx +++ b/ts/features/design-system/core/DSLegacyAdvice.tsx @@ -1,5 +1,4 @@ import { Body, Icon, VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; /* Types */ import { InfoScreenComponent } from "../../../components/infoScreen/InfoScreenComponent"; diff --git a/ts/features/design-system/core/DSLegacyListItems.tsx b/ts/features/design-system/core/DSLegacyListItems.tsx index d63f559ec95..5609b202502 100644 --- a/ts/features/design-system/core/DSLegacyListItems.tsx +++ b/ts/features/design-system/core/DSLegacyListItems.tsx @@ -1,5 +1,4 @@ import { Divider, H4, VStack, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { Alert } from "react-native"; import ListItemComponent from "../../../components/screens/ListItemComponent"; diff --git a/ts/features/design-system/core/DSLegacyTextFields.tsx b/ts/features/design-system/core/DSLegacyTextFields.tsx index 41f60c1097a..a737a7f77e1 100644 --- a/ts/features/design-system/core/DSLegacyTextFields.tsx +++ b/ts/features/design-system/core/DSLegacyTextFields.tsx @@ -1,7 +1,7 @@ import { H4, IOColors, BodySmall, VSpacer } from "@pagopa/io-app-design-system"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React, { useState } from "react"; +import { useState } from "react"; import { View } from "react-native"; import { LabelledItem } from "../../../components/LabelledItem"; diff --git a/ts/features/design-system/core/DSListItems.tsx b/ts/features/design-system/core/DSListItems.tsx index 637ee7ebc60..e2aaabadd90 100644 --- a/ts/features/design-system/core/DSListItems.tsx +++ b/ts/features/design-system/core/DSListItems.tsx @@ -1,5 +1,3 @@ -import * as React from "react"; - import { Divider, H4, @@ -15,6 +13,7 @@ import { VStack, useIOTheme } from "@pagopa/io-app-design-system"; +import { Fragment } from "react"; import { Alert } from "react-native"; import I18n from "../../../i18n"; @@ -560,7 +559,7 @@ const renderListItemTransaction = () => ( {transactionStatusArray.map( ({ status, asset }: mockTransactionStatusData, i) => ( - + ( onPress={onButtonPress} /> {i < transactionStatusArray.length - 1 && } - + ) )} diff --git a/ts/features/design-system/core/DSLoaders.tsx b/ts/features/design-system/core/DSLoaders.tsx index cb309ae29a4..104c9a77e0b 100644 --- a/ts/features/design-system/core/DSLoaders.tsx +++ b/ts/features/design-system/core/DSLoaders.tsx @@ -8,7 +8,8 @@ import { hexToRgba, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; + +import { ReactNode, useEffect, useState } from "react"; import { StyleSheet, View } from "react-native"; import ActivityIndicator from "../../../components/ui/ActivityIndicator"; import { CircularProgress } from "../../../components/ui/CircularProgress"; @@ -40,7 +41,7 @@ const styles = StyleSheet.create({ type SpinnerViewerBox = { name: string; - children: React.ReactNode; + children: ReactNode; variant?: "default" | "primary"; }; @@ -70,8 +71,8 @@ const SpinnerViewerBox = ({ ); const ProgressLoaderViewerBox = () => { - const [progress, setProgress] = React.useState(0); - React.useEffect(() => { + const [progress, setProgress] = useState(0); + useEffect(() => { const interval = setInterval(() => { // console.log("progress", progress, (progress + 10) % 100); setProgress(prev => (prev + 10) % 100); diff --git a/ts/features/design-system/core/DSLogos.tsx b/ts/features/design-system/core/DSLogos.tsx index 17275b21fe6..fd5231f0bc3 100644 --- a/ts/features/design-system/core/DSLogos.tsx +++ b/ts/features/design-system/core/DSLogos.tsx @@ -20,7 +20,6 @@ import { hexToRgba, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { ScrollView, StyleSheet, View } from "react-native"; import { LogoPaymentExtended } from "../../../components/ui/LogoPaymentExtended"; import { AvatarDouble } from "../../messages/components/Home/DS/AvatarDouble"; diff --git a/ts/features/design-system/core/DSModules.tsx b/ts/features/design-system/core/DSModules.tsx index c111b29e006..8abe326d118 100644 --- a/ts/features/design-system/core/DSModules.tsx +++ b/ts/features/design-system/core/DSModules.tsx @@ -12,7 +12,6 @@ import { useIOTheme } from "@pagopa/io-app-design-system"; import { NonEmptyString } from "@pagopa/ts-commons/lib/strings"; -import * as React from "react"; import { Alert, ImageSourcePropType } from "react-native"; import { ProductCategoryEnum } from "../../../../definitions/cgn/merchants/ProductCategory"; import CgnLogo from "../../../../img/bonus/cgn/cgn_logo.png"; diff --git a/ts/features/design-system/core/DSNumberPad.tsx b/ts/features/design-system/core/DSNumberPad.tsx index 7f9c551296e..ed032b90606 100644 --- a/ts/features/design-system/core/DSNumberPad.tsx +++ b/ts/features/design-system/core/DSNumberPad.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { useState, useCallback, useEffect } from "react"; import { CodeInput, H2, @@ -20,22 +20,22 @@ import { useSafeAreaInsets } from "react-native-safe-area-context"; const PIN_LENGTH = 6; export const DSNumberPad = () => { - const [value, setValue] = React.useState(""); - const [darkBackground, setDarkBackground] = React.useState(false); + const [value, setValue] = useState(""); + const [darkBackground, setDarkBackground] = useState(false); const insets = useSafeAreaInsets(); const navigation = useNavigation(); - const onValueChange = React.useCallback((v: number) => { + const onValueChange = useCallback((v: number) => { setValue(prev => (prev.length < PIN_LENGTH ? `${prev}${v}` : prev)); }, []); - const onDeletePress = React.useCallback(() => { + const onDeletePress = useCallback(() => { setValue((prev: string) => prev.slice(0, -1)); }, []); - React.useEffect(() => { + useEffect(() => { navigation.setOptions({ headerStyle: { backgroundColor: darkBackground diff --git a/ts/features/design-system/core/DSOTPInput.tsx b/ts/features/design-system/core/DSOTPInput.tsx index 67c3f947b2c..67b020aa9b2 100644 --- a/ts/features/design-system/core/DSOTPInput.tsx +++ b/ts/features/design-system/core/DSOTPInput.tsx @@ -11,8 +11,8 @@ import { useIOTheme } from "@pagopa/io-app-design-system"; import { useHeaderHeight } from "@react-navigation/elements"; -import * as React from "react"; -import { useCallback, useMemo, useRef, useState } from "react"; + +import { RefObject, useCallback, useMemo, useRef, useState } from "react"; import { KeyboardAvoidingView, Platform, ScrollView, View } from "react-native"; import { useScreenEndMargin } from "../../../hooks/useScreenEndMargin"; @@ -63,8 +63,8 @@ const OTPWrapper = ({ }; const scrollVerticallyToView = ( - scrollViewRef: React.RefObject, - targetViewRef: React.RefObject + scrollViewRef: RefObject, + targetViewRef: RefObject ) => { if (targetViewRef.current && scrollViewRef.current) { targetViewRef.current.measureLayout( diff --git a/ts/features/design-system/core/DSPictograms.tsx b/ts/features/design-system/core/DSPictograms.tsx index eabbf45e30c..2848dbab2e5 100644 --- a/ts/features/design-system/core/DSPictograms.tsx +++ b/ts/features/design-system/core/DSPictograms.tsx @@ -13,7 +13,6 @@ import { hexToRgba, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { StyleSheet, View } from "react-native"; import { DSAssetViewerBox, diff --git a/ts/features/design-system/core/DSSafeArea.tsx b/ts/features/design-system/core/DSSafeArea.tsx index e3c6d12e101..6fdccbdcdad 100644 --- a/ts/features/design-system/core/DSSafeArea.tsx +++ b/ts/features/design-system/core/DSSafeArea.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { Text, View, SafeAreaView, ScrollView } from "react-native"; import { Body, diff --git a/ts/features/design-system/core/DSSafeAreaCentered.tsx b/ts/features/design-system/core/DSSafeAreaCentered.tsx index 9637043d9ab..a9533a3a933 100644 --- a/ts/features/design-system/core/DSSafeAreaCentered.tsx +++ b/ts/features/design-system/core/DSSafeAreaCentered.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { Text, View, SafeAreaView, Platform } from "react-native"; import { ScrollView } from "react-native-gesture-handler"; import { useSafeAreaInsets } from "react-native-safe-area-context"; diff --git a/ts/features/design-system/core/DSScreenEndMargin.tsx b/ts/features/design-system/core/DSScreenEndMargin.tsx index a136d1835f7..2b85092376a 100644 --- a/ts/features/design-system/core/DSScreenEndMargin.tsx +++ b/ts/features/design-system/core/DSScreenEndMargin.tsx @@ -1,5 +1,4 @@ import { Body, IOVisualCostants } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { ScrollView } from "react-native"; import { useScreenEndMargin } from "../../../hooks/useScreenEndMargin"; diff --git a/ts/features/design-system/core/DSScreenOperationResult.tsx b/ts/features/design-system/core/DSScreenOperationResult.tsx index 27550d5232a..7ba26c1f4ad 100644 --- a/ts/features/design-system/core/DSScreenOperationResult.tsx +++ b/ts/features/design-system/core/DSScreenOperationResult.tsx @@ -1,6 +1,5 @@ import { BodyProps } from "@pagopa/io-app-design-system"; import { useNavigation } from "@react-navigation/native"; -import React from "react"; import { OperationResultScreenContent } from "../../../components/screens/OperationResultScreenContent"; import I18n from "../../../i18n"; diff --git a/ts/features/design-system/core/DSSelection.tsx b/ts/features/design-system/core/DSSelection.tsx index 1dd5697e9db..392f2a8ad8e 100644 --- a/ts/features/design-system/core/DSSelection.tsx +++ b/ts/features/design-system/core/DSSelection.tsx @@ -16,8 +16,7 @@ import { VStack, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; -import { useState } from "react"; +import { ComponentProps, useState } from "react"; import { Alert, Text, View } from "react-native"; import { IOStyles } from "../../../components/core/variables/IOStyles"; import { DSComponentViewerBox } from "../components/DSComponentViewerBox"; @@ -346,7 +345,7 @@ const NativeSwitchShowroom = () => { }; type ListItemSwitchSampleProps = Pick< - React.ComponentProps, + ComponentProps, "label" | "description" | "value" | "icon" | "paymentLogo" | "action" >; diff --git a/ts/features/design-system/core/DSStepper.tsx b/ts/features/design-system/core/DSStepper.tsx index 6f8b66a6dc0..a9ab33b4d83 100644 --- a/ts/features/design-system/core/DSStepper.tsx +++ b/ts/features/design-system/core/DSStepper.tsx @@ -5,7 +5,6 @@ import { VStack, useIOTheme } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { View } from "react-native"; import { DesignSystemScreen } from "../components/DesignSystemScreen"; diff --git a/ts/features/design-system/core/DSTabNavigation.tsx b/ts/features/design-system/core/DSTabNavigation.tsx index 1a8dbf0c2a2..dda0668d98d 100644 --- a/ts/features/design-system/core/DSTabNavigation.tsx +++ b/ts/features/design-system/core/DSTabNavigation.tsx @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-empty-function */ -import * as React from "react"; +import { useState } from "react"; import { BodyMonospace, @@ -144,7 +144,7 @@ export const DSTabNavigation = () => { }; const TabNavigationWithState = (props: TabNavigation) => { - const [index, setIndex] = React.useState(0); + const [index, setIndex] = useState(0); return ( diff --git a/ts/features/design-system/core/DSTextFields.tsx b/ts/features/design-system/core/DSTextFields.tsx index 246617eb4ef..b872f8cdb8c 100644 --- a/ts/features/design-system/core/DSTextFields.tsx +++ b/ts/features/design-system/core/DSTextFields.tsx @@ -6,7 +6,8 @@ import { VStack, useIOTheme } from "@pagopa/io-app-design-system"; -import React from "react"; + +import { ComponentProps, useState } from "react"; import { View } from "react-native"; import { DSComponentViewerBox } from "../components/DSComponentViewerBox"; import { DesignSystemScreen } from "../components/DesignSystemScreen"; @@ -102,12 +103,11 @@ export const DSTextFields = () => { }; const InputComponentWrapper = ( - props: Omit< - React.ComponentProps, - "value" | "onChangeText" - > & { value?: string } + props: Omit, "value" | "onChangeText"> & { + value?: string; + } ) => { - const [inputValue, setInputValue] = React.useState(props.value ?? ""); + const [inputValue, setInputValue] = useState(props.value ?? ""); return ( @@ -116,11 +116,11 @@ const InputComponentWrapper = ( const InputValidationComponentWrapper = ( props: Omit< - React.ComponentProps, + ComponentProps, "value" | "onChangeText" | "errorMessage" > & { value?: string; errorMessage?: string } ) => { - const [inputValue, setInputValue] = React.useState(props.value ?? ""); + const [inputValue, setInputValue] = useState(props.value ?? ""); return ( , + ComponentProps, "value" | "onChangeText" > & { value?: string } ) => { - const [inputValue, setInputValue] = React.useState(props.value ?? ""); + const [inputValue, setInputValue] = useState(props.value ?? ""); return ( void; }; -export const DocumentViewer = (props: Props): React.ReactElement => { +export const DocumentViewer = (props: Props): ReactElement => { const [isError, setIsError] = useState(false); const documentUrl = props.documentUrl; const dispatch = useIODispatch(); const fciDownloadSelector = useIOSelector(fciDownloadPreviewSelector); const fciDownloadPath = useIOSelector(fciDownloadPathSelector); - React.useEffect(() => { + useEffect(() => { dispatch(fciDownloadPreview.request({ url: documentUrl })); }, [documentUrl, dispatch]); diff --git a/ts/features/fci/components/DocumentWithSignature.tsx b/ts/features/fci/components/DocumentWithSignature.tsx index 021c472873a..6e481f475e5 100644 --- a/ts/features/fci/components/DocumentWithSignature.tsx +++ b/ts/features/fci/components/DocumentWithSignature.tsx @@ -11,7 +11,7 @@ import { import * as pot from "@pagopa/ts-commons/lib/pot"; import { constNull, pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; -import * as React from "react"; +import { useRef, useState, useCallback } from "react"; import { StyleSheet, View } from "react-native"; import Pdf from "react-native-pdf"; import { SafeAreaView } from "react-native-safe-area-context"; @@ -54,9 +54,9 @@ const styles = StyleSheet.create({ }); const DocumentWithSignature = (props: Props) => { - const pdfRef = React.useRef(null); - const [totalPages, setTotalPages] = React.useState(0); - const [currentPage, setCurrentPage] = React.useState(1); + const pdfRef = useRef(null); + const [totalPages, setTotalPages] = useState(0); + const [currentPage, setCurrentPage] = useState(1); const documents = useIOSelector(fciSignatureDetailDocumentsSelector); const parsedDocuments = useIOSelector(fciSignatureFieldDrawingSelector); const { attrs, currentDoc } = props; @@ -94,7 +94,7 @@ const DocumentWithSignature = (props: Props) => { /** * Renders the pdf with the signature field drawn on it. */ - const RenderPdf = React.useCallback( + const RenderPdf = useCallback( ({ document, page }: { document: string; page: number }) => ( { * Callback to be used when the pdf cannot be loaded or the signature field cannot be drawn. * It returns an empty fragment and calls the `onError` callback. */ - const ErrorView = React.useCallback(() => { + const ErrorView = useCallback(() => { props.onError(); return <>; }, [props]); @@ -162,7 +162,7 @@ const DocumentWithSignature = (props: Props) => { /** * Renders the pdf, a loading view or an error view depending on the state of the pot. */ - const RenderMask = React.useCallback( + const RenderMask = useCallback( () => pot.fold( parsedDocuments, diff --git a/ts/features/fci/components/DocumentsNavigationBar.tsx b/ts/features/fci/components/DocumentsNavigationBar.tsx index cf7bdcb7c92..6d4992d9841 100644 --- a/ts/features/fci/components/DocumentsNavigationBar.tsx +++ b/ts/features/fci/components/DocumentsNavigationBar.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { View, StyleSheet } from "react-native"; import { IOColors, diff --git a/ts/features/fci/components/ErrorComponent.tsx b/ts/features/fci/components/ErrorComponent.tsx index fbfec3bcec9..f1f47aecb88 100644 --- a/ts/features/fci/components/ErrorComponent.tsx +++ b/ts/features/fci/components/ErrorComponent.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { View } from "react-native"; import { EmailString } from "@pagopa/ts-commons/lib/strings"; import { @@ -103,7 +102,7 @@ const ErrorComponent = (props: Props) => { /** * Render the footer buttons as vertical stacked buttons - * @returns {React.ReactElement} + * @returns {ReactElement} */ const footerButtons = () => { if (props.retry && props.assistance) { diff --git a/ts/features/fci/components/GenericErrorComponent.tsx b/ts/features/fci/components/GenericErrorComponent.tsx index 0afa3a83942..6d5160626d6 100644 --- a/ts/features/fci/components/GenericErrorComponent.tsx +++ b/ts/features/fci/components/GenericErrorComponent.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { EmailString } from "@pagopa/ts-commons/lib/strings"; import { WithTestID } from "../../../types/WithTestID"; import ErrorComponent from "./ErrorComponent"; diff --git a/ts/features/fci/components/InfoScreenComponent.tsx b/ts/features/fci/components/InfoScreenComponent.tsx index 1ef5c015964..c6b5004dbd4 100644 --- a/ts/features/fci/components/InfoScreenComponent.tsx +++ b/ts/features/fci/components/InfoScreenComponent.tsx @@ -1,16 +1,17 @@ import { Body, H2, VSpacer } from "@pagopa/io-app-design-system"; import { EmailString } from "@pagopa/ts-commons/lib/strings"; import { useFocusEffect } from "@react-navigation/native"; -import * as React from "react"; + +import { FunctionComponent, ReactNode, createRef, useCallback } from "react"; import { Linking, StyleSheet, Text, View } from "react-native"; import themeVariables from "../../../theme/variables"; import { setAccessibilityFocus } from "../../../utils/accessibility"; type Props = { - image: React.ReactNode; + image: ReactNode; title: string; // this is necessary in order to render text with different formatting - body?: string | React.ReactNode; + body?: string | ReactNode; email?: EmailString; }; @@ -26,7 +27,7 @@ const styles = StyleSheet.create({ } }); -const renderNode = (body: string | React.ReactNode, email?: EmailString) => { +const renderNode = (body: string | ReactNode, email?: EmailString) => { if (typeof body === "string") { return ( <> @@ -55,10 +56,10 @@ const renderNode = (body: string | React.ReactNode, email?: EmailString) => { * @param props * @constructor */ -export const InfoScreenComponent: React.FunctionComponent = props => { - const elementRef = React.createRef(); +export const InfoScreenComponent: FunctionComponent = props => { + const elementRef = createRef(); useFocusEffect( - React.useCallback(() => setAccessibilityFocus(elementRef), [elementRef]) + useCallback(() => setAccessibilityFocus(elementRef), [elementRef]) ); return ( diff --git a/ts/features/fci/components/LinkedText.tsx b/ts/features/fci/components/LinkedText.tsx index 596f74fa992..0939e435593 100644 --- a/ts/features/fci/components/LinkedText.tsx +++ b/ts/features/fci/components/LinkedText.tsx @@ -1,6 +1,6 @@ import { Body, H4, H6, WithTestID } from "@pagopa/io-app-design-system"; import * as O from "fp-ts/lib/Option"; -import * as React from "react"; +import { Fragment } from "react"; type Props = WithTestID<{ text: string; @@ -90,10 +90,10 @@ const LinkedText = (props: Props) => {

{textWithSeparator.split("$@").map((text, index) => O.isSome(O.fromNullable(arrayOfLinkedText[index])) ? ( - +
{text}
{arrayOfLinkedText[index]} -
+ ) : (
{text}
) diff --git a/ts/features/fci/components/LoadingComponent.tsx b/ts/features/fci/components/LoadingComponent.tsx index 4d23b3b9dab..76fdca9f80b 100644 --- a/ts/features/fci/components/LoadingComponent.tsx +++ b/ts/features/fci/components/LoadingComponent.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { SafeAreaView, StyleSheet } from "react-native"; import { Body, diff --git a/ts/features/fci/components/QtspClauseListItem.tsx b/ts/features/fci/components/QtspClauseListItem.tsx index ee64445ddaf..1c0bd20b995 100644 --- a/ts/features/fci/components/QtspClauseListItem.tsx +++ b/ts/features/fci/components/QtspClauseListItem.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { useState } from "react"; import { StyleSheet, View } from "react-native"; import { CheckboxLabel, IOStyles } from "@pagopa/io-app-design-system"; import { QtspClause } from "../../../../definitions/fci/QtspClause"; @@ -22,7 +22,7 @@ const styles = StyleSheet.create({ }); const QtspClauseListItem = (props: Props) => { - const [checked, setChecked] = React.useState(props.checked || false); + const [checked, setChecked] = useState(props.checked || false); const qtspFilledDocumentUrl = useIOSelector(fciQtspFilledDocumentUrlSelector); const onChange = (value: boolean) => { setChecked(value); diff --git a/ts/features/fci/components/SignatureFieldItem.tsx b/ts/features/fci/components/SignatureFieldItem.tsx index cfb421f08b1..828460d0d09 100644 --- a/ts/features/fci/components/SignatureFieldItem.tsx +++ b/ts/features/fci/components/SignatureFieldItem.tsx @@ -4,7 +4,7 @@ import { IOStyles, ListItemCheckbox } from "@pagopa/io-app-design-system"; -import * as React from "react"; +import { useState } from "react"; import { StyleSheet, View } from "react-native"; import I18n from "../../../i18n"; @@ -31,7 +31,7 @@ const styles = StyleSheet.create({ }); const SignatureFieldItem = (props: Props) => { - const [checked, setChecked] = React.useState(props.value || false); + const [checked, setChecked] = useState(props.value || false); const onChange = (value: boolean) => { setChecked(value); props.onChange(value); diff --git a/ts/features/fci/components/SignatureRequestItem.tsx b/ts/features/fci/components/SignatureRequestItem.tsx index a894641e7b3..aa0b3f934ce 100644 --- a/ts/features/fci/components/SignatureRequestItem.tsx +++ b/ts/features/fci/components/SignatureRequestItem.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { View, StyleSheet } from "react-native"; import { Badge, diff --git a/ts/features/fci/components/SuccessComponent.tsx b/ts/features/fci/components/SuccessComponent.tsx index 06da76a14bf..8ca3d918239 100644 --- a/ts/features/fci/components/SuccessComponent.tsx +++ b/ts/features/fci/components/SuccessComponent.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { useIODispatch, useIOSelector } from "../../../store/hooks"; import I18n from "../../../i18n"; import { SignatureRequestDetailView } from "../../../../definitions/fci/SignatureRequestDetailView"; diff --git a/ts/features/fci/components/__tests__/DocumentWithSignature.test.tsx b/ts/features/fci/components/__tests__/DocumentWithSignature.test.tsx index 44bfcb50033..575d5925f42 100644 --- a/ts/features/fci/components/__tests__/DocumentWithSignature.test.tsx +++ b/ts/features/fci/components/__tests__/DocumentWithSignature.test.tsx @@ -1,6 +1,5 @@ import "react-native"; import { Provider } from "react-redux"; -import React from "react"; import * as pot from "@pagopa/ts-commons/lib/pot"; import { NonEmptyString } from "@pagopa/ts-commons/lib/strings"; import { fireEvent } from "@testing-library/react-native"; diff --git a/ts/features/fci/components/__tests__/DocumentsNavigationBar.test.tsx b/ts/features/fci/components/__tests__/DocumentsNavigationBar.test.tsx index 7f591ee7afa..d408282db49 100644 --- a/ts/features/fci/components/__tests__/DocumentsNavigationBar.test.tsx +++ b/ts/features/fci/components/__tests__/DocumentsNavigationBar.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { fireEvent, render } from "@testing-library/react-native"; import DocumentsNavigationBar, { IndicatorPositionEnum diff --git a/ts/features/fci/components/__tests__/ErrorComponent.test.tsx b/ts/features/fci/components/__tests__/ErrorComponent.test.tsx index d11249ce26a..8960294631b 100644 --- a/ts/features/fci/components/__tests__/ErrorComponent.test.tsx +++ b/ts/features/fci/components/__tests__/ErrorComponent.test.tsx @@ -1,6 +1,5 @@ import "react-native"; import { Provider } from "react-redux"; -import React from "react"; import configureMockStore from "redux-mock-store"; import { constNull } from "fp-ts/lib/function"; import ErrorComponent from "../ErrorComponent"; diff --git a/ts/features/fci/components/__tests__/LinkedText.test.tsx b/ts/features/fci/components/__tests__/LinkedText.test.tsx index 0a596c3c9c7..7f823691854 100644 --- a/ts/features/fci/components/__tests__/LinkedText.test.tsx +++ b/ts/features/fci/components/__tests__/LinkedText.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { render } from "@testing-library/react-native"; import LinkedText from "../LinkedText"; diff --git a/ts/features/fci/components/__tests__/LoadingComponent.test.tsx b/ts/features/fci/components/__tests__/LoadingComponent.test.tsx index 117b6c6fba9..fee9ffbf3f4 100644 --- a/ts/features/fci/components/__tests__/LoadingComponent.test.tsx +++ b/ts/features/fci/components/__tests__/LoadingComponent.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { render } from "@testing-library/react-native"; import LoadingComponent from "../LoadingComponent"; diff --git a/ts/features/fci/components/__tests__/QtspClauseListItem.test.tsx b/ts/features/fci/components/__tests__/QtspClauseListItem.test.tsx index 0e9250a186b..70a3d2506e5 100644 --- a/ts/features/fci/components/__tests__/QtspClauseListItem.test.tsx +++ b/ts/features/fci/components/__tests__/QtspClauseListItem.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { Store } from "redux"; import { Provider } from "react-redux"; import configureMockStore from "redux-mock-store"; diff --git a/ts/features/fci/components/__tests__/SignatureFieldItem.test.tsx b/ts/features/fci/components/__tests__/SignatureFieldItem.test.tsx index c763f296088..20d35f4d490 100644 --- a/ts/features/fci/components/__tests__/SignatureFieldItem.test.tsx +++ b/ts/features/fci/components/__tests__/SignatureFieldItem.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { fireEvent, render } from "@testing-library/react-native"; import SignatureFieldItem from "../SignatureFieldItem"; import I18n from "../../../../i18n"; diff --git a/ts/features/fci/components/__tests__/SignatureRequestItem.test.tsx b/ts/features/fci/components/__tests__/SignatureRequestItem.test.tsx index d83dbbe325a..893e486b6cd 100644 --- a/ts/features/fci/components/__tests__/SignatureRequestItem.test.tsx +++ b/ts/features/fci/components/__tests__/SignatureRequestItem.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { fireEvent, render } from "@testing-library/react-native"; import { SignatureRequestListView } from "../../../../../definitions/fci/SignatureRequestListView"; import SignatureRequestItem from "../SignatureRequestItem"; diff --git a/ts/features/fci/components/__tests__/SuccessComponent.test.tsx b/ts/features/fci/components/__tests__/SuccessComponent.test.tsx index c85b3a358dc..9d512447ac8 100644 --- a/ts/features/fci/components/__tests__/SuccessComponent.test.tsx +++ b/ts/features/fci/components/__tests__/SuccessComponent.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore, Store } from "redux"; import { Provider } from "react-redux"; import configureMockStore from "redux-mock-store"; diff --git a/ts/features/fci/hooks/useFciAbortSignatureFlow.tsx b/ts/features/fci/hooks/useFciAbortSignatureFlow.tsx index 77e7db0a682..ed88ae10c6d 100644 --- a/ts/features/fci/hooks/useFciAbortSignatureFlow.tsx +++ b/ts/features/fci/hooks/useFciAbortSignatureFlow.tsx @@ -3,7 +3,6 @@ import { useIOExperimentalDesign } from "@pagopa/io-app-design-system"; import { useRoute } from "@react-navigation/native"; -import * as React from "react"; import { Alert } from "react-native"; import LegacyMarkdown from "../../../components/ui/Markdown/LegacyMarkdown"; import I18n from "../../../i18n"; diff --git a/ts/features/fci/hooks/useFciCheckService.tsx b/ts/features/fci/hooks/useFciCheckService.tsx index fb7e87e47cc..0f9cf858f0e 100644 --- a/ts/features/fci/hooks/useFciCheckService.tsx +++ b/ts/features/fci/hooks/useFciCheckService.tsx @@ -1,6 +1,5 @@ import { Body, FooterActionsInline } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; -import * as React from "react"; import { ComponentProps } from "react"; import { ServiceId } from "../../../../definitions/backend/ServiceId"; import I18n from "../../../i18n"; diff --git a/ts/features/fci/hooks/useFciNoSignatureFields.tsx b/ts/features/fci/hooks/useFciNoSignatureFields.tsx index bbd6d0bbb36..34b9125d925 100644 --- a/ts/features/fci/hooks/useFciNoSignatureFields.tsx +++ b/ts/features/fci/hooks/useFciNoSignatureFields.tsx @@ -1,7 +1,6 @@ import { Body, FooterActionsInline } from "@pagopa/io-app-design-system"; import { StackActions } from "@react-navigation/native"; import { increment } from "fp-ts/lib/function"; -import * as React from "react"; import { ComponentProps } from "react"; import I18n from "../../../i18n"; import { useIONavigation } from "../../../navigation/params/AppParamsList"; diff --git a/ts/features/fci/hooks/useFciSignatureFieldInfo.tsx b/ts/features/fci/hooks/useFciSignatureFieldInfo.tsx index 4291506168e..d78830d3cd4 100644 --- a/ts/features/fci/hooks/useFciSignatureFieldInfo.tsx +++ b/ts/features/fci/hooks/useFciSignatureFieldInfo.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { Body } from "@pagopa/io-app-design-system"; import { useIOBottomSheetModal } from "../../../utils/hooks/bottomSheet"; import I18n from "../../../i18n"; diff --git a/ts/features/fci/navigation/FciStackNavigator.tsx b/ts/features/fci/navigation/FciStackNavigator.tsx index 255a1e0cb2c..83a23d5b330 100644 --- a/ts/features/fci/navigation/FciStackNavigator.tsx +++ b/ts/features/fci/navigation/FciStackNavigator.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { PathConfigMap } from "@react-navigation/native"; import { createStackNavigator } from "@react-navigation/stack"; import { isGestureEnabled } from "../../../utils/navigation"; diff --git a/ts/features/fci/screens/FciRouterScreen.tsx b/ts/features/fci/screens/FciRouterScreen.tsx index 6c001486589..c88ab8f9a60 100644 --- a/ts/features/fci/screens/FciRouterScreen.tsx +++ b/ts/features/fci/screens/FciRouterScreen.tsx @@ -1,18 +1,14 @@ -import * as React from "react"; -import { pipe } from "fp-ts/lib/function"; import * as pot from "@pagopa/ts-commons/lib/pot"; import * as E from "fp-ts/lib/Either"; -import * as O from "fp-ts/lib/Option"; +import { pipe } from "fp-ts/lib/function"; import * as J from "fp-ts/lib/Json"; -import I18n from "../../../i18n"; +import * as O from "fp-ts/lib/Option"; +import { ReactElement, useEffect } from "react"; +import { ProblemJson } from "../../../../definitions/fci/ProblemJson"; import { SignatureRequestDetailView } from "../../../../definitions/fci/SignatureRequestDetailView"; +import I18n from "../../../i18n"; import { IOStackNavigationRouteProps } from "../../../navigation/params/AppParamsList"; import { useIODispatch, useIOSelector } from "../../../store/hooks"; -import { FciParamsList } from "../navigation/params"; -import { fciEndRequest, fciSignatureRequestFromId } from "../store/actions"; -import { fciSignatureRequestSelector } from "../store/reducers/fciSignatureRequest"; -import SuccessComponent from "../components/SuccessComponent"; -import GenericErrorComponent from "../components/GenericErrorComponent"; import { isFciEnabledSelector } from "../../../store/reducers/backendStatus/remoteConfig"; import { isTestEnv } from "../../../utils/environment"; import { @@ -20,9 +16,13 @@ import { getErrorFromNetworkError, getGenericError } from "../../../utils/errors"; -import { ProblemJson } from "../../../../definitions/fci/ProblemJson"; import ErrorComponent from "../components/ErrorComponent"; +import GenericErrorComponent from "../components/GenericErrorComponent"; import LoadingComponent from "../components/LoadingComponent"; +import SuccessComponent from "../components/SuccessComponent"; +import { FciParamsList } from "../navigation/params"; +import { fciEndRequest, fciSignatureRequestFromId } from "../store/actions"; +import { fciSignatureRequestSelector } from "../store/reducers/fciSignatureRequest"; export type FciRouterScreenNavigationParams = Readonly<{ signatureRequestId: SignatureRequestDetailView["id"]; @@ -30,7 +30,7 @@ export type FciRouterScreenNavigationParams = Readonly<{ const FciSignatureScreen = ( props: IOStackNavigationRouteProps -): React.ReactElement => { +): ReactElement => { // TODO: add a check to validate signatureRequestId using io-ts // https://pagopa.atlassian.net/browse/SFEQS-1705?atlOrigin=eyJpIjoiOWY2NDA4YmQ0ZTQ0NGRjZTk5MGNlZDczZGIxMDllMmIiLCJwIjoiaiJ9 const signatureRequestId = props.route.params.signatureRequestId; @@ -39,7 +39,7 @@ const FciSignatureScreen = ( const fciEnabledSelector = useIOSelector(isFciEnabledSelector); const fciEnabled = isTestEnv || fciEnabledSelector; - React.useEffect(() => { + useEffect(() => { if (fciEnabled) { dispatch(fciSignatureRequestFromId.request(signatureRequestId)); } diff --git a/ts/features/fci/screens/__tests__/FciDataSharingScreen.test.tsx b/ts/features/fci/screens/__tests__/FciDataSharingScreen.test.tsx index 82ea92cafc0..2f79908711c 100644 --- a/ts/features/fci/screens/__tests__/FciDataSharingScreen.test.tsx +++ b/ts/features/fci/screens/__tests__/FciDataSharingScreen.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import configureMockStore from "redux-mock-store"; import * as pot from "@pagopa/ts-commons/lib/pot"; import * as O from "fp-ts/lib/Option"; diff --git a/ts/features/fci/screens/__tests__/FciDocumentsScreen.test.tsx b/ts/features/fci/screens/__tests__/FciDocumentsScreen.test.tsx index 4d9d53ca7d2..a4c03a557b5 100644 --- a/ts/features/fci/screens/__tests__/FciDocumentsScreen.test.tsx +++ b/ts/features/fci/screens/__tests__/FciDocumentsScreen.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { createStore, Store } from "redux"; import { appReducer } from "../../../../store/reducers"; import { applicationChangeState } from "../../../../store/actions/application"; diff --git a/ts/features/fci/screens/__tests__/FciQtspClausesScreen.test.tsx b/ts/features/fci/screens/__tests__/FciQtspClausesScreen.test.tsx index 0939ceaea30..c147dfdd747 100644 --- a/ts/features/fci/screens/__tests__/FciQtspClausesScreen.test.tsx +++ b/ts/features/fci/screens/__tests__/FciQtspClausesScreen.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { createStore, Store } from "redux"; import { appReducer } from "../../../../store/reducers"; import { applicationChangeState } from "../../../../store/actions/application"; diff --git a/ts/features/fci/screens/__tests__/FciThankyouScreen.test.tsx b/ts/features/fci/screens/__tests__/FciThankyouScreen.test.tsx index 43dea643ecd..ce63c556295 100644 --- a/ts/features/fci/screens/__tests__/FciThankyouScreen.test.tsx +++ b/ts/features/fci/screens/__tests__/FciThankyouScreen.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import * as pot from "@pagopa/ts-commons/lib/pot"; import { createStore, Store } from "redux"; import { fireEvent } from "@testing-library/react-native"; diff --git a/ts/features/fci/screens/valid/FciDataSharingScreen.tsx b/ts/features/fci/screens/valid/FciDataSharingScreen.tsx index 931dd5680da..9ebabe94063 100644 --- a/ts/features/fci/screens/valid/FciDataSharingScreen.tsx +++ b/ts/features/fci/screens/valid/FciDataSharingScreen.tsx @@ -12,8 +12,8 @@ import { import * as pot from "@pagopa/ts-commons/lib/pot"; import { useRoute } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; -import * as React from "react"; -import { ComponentProps } from "react"; + +import { ComponentProps, ReactElement } from "react"; import { ScrollView, StyleSheet, View } from "react-native"; import { useHeaderSecondLevel } from "../../../../hooks/useHeaderSecondLevel"; import I18n from "../../../../i18n"; @@ -43,7 +43,7 @@ const styles = StyleSheet.create({ const iconSize = 24; -const FciDataSharingScreen = (): React.ReactElement => { +const FciDataSharingScreen = (): ReactElement => { const profile = useIOSelector(profileSelector); const name = useIOSelector(profileNameSelector); const fiscalCode = useIOSelector(profileFiscalCodeSelector); diff --git a/ts/features/fci/screens/valid/FciDocumentPreviewScreen.tsx b/ts/features/fci/screens/valid/FciDocumentPreviewScreen.tsx index 7db7a4d1964..53c5d3ee4f8 100644 --- a/ts/features/fci/screens/valid/FciDocumentPreviewScreen.tsx +++ b/ts/features/fci/screens/valid/FciDocumentPreviewScreen.tsx @@ -1,15 +1,15 @@ -import React from "react"; import * as S from "fp-ts/lib/string"; +import { ReactElement, useState } from "react"; +import { useHeaderSecondLevel } from "../../../../hooks/useHeaderSecondLevel"; import I18n from "../../../../i18n"; import { IOStackNavigationRouteProps } from "../../../../navigation/params/AppParamsList"; +import { useIODispatch, useIOSelector } from "../../../../store/hooks"; import { emptyContextualHelp } from "../../../../utils/emptyContextualHelp"; import { DocumentViewer } from "../../components/DocumentViewer"; +import GenericErrorComponent from "../../components/GenericErrorComponent"; import { FciParamsList } from "../../navigation/params"; -import { useIODispatch, useIOSelector } from "../../../../store/hooks"; import { fciDownloadPreviewClear, fciEndRequest } from "../../store/actions"; import { fciDownloadPathSelector } from "../../store/reducers/fciDownloadPreview"; -import GenericErrorComponent from "../../components/GenericErrorComponent"; -import { useHeaderSecondLevel } from "../../../../hooks/useHeaderSecondLevel"; export type FciDocumentPreviewScreenNavigationParams = Readonly<{ documentUrl: string; @@ -17,8 +17,8 @@ export type FciDocumentPreviewScreenNavigationParams = Readonly<{ export const FciDocumentPreviewScreen = ( props: IOStackNavigationRouteProps -): React.ReactElement => { - const [isError, setIsError] = React.useState(false); +): ReactElement => { + const [isError, setIsError] = useState(false); const documentUrl = props.route.params.documentUrl ?? ""; const fciDownloadPath = useIOSelector(fciDownloadPathSelector); const dispatch = useIODispatch(); diff --git a/ts/features/fci/screens/valid/FciDocumentsScreen.tsx b/ts/features/fci/screens/valid/FciDocumentsScreen.tsx index 73f1e482e41..cdf9eb8d61c 100644 --- a/ts/features/fci/screens/valid/FciDocumentsScreen.tsx +++ b/ts/features/fci/screens/valid/FciDocumentsScreen.tsx @@ -14,8 +14,7 @@ import { pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; import * as RA from "fp-ts/lib/ReadonlyArray"; import * as S from "fp-ts/lib/string"; -import * as React from "react"; -import { ComponentProps } from "react"; +import { useRef, useState, useEffect, ComponentProps } from "react"; import { StyleSheet, View } from "react-native"; import Pdf from "react-native-pdf"; import { TypeEnum as ClauseType } from "../../../../../definitions/fci/Clause"; @@ -58,9 +57,9 @@ export type FciDocumentsScreenNavigationParams = Readonly<{ }>; const FciDocumentsScreen = () => { - const pdfRef = React.useRef(null); - const [totalPages, setTotalPages] = React.useState(0); - const [currentPage, setCurrentPage] = React.useState(1); + const pdfRef = useRef(null); + const [totalPages, setTotalPages] = useState(0); + const [currentPage, setCurrentPage] = useState(1); const route = useRoute>(); const currentDoc = route.params.currentDoc ?? 0; const documents = useIOSelector(fciSignatureDetailDocumentsSelector); @@ -73,7 +72,7 @@ const FciDocumentsScreen = () => { const dispatch = useIODispatch(); const isFocused = useIsFocused(); - React.useEffect(() => { + useEffect(() => { if (documents.length !== 0 && isFocused) { dispatch(fciDownloadPreview.request({ url: documents[currentDoc].url })); } @@ -95,7 +94,7 @@ const FciDocumentsScreen = () => { } }, [dispatch, documentSignaturesSelector, documents, currentDoc, isFocused]); - React.useEffect(() => { + useEffect(() => { // with a document opened, we can track the opening success event if (documents[currentDoc] && isFocused) { trackFciDocOpeningSuccess( diff --git a/ts/features/fci/screens/valid/FciQtspClausesScreen.tsx b/ts/features/fci/screens/valid/FciQtspClausesScreen.tsx index b2552794b9c..02a5b16132b 100644 --- a/ts/features/fci/screens/valid/FciQtspClausesScreen.tsx +++ b/ts/features/fci/screens/valid/FciQtspClausesScreen.tsx @@ -7,8 +7,7 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; -import * as React from "react"; -import { ComponentProps } from "react"; +import { useState, useEffect, ComponentProps } from "react"; import { FlatList, ScrollView, View } from "react-native"; import { ServiceId } from "../../../../../definitions/backend/ServiceId"; import { useHeaderSecondLevel } from "../../../../hooks/useHeaderSecondLevel"; @@ -44,7 +43,7 @@ import { const FciQtspClausesScreen = () => { const dispatch = useIODispatch(); const navigation = useIONavigation(); - const [clausesChecked, setClausesChecked] = React.useState(0); + const [clausesChecked, setClausesChecked] = useState(0); const servicePreferencePot = useIOSelector(servicePreferencePotSelector); const qtspClausesSelector = useIOSelector(fciQtspClausesSelector); const qtspPrivacyTextSelector = useIOSelector(fciQtspPrivacyTextSelector); @@ -65,7 +64,7 @@ const FciQtspClausesScreen = () => { isServicePreferenceResponseSuccess(servicePreferenceValue) && servicePreferenceValue.value.inbox; - React.useEffect(() => { + useEffect(() => { if (fciServiceId) { dispatch(loadServicePreference.request(fciServiceId as ServiceId)); } diff --git a/ts/features/fci/screens/valid/FciSignatureFieldsScreen.tsx b/ts/features/fci/screens/valid/FciSignatureFieldsScreen.tsx index ee10603ea03..2e5d00d233a 100644 --- a/ts/features/fci/screens/valid/FciSignatureFieldsScreen.tsx +++ b/ts/features/fci/screens/valid/FciSignatureFieldsScreen.tsx @@ -11,8 +11,13 @@ import { Route, StackActions, useRoute } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; import * as RA from "fp-ts/lib/ReadonlyArray"; import { constFalse, increment, pipe } from "fp-ts/lib/function"; -import * as React from "react"; -import { ComponentProps } from "react"; +import { + useState, + useContext, + useMemo, + useEffect, + ComponentProps +} from "react"; import { ScrollView, SectionList, View } from "react-native"; import { Clause, @@ -75,12 +80,12 @@ const FciSignatureFieldsScreen = () => { const fciEnvironment = useIOSelector(fciEnvironmentSelector); const dispatch = useIODispatch(); const navigation = useIONavigation(); - const [isClausesChecked, setIsClausesChecked] = React.useState(false); - const [isError, setIsError] = React.useState(false); - const { showModal, hideModal } = React.useContext(LightModalContext); + const [isClausesChecked, setIsClausesChecked] = useState(false); + const [isError, setIsError] = useState(false); + const { showModal, hideModal } = useContext(LightModalContext); // get signatureFields for the current document - const docSignatures = React.useMemo( + const docSignatures = useMemo( () => pipe( documentsSignaturesSelector, @@ -91,12 +96,12 @@ const FciSignatureFieldsScreen = () => { // get required signatureFields for the current document // that user should check to sign the document - const requiredFields = React.useMemo( + const requiredFields = useMemo( () => getRequiredSignatureFields(signatureFieldsSelector), [signatureFieldsSelector] ); - React.useEffect(() => { + useEffect(() => { // get the required signature fields for the current document, // which the user has previously checked to sign it const res = pipe( diff --git a/ts/features/fci/screens/valid/FciSignatureRequestsScreen.tsx b/ts/features/fci/screens/valid/FciSignatureRequestsScreen.tsx index bd57ac5eacb..f2282719160 100644 --- a/ts/features/fci/screens/valid/FciSignatureRequestsScreen.tsx +++ b/ts/features/fci/screens/valid/FciSignatureRequestsScreen.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { useEffect } from "react"; import { SectionList, ScrollView } from "react-native"; import { H2, IOStyles } from "@pagopa/io-app-design-system"; import SignatureRequestItem from "../../components/SignatureRequestItem"; @@ -58,7 +58,7 @@ const FciSignatureRequestsScreen = () => { } }; - React.useEffect(() => { + useEffect(() => { dispatch(fciSignaturesListRequest.request()); }, [dispatch]); diff --git a/ts/features/fci/screens/valid/FciThankyouScreen.tsx b/ts/features/fci/screens/valid/FciThankyouScreen.tsx index 854902d2eb7..d5ffe3ab85b 100644 --- a/ts/features/fci/screens/valid/FciThankyouScreen.tsx +++ b/ts/features/fci/screens/valid/FciThankyouScreen.tsx @@ -5,7 +5,6 @@ import { Pictogram } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; -import * as React from "react"; import { View } from "react-native"; import { TypeEnum as ClauseTypeEnum } from "../../../../../definitions/fci/Clause"; import I18n from "../../../../i18n"; diff --git a/ts/features/fims/common/components/FimsUpdateAppAlert.tsx b/ts/features/fims/common/components/FimsUpdateAppAlert.tsx index e7d89dbe4a2..e48cfd6dfd5 100644 --- a/ts/features/fims/common/components/FimsUpdateAppAlert.tsx +++ b/ts/features/fims/common/components/FimsUpdateAppAlert.tsx @@ -2,7 +2,7 @@ import { HeaderActionProps, HeaderSecondLevel } from "@pagopa/io-app-design-system"; -import React from "react"; +import { useEffect } from "react"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; import { useStartSupportRequest } from "../../../../hooks/useStartSupportRequest"; @@ -36,7 +36,7 @@ const useOnlySupportRequestHeader = () => { const navigation = useIONavigation(); const startSupportRequest = useStartSupportRequest({}); - React.useEffect(() => { + useEffect(() => { navigation.setOptions({ header: () => ( { serviceByIdPotSelector(state, serviceId) ); - React.useEffect(() => { + useEffect(() => { const shouldFetchServiceData = isStrictNone(serviceData) || serviceData.kind === "PotNoneError"; diff --git a/ts/features/fims/common/navigation/index.tsx b/ts/features/fims/common/navigation/index.tsx index 1c0a8648add..154342f508c 100644 --- a/ts/features/fims/common/navigation/index.tsx +++ b/ts/features/fims/common/navigation/index.tsx @@ -1,5 +1,4 @@ import { createStackNavigator } from "@react-navigation/stack"; -import * as React from "react"; import { FimsHistoryScreen } from "../../history/screens/HistoryScreen"; import { FimsFlowHandlerScreen, diff --git a/ts/features/fims/history/components/FimsHistoryEmptyContent.tsx b/ts/features/fims/history/components/FimsHistoryEmptyContent.tsx index 112014cc196..c70d4ec6091 100644 --- a/ts/features/fims/history/components/FimsHistoryEmptyContent.tsx +++ b/ts/features/fims/history/components/FimsHistoryEmptyContent.tsx @@ -4,7 +4,6 @@ import { Pictogram, VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { StyleSheet, View } from "react-native"; import I18n from "../../../../i18n"; import { FimsHistoryHeaderComponent } from "./FimsHistoryHeaderComponent"; diff --git a/ts/features/fims/history/components/FimsHistoryHeaderComponent.tsx b/ts/features/fims/history/components/FimsHistoryHeaderComponent.tsx index ab699361483..190567f4004 100644 --- a/ts/features/fims/history/components/FimsHistoryHeaderComponent.tsx +++ b/ts/features/fims/history/components/FimsHistoryHeaderComponent.tsx @@ -1,5 +1,4 @@ import { Body, H2, VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { View } from "react-native"; import I18n from "../../../../i18n"; diff --git a/ts/features/fims/history/components/FimsHistoryKoScreen.tsx b/ts/features/fims/history/components/FimsHistoryKoScreen.tsx index d8518fc61cb..a82c1ce8605 100644 --- a/ts/features/fims/history/components/FimsHistoryKoScreen.tsx +++ b/ts/features/fims/history/components/FimsHistoryKoScreen.tsx @@ -1,5 +1,4 @@ import { useNavigation } from "@react-navigation/native"; -import React from "react"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; import I18n from "../../../../i18n"; import { useIODispatch } from "../../../../store/hooks"; diff --git a/ts/features/fims/history/components/FimsHistoryListItem.tsx b/ts/features/fims/history/components/FimsHistoryListItem.tsx index e098e64ec9e..46fb88ca324 100644 --- a/ts/features/fims/history/components/FimsHistoryListItem.tsx +++ b/ts/features/fims/history/components/FimsHistoryListItem.tsx @@ -9,7 +9,6 @@ import { useIOTheme, VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { StyleSheet, View } from "react-native"; import { ServiceId } from "../../../../../definitions/backend/ServiceId"; import { ServicePublic } from "../../../../../definitions/backend/ServicePublic"; diff --git a/ts/features/fims/history/components/FimsHistoryLoaders.tsx b/ts/features/fims/history/components/FimsHistoryLoaders.tsx index 62ffe75854c..01f60678a48 100644 --- a/ts/features/fims/history/components/FimsHistoryLoaders.tsx +++ b/ts/features/fims/history/components/FimsHistoryLoaders.tsx @@ -1,5 +1,4 @@ import { Divider, VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { View } from "react-native"; import Placeholder from "rn-placeholder"; import { FimsHistorySharedStyles } from "../utils/styles"; diff --git a/ts/features/fims/history/components/FimsHistoryNonEmptyContent.tsx b/ts/features/fims/history/components/FimsHistoryNonEmptyContent.tsx index adbcadf9868..32406833610 100644 --- a/ts/features/fims/history/components/FimsHistoryNonEmptyContent.tsx +++ b/ts/features/fims/history/components/FimsHistoryNonEmptyContent.tsx @@ -1,6 +1,5 @@ import { Divider, IOStyles } from "@pagopa/io-app-design-system"; import { FlashList } from "@shopify/flash-list"; -import * as React from "react"; import { AccessHistoryPage } from "../../../../../definitions/fims_history/AccessHistoryPage"; import * as RemoteValue from "../../../../common/model/RemoteValue"; import { FooterActions } from "../../../../components/ui/FooterActions"; diff --git a/ts/features/fims/history/hooks/useFimsHistoryResultToasts.tsx b/ts/features/fims/history/hooks/useFimsHistoryResultToasts.tsx index 4c332a369cb..4e37f8b9624 100644 --- a/ts/features/fims/history/hooks/useFimsHistoryResultToasts.tsx +++ b/ts/features/fims/history/hooks/useFimsHistoryResultToasts.tsx @@ -1,7 +1,7 @@ /* eslint-disable functional/immutable-data */ import { IOToast } from "@pagopa/io-app-design-system"; import { constVoid } from "fp-ts/lib/function"; -import * as React from "react"; +import { useRef, useEffect } from "react"; import { Alert } from "react-native"; import * as RemoteValue from "../../../../common/model/RemoteValue"; import I18n from "../../../../i18n"; @@ -29,9 +29,9 @@ const showFimsAlreadyExportingAlert = (onPress: () => void) => export const useFimsHistoryExport = () => { const historyExportState = useIOSelector(fimsHistoryExportStateSelector); const dispatch = useIODispatch(); - const isProcessing = React.useRef(false); + const isProcessing = useRef(false); - React.useEffect(() => { + useEffect(() => { RemoteValue.fold( historyExportState, constVoid, @@ -52,7 +52,7 @@ export const useFimsHistoryExport = () => { }, [historyExportState, dispatch]); // cleanup - React.useEffect( + useEffect( () => () => { dispatch(resetFimsHistoryExportState()); }, diff --git a/ts/features/fims/history/screens/HistoryScreen.tsx b/ts/features/fims/history/screens/HistoryScreen.tsx index 52ffc26aae8..982b9147873 100644 --- a/ts/features/fims/history/screens/HistoryScreen.tsx +++ b/ts/features/fims/history/screens/HistoryScreen.tsx @@ -1,6 +1,6 @@ /* eslint-disable functional/immutable-data */ import { IOToast } from "@pagopa/io-app-design-system"; -import * as React from "react"; +import { useRef, useEffect, useCallback } from "react"; import { useHeaderSecondLevel } from "../../../../hooks/useHeaderSecondLevel"; import I18n from "../../../../i18n"; import { useIODispatch, useIOSelector } from "../../../../store/hooks"; @@ -28,7 +28,7 @@ export const FimsHistoryScreen = () => { const historyErrorState = useIOSelector(fimsHistoryErrorSelector); const isHistoryLoading = useIOSelector(isFimsHistoryLoadingSelector); - const lastErrorToastDate = React.useRef(null); + const lastErrorToastDate = useRef(null); const shouldShowErrorToast = historyErrorState === "ALERT_ONLY"; // ---------- HOOKS @@ -39,7 +39,7 @@ export const FimsHistoryScreen = () => { supportRequest: true }); - React.useEffect(() => { + useEffect(() => { if (!requiresAppUpdate) { trackHistoryScreen(); dispatch(fimsHistoryGet.request({ shouldReloadFromScratch: true })); @@ -52,7 +52,7 @@ export const FimsHistoryScreen = () => { }; }, [dispatch, requiresAppUpdate]); - React.useEffect(() => { + useEffect(() => { if (shouldShowErrorToast) { // needed to avoid multiple state changes simultaneously lastErrorToastDate.current = Date.now(); @@ -60,7 +60,7 @@ export const FimsHistoryScreen = () => { } }, [shouldShowErrorToast]); - const fetchMoreHistoryItems = React.useCallback(() => { + const fetchMoreHistoryItems = useCallback(() => { const hasErrorTimeoutExpired = lastErrorToastDate.current ? Date.now() - lastErrorToastDate.current >= 500 : true; diff --git a/ts/features/fims/singleSignOn/components/FimsClaims.tsx b/ts/features/fims/singleSignOn/components/FimsClaims.tsx index 9d49dc9d225..10273b95da1 100644 --- a/ts/features/fims/singleSignOn/components/FimsClaims.tsx +++ b/ts/features/fims/singleSignOn/components/FimsClaims.tsx @@ -1,15 +1,15 @@ import { Divider, H6, Icon, IOColors } from "@pagopa/io-app-design-system"; -import * as React from "react"; +import { Fragment } from "react"; import { View, StyleSheet } from "react-native"; import { Claim } from "../../../../../definitions/fims_sso/Claim"; export const FimsClaimsList = ({ claims }: ClaimsListProps) => ( {claims.map((claim, index) => ( - + {index < claims.length - 1 && } - + ))} ); diff --git a/ts/features/fims/singleSignOn/components/FimsFullScreenErrors.tsx b/ts/features/fims/singleSignOn/components/FimsFullScreenErrors.tsx index 4aeca1ab908..a2b799b8b87 100644 --- a/ts/features/fims/singleSignOn/components/FimsFullScreenErrors.tsx +++ b/ts/features/fims/singleSignOn/components/FimsFullScreenErrors.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { useMemo, useCallback } from "react"; import { OperationResultScreenContent, OperationResultScreenContentProps @@ -17,7 +17,7 @@ export const FimsSSOFullScreenError = () => { const errorTag = useIOSelector(fimsAuthenticationErrorTagSelector); const debugData = useIOSelector(fimsDebugDataSelector); - const debugInfo = React.useMemo( + const debugInfo = useMemo( () => ({ fimsFailure: `${errorTag}: ${debugData}` }), @@ -25,7 +25,7 @@ export const FimsSSOFullScreenError = () => { ); useDebugInfo(debugInfo); - const handleClose = React.useCallback( + const handleClose = useCallback( () => dispatch(fimsCancelOrAbortAction()), [dispatch] ); diff --git a/ts/features/fims/singleSignOn/components/FimsPrivacyInfo.tsx b/ts/features/fims/singleSignOn/components/FimsPrivacyInfo.tsx index 301746b2fab..9fdcdf4927c 100644 --- a/ts/features/fims/singleSignOn/components/FimsPrivacyInfo.tsx +++ b/ts/features/fims/singleSignOn/components/FimsPrivacyInfo.tsx @@ -1,5 +1,4 @@ import { Body } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { LoadingSkeleton } from "../../../../components/ui/Markdown/LoadingSkeleton"; import I18n from "../../../../i18n"; import { openWebUrl } from "../../../../utils/url"; diff --git a/ts/features/fims/singleSignOn/components/FimsSuccessBody.tsx b/ts/features/fims/singleSignOn/components/FimsSuccessBody.tsx index 8d5a22c3e1f..672ce92ab7d 100644 --- a/ts/features/fims/singleSignOn/components/FimsSuccessBody.tsx +++ b/ts/features/fims/singleSignOn/components/FimsSuccessBody.tsx @@ -16,7 +16,7 @@ import { import * as pot from "@pagopa/ts-commons/lib/pot"; import { pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/Option"; -import * as React from "react"; +import { useEffect } from "react"; import { StyleSheet, View } from "react-native"; import { ServiceId } from "../../../../../definitions/backend/ServiceId"; import { Consent } from "../../../../../definitions/fims_sso/Consent"; @@ -59,7 +59,7 @@ export const FimsFlowSuccessBody = ({ generateBottomSheetProps(privacyUrl) ); - React.useEffect(() => { + useEffect(() => { if (serviceData) { const state = store.getState(); computeAndTrackDataShare(serviceData, state); diff --git a/ts/features/fims/singleSignOn/screens/FimsFlowHandlerScreen.tsx b/ts/features/fims/singleSignOn/screens/FimsFlowHandlerScreen.tsx index b0db1b756fb..67fca665bb5 100644 --- a/ts/features/fims/singleSignOn/screens/FimsFlowHandlerScreen.tsx +++ b/ts/features/fims/singleSignOn/screens/FimsFlowHandlerScreen.tsx @@ -2,7 +2,7 @@ import { Body, IOStyles } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; import { constTrue, pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/Option"; -import * as React from "react"; +import { useCallback, useEffect } from "react"; import { View } from "react-native"; import LoadingScreenContent from "../../../../components/screens/LoadingScreenContent"; import { useHardwareBackButton } from "../../../../hooks/useHardwareBackButton"; @@ -47,7 +47,7 @@ export const FimsFlowHandlerScreen = ( const consentsPot = useIOSelector(fimsConsentsDataSelector); const authenticationFailed = useIOSelector(fimsAuthenticationFailedSelector); - const handleCancelOrAbort = React.useCallback(() => { + const handleCancelOrAbort = useCallback(() => { if (loadingState !== "abort") { dispatch(fimsCancelOrAbortAction()); } @@ -71,7 +71,7 @@ export const FimsFlowHandlerScreen = ( // propagated to this UI, causing a back loop useHardwareBackButton(constTrue); - React.useEffect(() => { + useEffect(() => { if (ctaUrl && !requiresAppUpdate) { dispatch(fimsGetConsentsListAction.request({ ctaText, ctaUrl })); } else if (requiresAppUpdate) { diff --git a/ts/features/idpay/barcode/components/BarcodeExpirationProgressBar.tsx b/ts/features/idpay/barcode/components/BarcodeExpirationProgressBar.tsx index f240d3391f9..136c10e01d8 100644 --- a/ts/features/idpay/barcode/components/BarcodeExpirationProgressBar.tsx +++ b/ts/features/idpay/barcode/components/BarcodeExpirationProgressBar.tsx @@ -1,6 +1,6 @@ import { BodySmall, VSpacer } from "@pagopa/io-app-design-system"; import { format } from "date-fns"; -import * as React from "react"; +import { useState, useEffect } from "react"; import { StyleSheet, View } from "react-native"; import I18n from "../../../../i18n"; import { ProgressBar } from "../../../bonus/common/components/ProgressBar"; @@ -16,9 +16,9 @@ export const IdPayBarcodeExpireProgressBar = ({ secondsExpirationTotal, setIsExpired }: Props) => { - const [seconds, setSeconds] = React.useState(secondsToExpiration); + const [seconds, setSeconds] = useState(secondsToExpiration); const isCodeExpired = seconds === 0; - React.useEffect(() => { + useEffect(() => { const timer = setInterval(() => { setSeconds(currentSecs => currentSecs - 1); }, 1000); diff --git a/ts/features/idpay/barcode/navigation/navigator.tsx b/ts/features/idpay/barcode/navigation/navigator.tsx index d25351fcfff..ba407fac0c5 100644 --- a/ts/features/idpay/barcode/navigation/navigator.tsx +++ b/ts/features/idpay/barcode/navigation/navigator.tsx @@ -1,5 +1,4 @@ import { createStackNavigator } from "@react-navigation/stack"; -import * as React from "react"; import { IdPayBarcodeResultScreen } from "../screens/IdPayBarcodeResultScreen"; import { IdPayBarcodeParamsList } from "./params"; import { IdPayBarcodeRoutes } from "./routes"; diff --git a/ts/features/idpay/barcode/screens/IdPayBarcodeResultScreen.tsx b/ts/features/idpay/barcode/screens/IdPayBarcodeResultScreen.tsx index 48e92f02046..8bae15b49eb 100644 --- a/ts/features/idpay/barcode/screens/IdPayBarcodeResultScreen.tsx +++ b/ts/features/idpay/barcode/screens/IdPayBarcodeResultScreen.tsx @@ -14,7 +14,7 @@ import * as pot from "@pagopa/ts-commons/lib/pot"; import { RouteProp, useRoute } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import * as React from "react"; +import { useState, useMemo } from "react"; import { SafeAreaView, StyleSheet, View } from "react-native"; import Barcode from "react-native-barcode-builder"; import { TransactionBarCodeResponse } from "../../../../../definitions/idpay/TransactionBarCodeResponse"; @@ -96,12 +96,12 @@ const IdPayBarcodeResultScreen = () => { const SuccessContent = ({ goBack, barcode }: SuccessContentProps) => { const trx = barcode.trxCode.toUpperCase(); - const [isBarcodeExpired, setIsBarcodeExpired] = React.useState(false); + const [isBarcodeExpired, setIsBarcodeExpired] = useState(false); // expire check is handled by the progress bar // to avoid unnecessary rerenders, which could also be on the // heavier side due to barcode generation - const secondsTillExpire = React.useMemo( + const secondsTillExpire = useMemo( () => calculateIdPayBarcodeSecondsToExpire(barcode), [barcode] ); diff --git a/ts/features/idpay/code/components/IdPayCodeCieBanner.tsx b/ts/features/idpay/code/components/IdPayCodeCieBanner.tsx index 21089e1edce..67363f3d441 100644 --- a/ts/features/idpay/code/components/IdPayCodeCieBanner.tsx +++ b/ts/features/idpay/code/components/IdPayCodeCieBanner.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { useRef, useEffect } from "react"; import { VSpacer, Banner } from "@pagopa/io-app-design-system"; import { useNavigation } from "@react-navigation/native"; @@ -17,7 +17,7 @@ export type IdPayCodeCIEBannerParams = { }; const IdPayCodeCieBanner = ({ initiativeId }: IdPayCodeCIEBannerParams) => { - const bannerViewRef = React.useRef(null); + const bannerViewRef = useRef(null); const navigation = useNavigation>(); const dispatch = useIODispatch(); @@ -26,7 +26,7 @@ const IdPayCodeCieBanner = ({ initiativeId }: IdPayCodeCIEBannerParams) => { isLoadingDiscountInitiativeInstrumentsSelector ); - React.useEffect(() => { + useEffect(() => { if (initiativeId) { dispatch( idpayInitiativeInstrumentsGet.request({ diff --git a/ts/features/idpay/code/components/IdPayInfoCieBottomSheet.tsx b/ts/features/idpay/code/components/IdPayInfoCieBottomSheet.tsx index 6c41792eb5e..eebbe9c948c 100644 --- a/ts/features/idpay/code/components/IdPayInfoCieBottomSheet.tsx +++ b/ts/features/idpay/code/components/IdPayInfoCieBottomSheet.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { View } from "react-native"; import { FeatureInfo, H4, VSpacer } from "@pagopa/io-app-design-system"; import { diff --git a/ts/features/idpay/code/navigation/navigator.tsx b/ts/features/idpay/code/navigation/navigator.tsx index ae97c4f06da..5342a58e9e8 100644 --- a/ts/features/idpay/code/navigation/navigator.tsx +++ b/ts/features/idpay/code/navigation/navigator.tsx @@ -3,7 +3,6 @@ import { StackNavigationProp, createStackNavigator } from "@react-navigation/stack"; -import * as React from "react"; import { IdPayCodeDisplayScreen } from "../screens/IdPayCodeDisplayScreen"; import { IdPayCodeOnboardingScreen } from "../screens/IdPayCodeOnboardingScreen"; import { IdPayCodeRenewScreen } from "../screens/IdPayCodeRenewScreen"; diff --git a/ts/features/idpay/code/screens/IdPayCodeDisplayScreen.tsx b/ts/features/idpay/code/screens/IdPayCodeDisplayScreen.tsx index 7fbc2f5a4e3..7970e9514c5 100644 --- a/ts/features/idpay/code/screens/IdPayCodeDisplayScreen.tsx +++ b/ts/features/idpay/code/screens/IdPayCodeDisplayScreen.tsx @@ -10,7 +10,7 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import { RouteProp, useNavigation, useRoute } from "@react-navigation/native"; -import * as React from "react"; +import { useEffect, createRef } from "react"; import { StyleSheet, View } from "react-native"; import { SafeAreaView } from "react-native-safe-area-context"; import LoadingSpinnerOverlay from "../../../../components/LoadingSpinnerOverlay"; @@ -52,7 +52,7 @@ const IdPayCodeDisplayScreen = () => { const { bottomSheet, present: presentCieBottomSheet } = useIdPayInfoCieBottomSheet(); - React.useEffect(() => { + useEffect(() => { if (isFailure) { navigation.replace(IdPayCodeRoutes.IDPAY_CODE_MAIN, { screen: IdPayCodeRoutes.IDPAY_CODE_RESULT @@ -70,7 +70,7 @@ const IdPayCodeDisplayScreen = () => { } }; - const bannerRef = React.createRef(); + const bannerRef = createRef(); const buttonLabel: string = isOnboarding ? I18n.t("global.buttons.continue") diff --git a/ts/features/idpay/code/screens/IdPayCodeOnboardingScreen.tsx b/ts/features/idpay/code/screens/IdPayCodeOnboardingScreen.tsx index 5dba8d2ff4d..7c71b742caa 100644 --- a/ts/features/idpay/code/screens/IdPayCodeOnboardingScreen.tsx +++ b/ts/features/idpay/code/screens/IdPayCodeOnboardingScreen.tsx @@ -1,5 +1,4 @@ import { RouteProp, useNavigation, useRoute } from "@react-navigation/native"; -import * as React from "react"; import { AppParamsList, IOStackNavigationProp diff --git a/ts/features/idpay/code/screens/IdPayCodeRenewScreen.tsx b/ts/features/idpay/code/screens/IdPayCodeRenewScreen.tsx index 3be24d5b275..5fdbd1986b2 100644 --- a/ts/features/idpay/code/screens/IdPayCodeRenewScreen.tsx +++ b/ts/features/idpay/code/screens/IdPayCodeRenewScreen.tsx @@ -6,7 +6,6 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import { useNavigation } from "@react-navigation/native"; -import * as React from "react"; import { Alert, View } from "react-native"; import TopScreenComponent from "../../../../components/screens/TopScreenComponent"; import I18n from "../../../../i18n"; diff --git a/ts/features/idpay/code/screens/IdPayCodeResultScreen.tsx b/ts/features/idpay/code/screens/IdPayCodeResultScreen.tsx index 059d1404bee..214798cfe7f 100644 --- a/ts/features/idpay/code/screens/IdPayCodeResultScreen.tsx +++ b/ts/features/idpay/code/screens/IdPayCodeResultScreen.tsx @@ -1,5 +1,4 @@ import { useNavigation } from "@react-navigation/native"; -import * as React from "react"; import LoadingSpinnerOverlay from "../../../../components/LoadingSpinnerOverlay"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; import I18n from "../../../../i18n"; diff --git a/ts/features/idpay/common/components/Skeleton.tsx b/ts/features/idpay/common/components/Skeleton.tsx index a84bc7f76a5..68883a44c45 100644 --- a/ts/features/idpay/common/components/Skeleton.tsx +++ b/ts/features/idpay/common/components/Skeleton.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import Placeholder, { BoxProps } from "rn-placeholder"; export const Skeleton = (props: BoxProps) => ( diff --git a/ts/features/idpay/common/components/Table.tsx b/ts/features/idpay/common/components/Table.tsx index ff37696e971..2001a196722 100644 --- a/ts/features/idpay/common/components/Table.tsx +++ b/ts/features/idpay/common/components/Table.tsx @@ -1,10 +1,11 @@ -import React, { Fragment } from "react"; +import { Fragment, ReactNode } from "react"; + import { StyleSheet, View } from "react-native"; import { Body, Divider, H6, WithTestID } from "@pagopa/io-app-design-system"; export type TableRow = WithTestID<{ label: string; - value: string | React.ReactNode; + value: string | ReactNode; }>; type TableProps = { @@ -12,7 +13,7 @@ type TableProps = { rows: ReadonlyArray; }; -const renderTable = (data: ReadonlyArray): React.ReactNode => +const renderTable = (data: ReadonlyArray): ReactNode => data.map((item, index) => { const isLast = data.length === index + 1; diff --git a/ts/features/idpay/configuration/components/IdPayDiscountInstrumentEnrollmentSwitch.tsx b/ts/features/idpay/configuration/components/IdPayDiscountInstrumentEnrollmentSwitch.tsx index faea2323c55..14be105eaf1 100644 --- a/ts/features/idpay/configuration/components/IdPayDiscountInstrumentEnrollmentSwitch.tsx +++ b/ts/features/idpay/configuration/components/IdPayDiscountInstrumentEnrollmentSwitch.tsx @@ -4,7 +4,6 @@ import { ListItemSwitch, SwitchAction } from "@pagopa/io-app-design-system"; -import { default as React } from "react"; import { InstrumentTypeEnum, StatusEnum diff --git a/ts/features/idpay/configuration/components/InstrumentEnrollmentSwitch.tsx b/ts/features/idpay/configuration/components/InstrumentEnrollmentSwitch.tsx index 7279bdb180f..6f0449344e7 100644 --- a/ts/features/idpay/configuration/components/InstrumentEnrollmentSwitch.tsx +++ b/ts/features/idpay/configuration/components/InstrumentEnrollmentSwitch.tsx @@ -8,7 +8,6 @@ import * as pot from "@pagopa/ts-commons/lib/pot"; import * as E from "fp-ts/lib/Either"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import { default as React } from "react"; import { StatusEnum as InstrumentStatusEnum } from "../../../../../definitions/idpay/InstrumentDTO"; import { CreditCardType, Wallet } from "../../../../types/pagopa"; import { instrumentStatusLabels } from "../../common/labels"; diff --git a/ts/features/idpay/configuration/machine/provider.tsx b/ts/features/idpay/configuration/machine/provider.tsx index 80d69e8bd9b..c84beffdec8 100644 --- a/ts/features/idpay/configuration/machine/provider.tsx +++ b/ts/features/idpay/configuration/machine/provider.tsx @@ -2,7 +2,8 @@ import { createActorContext } from "@xstate/react"; import * as E from "fp-ts/lib/Either"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; + +import { ReactNode } from "react"; import { PreferredLanguageEnum } from "../../../../../definitions/backend/PreferredLanguage"; import { PaymentManagerClient } from "../../../../api/pagopa"; import { @@ -32,7 +33,7 @@ import { createActorsImplementation } from "./actors"; import { idPayConfigurationMachine } from "./machine"; type Props = { - children: React.ReactNode; + children: ReactNode; }; export const IdPayConfigurationMachineContext = createActorContext( diff --git a/ts/features/idpay/configuration/navigation/navigator.tsx b/ts/features/idpay/configuration/navigation/navigator.tsx index 9b7cd213795..68f86aaad31 100644 --- a/ts/features/idpay/configuration/navigation/navigator.tsx +++ b/ts/features/idpay/configuration/navigation/navigator.tsx @@ -1,5 +1,4 @@ import { createStackNavigator } from "@react-navigation/stack"; -import React from "react"; import { isGestureEnabled } from "../../../../utils/navigation"; import { IdPayConfigurationMachineContext, diff --git a/ts/features/idpay/configuration/screens/ConfigurationSuccessScreen.tsx b/ts/features/idpay/configuration/screens/ConfigurationSuccessScreen.tsx index f46a9467b68..8fca3d6e2ba 100644 --- a/ts/features/idpay/configuration/screens/ConfigurationSuccessScreen.tsx +++ b/ts/features/idpay/configuration/screens/ConfigurationSuccessScreen.tsx @@ -9,7 +9,6 @@ import { } from "@pagopa/io-app-design-system"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; import { SafeAreaView, StyleSheet, View } from "react-native"; import I18n from "../../../../i18n"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; diff --git a/ts/features/idpay/configuration/screens/IbanConfigurationLandingScreen.tsx b/ts/features/idpay/configuration/screens/IbanConfigurationLandingScreen.tsx index c257ee96f7c..17511f6537d 100644 --- a/ts/features/idpay/configuration/screens/IbanConfigurationLandingScreen.tsx +++ b/ts/features/idpay/configuration/screens/IbanConfigurationLandingScreen.tsx @@ -7,7 +7,6 @@ import { Pictogram, VSpacer } from "@pagopa/io-app-design-system"; -import React from "react"; import { SafeAreaView, StyleSheet, View } from "react-native"; import { IOStyles } from "../../../../components/core/variables/IOStyles"; import BaseScreenComponent from "../../../../components/screens/BaseScreenComponent"; diff --git a/ts/features/idpay/configuration/screens/IbanEnrollmentScreen.tsx b/ts/features/idpay/configuration/screens/IbanEnrollmentScreen.tsx index ddf9a11e27b..a66e9df4094 100644 --- a/ts/features/idpay/configuration/screens/IbanEnrollmentScreen.tsx +++ b/ts/features/idpay/configuration/screens/IbanEnrollmentScreen.tsx @@ -7,7 +7,7 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import { RouteProp, useFocusEffect, useRoute } from "@react-navigation/native"; -import React from "react"; +import { useState, useCallback, useEffect } from "react"; import { SafeAreaView, ScrollView, StyleSheet } from "react-native"; import { IbanDTO } from "../../../../../definitions/idpay/IbanDTO"; import LoadingSpinnerOverlay from "../../../../components/LoadingSpinnerOverlay"; @@ -54,10 +54,10 @@ export const IbanEnrollmentScreen = () => { const enrolledIban = IdPayConfigurationMachineContext.useSelector(selectEnrolledIban); - const [selectedIban, setSelectedIban] = React.useState(); + const [selectedIban, setSelectedIban] = useState(); useFocusEffect( - React.useCallback(() => { + useCallback(() => { if (initiativeId !== undefined) { machine.send({ type: "start-configuration", @@ -68,13 +68,13 @@ export const IbanEnrollmentScreen = () => { }, [machine, initiativeId]) ); - React.useEffect(() => { + useEffect(() => { if (enrolledIban) { setSelectedIban(enrolledIban); } }, [enrolledIban]); - const handleSelectIban = React.useCallback( + const handleSelectIban = useCallback( (iban: IbanDTO) => { setSelectedIban(iban); diff --git a/ts/features/idpay/configuration/screens/IbanOnboardingScreen.tsx b/ts/features/idpay/configuration/screens/IbanOnboardingScreen.tsx index 0b0cb80d3ef..8b303fb9f75 100644 --- a/ts/features/idpay/configuration/screens/IbanOnboardingScreen.tsx +++ b/ts/features/idpay/configuration/screens/IbanOnboardingScreen.tsx @@ -9,7 +9,7 @@ import { } from "@pagopa/io-app-design-system"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; +import { useState } from "react"; import { ScrollView, View } from "react-native"; import { Iban } from "../../../../../definitions/backend/Iban"; import { LabelledItem } from "../../../../components/LabelledItem"; @@ -24,12 +24,12 @@ export const IbanOnboardingScreen = () => { const machine = IdPayConfigurationMachineContext.useActorRef(); const customGoBack = () => machine.send({ type: "back" }); - const [iban, setIban] = React.useState<{ + const [iban, setIban] = useState<{ text: string; value: O.Option; }>({ text: "", value: O.none }); - const [ibanName, setIbanName] = React.useState(""); + const [ibanName, setIbanName] = useState(""); const isLoading = IdPayConfigurationMachineContext.useSelector(isLoadingSelector); diff --git a/ts/features/idpay/configuration/screens/IdPayDiscountInstrumentsScreen.tsx b/ts/features/idpay/configuration/screens/IdPayDiscountInstrumentsScreen.tsx index c42b7e749fd..51ad9273ded 100644 --- a/ts/features/idpay/configuration/screens/IdPayDiscountInstrumentsScreen.tsx +++ b/ts/features/idpay/configuration/screens/IdPayDiscountInstrumentsScreen.tsx @@ -6,7 +6,7 @@ import { useNavigation, useRoute } from "@react-navigation/native"; -import React from "react"; +import { useMemo, useCallback } from "react"; import { ScrollView, StyleSheet } from "react-native"; import { InstrumentTypeEnum } from "../../../../../definitions/idpay/InstrumentDTO"; import LoadingSpinnerOverlay from "../../../../components/LoadingSpinnerOverlay"; @@ -60,7 +60,7 @@ export const IdPayDiscountInstrumentsScreen = () => { isLoadingDiscountInitiativeInstrumentsSelector ); - const idPayCodeInstrument = React.useMemo( + const idPayCodeInstrument = useMemo( () => initiativeInstruments.find( initiative => initiative.instrumentType === InstrumentTypeEnum.IDPAYCODE @@ -78,7 +78,7 @@ export const IdPayDiscountInstrumentsScreen = () => { const { bottomSheet, present: presentCieBottomSheet } = useIdPayInfoCieBottomSheet(); - const getInstruments = React.useCallback(() => { + const getInstruments = useCallback(() => { dispatch( idPayInitiativeInstrumentsRefreshStart({ initiativeId diff --git a/ts/features/idpay/configuration/screens/InitiativeConfigurationIntroScreen.tsx b/ts/features/idpay/configuration/screens/InitiativeConfigurationIntroScreen.tsx index dec945fd448..31b68f4d13d 100644 --- a/ts/features/idpay/configuration/screens/InitiativeConfigurationIntroScreen.tsx +++ b/ts/features/idpay/configuration/screens/InitiativeConfigurationIntroScreen.tsx @@ -17,7 +17,7 @@ import { useNavigation, useRoute } from "@react-navigation/native"; -import React from "react"; +import { useCallback } from "react"; import { SafeAreaView, ScrollView, StyleSheet, View } from "react-native"; import LoadingSpinnerOverlay from "../../../../components/LoadingSpinnerOverlay"; import TouchableDefaultOpacity from "../../../../components/TouchableDefaultOpacity"; @@ -59,7 +59,7 @@ export const InitiativeConfigurationIntroScreen = () => { ); useFocusEffect( - React.useCallback(() => { + useCallback(() => { if (!!initiativeId && !!mode) { machine.send({ type: "start-configuration", diff --git a/ts/features/idpay/configuration/screens/InstrumentsEnrollmentScreen.tsx b/ts/features/idpay/configuration/screens/InstrumentsEnrollmentScreen.tsx index 5aa3a619cbb..f65f5815b1e 100644 --- a/ts/features/idpay/configuration/screens/InstrumentsEnrollmentScreen.tsx +++ b/ts/features/idpay/configuration/screens/InstrumentsEnrollmentScreen.tsx @@ -10,7 +10,7 @@ import { import { RouteProp, useFocusEffect, useRoute } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; +import { useState, useCallback, useEffect } from "react"; import { ScrollView } from "react-native"; import LoadingSpinnerOverlay from "../../../../components/LoadingSpinnerOverlay"; import BaseScreenComponent from "../../../../components/screens/BaseScreenComponent"; @@ -52,7 +52,7 @@ export const InstrumentsEnrollmentScreen = () => { const { useActorRef, useSelector } = IdPayConfigurationMachineContext; const machine = useActorRef(); - const [stagedWalletId, setStagedWalletId] = React.useState(); + const [stagedWalletId, setStagedWalletId] = useState(); const isLoading = useSelector(isLoadingSelector); const failure = useSelector(failureSelector); @@ -71,7 +71,7 @@ export const InstrumentsEnrollmentScreen = () => { Object.keys(initiativeInstrumentsByIdWallet).length > 0; useFocusEffect( - React.useCallback(() => { + useCallback(() => { if (initiativeId) { machine.send({ type: "start-configuration", @@ -82,7 +82,7 @@ export const InstrumentsEnrollmentScreen = () => { }, [machine, initiativeId]) ); - React.useEffect(() => { + useEffect(() => { pipe( failure, O.filter( @@ -156,7 +156,7 @@ export const InstrumentsEnrollmentScreen = () => { 175 ); - React.useEffect(() => { + useEffect(() => { if (stagedWalletId) { enrollmentBottomSheetModal.present(); } else { diff --git a/ts/features/idpay/details/components/BeneficiaryDetailsContent.tsx b/ts/features/idpay/details/components/BeneficiaryDetailsContent.tsx index 71349c27c27..a8ff3d5750e 100644 --- a/ts/features/idpay/details/components/BeneficiaryDetailsContent.tsx +++ b/ts/features/idpay/details/components/BeneficiaryDetailsContent.tsx @@ -4,7 +4,6 @@ import { useNavigation } from "@react-navigation/native"; import { sequenceS } from "fp-ts/lib/Apply"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; import { StyleSheet, View } from "react-native"; import Placeholder from "rn-placeholder"; import { diff --git a/ts/features/idpay/details/components/IdPayInitiativeLastUpdateCounter.tsx b/ts/features/idpay/details/components/IdPayInitiativeLastUpdateCounter.tsx index 3cb515316cd..e5267614cd0 100644 --- a/ts/features/idpay/details/components/IdPayInitiativeLastUpdateCounter.tsx +++ b/ts/features/idpay/details/components/IdPayInitiativeLastUpdateCounter.tsx @@ -2,7 +2,6 @@ import { BodySmall } from "@pagopa/io-app-design-system"; import { format } from "date-fns"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import * as React from "react"; import { StyleSheet, View } from "react-native"; import Placeholder from "rn-placeholder"; import I18n from "../../../../i18n"; diff --git a/ts/features/idpay/details/components/InitiativeDiscountSettingsComponent.tsx b/ts/features/idpay/details/components/InitiativeDiscountSettingsComponent.tsx index 583cae36552..ceec82a9b83 100644 --- a/ts/features/idpay/details/components/InitiativeDiscountSettingsComponent.tsx +++ b/ts/features/idpay/details/components/InitiativeDiscountSettingsComponent.tsx @@ -2,7 +2,6 @@ import { H6, ListItemNav, VSpacer } from "@pagopa/io-app-design-system"; import { useNavigation } from "@react-navigation/core"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; import { View } from "react-native"; import { InitiativeDTO } from "../../../../../definitions/idpay/InitiativeDTO"; import I18n from "../../../../i18n"; diff --git a/ts/features/idpay/details/components/InitiativeRefundSettingsComponent.tsx b/ts/features/idpay/details/components/InitiativeRefundSettingsComponent.tsx index ea40f1fbd0b..9b2c8df12b2 100644 --- a/ts/features/idpay/details/components/InitiativeRefundSettingsComponent.tsx +++ b/ts/features/idpay/details/components/InitiativeRefundSettingsComponent.tsx @@ -7,7 +7,6 @@ import { import { useNavigation } from "@react-navigation/core"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; import { View } from "react-native"; import { InitiativeDTO, diff --git a/ts/features/idpay/details/components/InitiativeRulesInfoBox.tsx b/ts/features/idpay/details/components/InitiativeRulesInfoBox.tsx index 4b01d37103a..021f4eaaac5 100644 --- a/ts/features/idpay/details/components/InitiativeRulesInfoBox.tsx +++ b/ts/features/idpay/details/components/InitiativeRulesInfoBox.tsx @@ -8,7 +8,6 @@ import { Icon, VSpacer } from "@pagopa/io-app-design-system"; -import React from "react"; import { StyleSheet, View } from "react-native"; import Placeholder from "rn-placeholder"; import { IOStyles } from "../../../../components/core/variables/IOStyles"; diff --git a/ts/features/idpay/details/components/InitiativeTimelineComponent.tsx b/ts/features/idpay/details/components/InitiativeTimelineComponent.tsx index dfc3214da2a..8f7f71cdd62 100644 --- a/ts/features/idpay/details/components/InitiativeTimelineComponent.tsx +++ b/ts/features/idpay/details/components/InitiativeTimelineComponent.tsx @@ -7,7 +7,7 @@ import { } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; import { useNavigation } from "@react-navigation/native"; -import React from "react"; +import { Fragment } from "react"; import { View } from "react-native"; import { IOStyles } from "../../../../components/core/variables/IOStyles"; import I18n from "../../../../i18n"; @@ -59,13 +59,13 @@ const InitiativeTimelineComponent = ({ initiativeId, size = 3 }: Props) => { return ( <> {timeline.slice(0, size).map((operation, index) => ( - + detailsBottomSheet.present(operation)} /> {index < size - 1 ? : undefined} - + ))} ); @@ -99,10 +99,10 @@ const TimelineHeaderComponent = (props: { onShowMorePress?: () => void }) => ( const TimelineComponentSkeleton = ({ size = 3 }: Pick) => ( {Array.from({ length: size }).map((_, index) => ( - + {index < size - 1 ? : undefined} - + ))} ); diff --git a/ts/features/idpay/details/components/MissingConfigurationAlert.tsx b/ts/features/idpay/details/components/MissingConfigurationAlert.tsx index 0aa1dc82255..80bcdde57b5 100644 --- a/ts/features/idpay/details/components/MissingConfigurationAlert.tsx +++ b/ts/features/idpay/details/components/MissingConfigurationAlert.tsx @@ -1,6 +1,6 @@ import { Alert, VSpacer } from "@pagopa/io-app-design-system"; import { NavigatorScreenParams } from "@react-navigation/native"; -import React from "react"; +import { createRef } from "react"; import { View } from "react-native"; import { StatusEnum as InitiativeStatusEnum } from "../../../../../definitions/idpay/InitiativeDTO"; import I18n from "../../../../i18n"; @@ -33,7 +33,7 @@ const MissingConfigurationAlert = (props: Props) => { return null; } - const viewRef = React.createRef(); + const viewRef = createRef(); const screen: Record = { NOT_REFUNDABLE_ONLY_IBAN: diff --git a/ts/features/idpay/details/components/TimelineOperationListItem.tsx b/ts/features/idpay/details/components/TimelineOperationListItem.tsx index 8587c095bcd..7fe5474f6d2 100644 --- a/ts/features/idpay/details/components/TimelineOperationListItem.tsx +++ b/ts/features/idpay/details/components/TimelineOperationListItem.tsx @@ -4,7 +4,6 @@ import { ListItemTransactionLogo, WithTestID } from "@pagopa/io-app-design-system"; -import React from "react"; import { IbanOperationDTO, OperationTypeEnum as IbanOperationTypeEnum diff --git a/ts/features/idpay/details/components/__tests__/BeneficiaryDetailsContent.test.tsx b/ts/features/idpay/details/components/__tests__/BeneficiaryDetailsContent.test.tsx index e30bb11cc08..74e4b11b36b 100644 --- a/ts/features/idpay/details/components/__tests__/BeneficiaryDetailsContent.test.tsx +++ b/ts/features/idpay/details/components/__tests__/BeneficiaryDetailsContent.test.tsx @@ -1,5 +1,4 @@ import { render, within } from "@testing-library/react-native"; -import * as React from "react"; import { InitiativeRewardTypeEnum, StatusEnum as InitiativeStatusEnum diff --git a/ts/features/idpay/details/components/__tests__/InitiativeTimelineComponent.test.tsx b/ts/features/idpay/details/components/__tests__/InitiativeTimelineComponent.test.tsx index b3367206ff0..d56d977f97d 100644 --- a/ts/features/idpay/details/components/__tests__/InitiativeTimelineComponent.test.tsx +++ b/ts/features/idpay/details/components/__tests__/InitiativeTimelineComponent.test.tsx @@ -1,5 +1,4 @@ import * as pot from "@pagopa/ts-commons/lib/pot"; -import * as React from "react"; import configureMockStore from "redux-mock-store"; import { applicationChangeState } from "../../../../../store/actions/application"; import { appReducer } from "../../../../../store/reducers"; diff --git a/ts/features/idpay/details/components/__tests__/TimelineOperationListItem.test.tsx b/ts/features/idpay/details/components/__tests__/TimelineOperationListItem.test.tsx index 38550e82fc7..535a408e69a 100644 --- a/ts/features/idpay/details/components/__tests__/TimelineOperationListItem.test.tsx +++ b/ts/features/idpay/details/components/__tests__/TimelineOperationListItem.test.tsx @@ -1,5 +1,4 @@ import { fireEvent, render } from "@testing-library/react-native"; -import * as React from "react"; import { IbanOperationDTO, OperationTypeEnum as IbanOperationTypeEnum diff --git a/ts/features/idpay/details/hooks/useIdPayDiscountDetailsBottomSheet.tsx b/ts/features/idpay/details/hooks/useIdPayDiscountDetailsBottomSheet.tsx index 7693a052655..6f0e1f66e0e 100644 --- a/ts/features/idpay/details/hooks/useIdPayDiscountDetailsBottomSheet.tsx +++ b/ts/features/idpay/details/hooks/useIdPayDiscountDetailsBottomSheet.tsx @@ -1,6 +1,5 @@ import { Divider, ListItemNav, VSpacer } from "@pagopa/io-app-design-system"; import { useNavigation } from "@react-navigation/native"; -import * as React from "react"; import { AppParamsList, IOStackNavigationProp diff --git a/ts/features/idpay/details/hooks/useInitiativeTimelineFetcher.tsx b/ts/features/idpay/details/hooks/useInitiativeTimelineFetcher.tsx index 0efd6f629e3..e561337c98d 100644 --- a/ts/features/idpay/details/hooks/useInitiativeTimelineFetcher.tsx +++ b/ts/features/idpay/details/hooks/useInitiativeTimelineFetcher.tsx @@ -1,5 +1,5 @@ import * as pot from "@pagopa/ts-commons/lib/pot"; -import * as React from "react"; +import { useState, useEffect } from "react"; import { useIODispatch, useIOSelector } from "../../../../store/hooks"; import { idpayOperationListSelector, @@ -28,9 +28,9 @@ export const useInitiativeTimelineFetcher = ( const isUpdating = pot.isUpdating(paginatedTimelinePot); const isError = pot.isError(paginatedTimelinePot); - const [isRefreshing, setIsRefreshing] = React.useState(false); + const [isRefreshing, setIsRefreshing] = useState(false); - React.useEffect(() => { + useEffect(() => { if (currentPage >= 0 && isRefreshing) { setIsRefreshing(false); } diff --git a/ts/features/idpay/details/navigation/index.tsx b/ts/features/idpay/details/navigation/index.tsx index 902856b6724..c2bdfc7ef8a 100644 --- a/ts/features/idpay/details/navigation/index.tsx +++ b/ts/features/idpay/details/navigation/index.tsx @@ -1,5 +1,4 @@ import { createStackNavigator } from "@react-navigation/stack"; -import React from "react"; import { IdPayBeneficiaryDetailsScreen, IdPayBeneficiaryDetailsScreenParams diff --git a/ts/features/idpay/details/screens/IdPayBeneficiaryDetailsScreen.tsx b/ts/features/idpay/details/screens/IdPayBeneficiaryDetailsScreen.tsx index da069bc4520..c66b47abea4 100644 --- a/ts/features/idpay/details/screens/IdPayBeneficiaryDetailsScreen.tsx +++ b/ts/features/idpay/details/screens/IdPayBeneficiaryDetailsScreen.tsx @@ -4,7 +4,6 @@ import { RouteProp, useRoute } from "@react-navigation/native"; import { sequenceS } from "fp-ts/lib/Apply"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; import { ScrollView } from "react-native"; import { useHeaderSecondLevel } from "../../../../hooks/useHeaderSecondLevel"; import { useIODispatch, useIOSelector } from "../../../../store/hooks"; diff --git a/ts/features/idpay/details/screens/IdPayInitiativeDetailsScreen.tsx b/ts/features/idpay/details/screens/IdPayInitiativeDetailsScreen.tsx index 600926af957..b71da5bdf1f 100644 --- a/ts/features/idpay/details/screens/IdPayInitiativeDetailsScreen.tsx +++ b/ts/features/idpay/details/screens/IdPayInitiativeDetailsScreen.tsx @@ -14,7 +14,7 @@ import { RouteProp, useFocusEffect } from "@react-navigation/native"; import { sequenceS } from "fp-ts/lib/Apply"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import * as React from "react"; +import { useCallback } from "react"; import { StyleSheet, View } from "react-native"; import Animated, { Layout } from "react-native-reanimated"; import { @@ -93,7 +93,7 @@ const IdPayInitiativeDetailsScreen = () => { const discountBottomSheet = useIdPayDiscountDetailsBottomSheet(initiativeId); useFocusEffect( - React.useCallback(() => { + useCallback(() => { dispatch(idpayInitiativeGet.request({ initiativeId })); dispatch( idpayTimelinePageGet.request({ initiativeId, page: 0, pageSize: 5 }) diff --git a/ts/features/idpay/details/screens/IdPayOperationsListScreen.tsx b/ts/features/idpay/details/screens/IdPayOperationsListScreen.tsx index f145bd2ff06..21c7be2f8a3 100644 --- a/ts/features/idpay/details/screens/IdPayOperationsListScreen.tsx +++ b/ts/features/idpay/details/screens/IdPayOperationsListScreen.tsx @@ -10,7 +10,7 @@ import { useRoute } from "@react-navigation/core"; import { RouteProp } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; +import { useRef } from "react"; import { ActivityIndicator, FlatList, StyleSheet } from "react-native"; import Placeholder from "rn-placeholder"; import { OperationListDTO } from "../../../../../definitions/idpay/OperationListDTO"; @@ -65,7 +65,7 @@ export const IdPayOperationsListScreen = () => { } = useInitiativeTimelineFetcher(initiativeId, 10, handleOnError); // We need to know if this is the first rendering in order to show the loading spinner overlay - const isFirstRenderDispatchedRef = React.useRef(false); + const isFirstRenderDispatchedRef = useRef(false); useOnFirstRender(() => { fetchPage(0); diff --git a/ts/features/idpay/details/screens/__tests__/IdPayInitiativeDetailsScreen.test.tsx b/ts/features/idpay/details/screens/__tests__/IdPayInitiativeDetailsScreen.test.tsx index 71acf8683c9..881a627b5cf 100644 --- a/ts/features/idpay/details/screens/__tests__/IdPayInitiativeDetailsScreen.test.tsx +++ b/ts/features/idpay/details/screens/__tests__/IdPayInitiativeDetailsScreen.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import * as pot from "@pagopa/ts-commons/lib/pot"; import configureMockStore from "redux-mock-store"; import { IDPayDetailsRoutes } from "../../navigation"; diff --git a/ts/features/idpay/onboarding/components/OnboardingDescriptionMarkdown.tsx b/ts/features/idpay/onboarding/components/OnboardingDescriptionMarkdown.tsx index 52aa30f4632..dcac5329188 100644 --- a/ts/features/idpay/onboarding/components/OnboardingDescriptionMarkdown.tsx +++ b/ts/features/idpay/onboarding/components/OnboardingDescriptionMarkdown.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { useState } from "react"; import { View } from "react-native"; import Placeholder from "rn-placeholder"; import { VSpacer } from "@pagopa/io-app-design-system"; @@ -12,7 +12,7 @@ type Props = { const OnboardingDescriptionMarkdown = (props: Props) => { const { description, onLoadEnd } = props; - const [isLoaded, setLoaded] = React.useState(false); + const [isLoaded, setLoaded] = useState(false); const handleOnLoadEnd = () => { // The markdown component has a different height for some istants after finishing loading diff --git a/ts/features/idpay/onboarding/components/OnboardingPrivacyAdvice.tsx b/ts/features/idpay/onboarding/components/OnboardingPrivacyAdvice.tsx index 87cde38f709..eafbcfb0a2a 100644 --- a/ts/features/idpay/onboarding/components/OnboardingPrivacyAdvice.tsx +++ b/ts/features/idpay/onboarding/components/OnboardingPrivacyAdvice.tsx @@ -1,5 +1,4 @@ import { Body, IOToast, BodySmall } from "@pagopa/io-app-design-system"; -import * as React from "react"; import I18n from "../../../../i18n"; import { openWebUrl } from "../../../../utils/url"; diff --git a/ts/features/idpay/onboarding/components/OnboardingServiceHeader.tsx b/ts/features/idpay/onboarding/components/OnboardingServiceHeader.tsx index 72612fa2069..a73f31ff579 100644 --- a/ts/features/idpay/onboarding/components/OnboardingServiceHeader.tsx +++ b/ts/features/idpay/onboarding/components/OnboardingServiceHeader.tsx @@ -1,7 +1,6 @@ import { Body, H4, VSpacer } from "@pagopa/io-app-design-system"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import * as React from "react"; import { Image, StyleSheet, View } from "react-native"; import Placeholder from "rn-placeholder"; import { InitiativeDataDTO } from "../../../../../definitions/idpay/InitiativeDataDTO"; diff --git a/ts/features/idpay/onboarding/machine/provider.tsx b/ts/features/idpay/onboarding/machine/provider.tsx index eb9123e7a6e..ddb719c737d 100644 --- a/ts/features/idpay/onboarding/machine/provider.tsx +++ b/ts/features/idpay/onboarding/machine/provider.tsx @@ -1,7 +1,8 @@ import { createActorContext } from "@xstate/react"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; + +import { ReactNode } from "react"; import { PreferredLanguageEnum } from "../../../../../definitions/backend/PreferredLanguage"; import { idPayApiBaseUrl, @@ -22,7 +23,7 @@ import { createActorsImplementation } from "./actors"; import { idPayOnboardingMachine } from "./machine"; type Props = { - children: React.ReactNode; + children: ReactNode; }; export const IdPayOnboardingMachineContext = createActorContext( diff --git a/ts/features/idpay/onboarding/navigation/navigator.tsx b/ts/features/idpay/onboarding/navigation/navigator.tsx index 19399cbd96d..903cec753f3 100644 --- a/ts/features/idpay/onboarding/navigation/navigator.tsx +++ b/ts/features/idpay/onboarding/navigation/navigator.tsx @@ -1,5 +1,4 @@ import { createStackNavigator } from "@react-navigation/stack"; -import React from "react"; import { isGestureEnabled } from "../../../../utils/navigation"; import { IdPayOnboardingMachineContext, diff --git a/ts/features/idpay/onboarding/screens/BoolValuePrerequisitesScreen.tsx b/ts/features/idpay/onboarding/screens/BoolValuePrerequisitesScreen.tsx index c2b6872e5a7..a874bce9f91 100644 --- a/ts/features/idpay/onboarding/screens/BoolValuePrerequisitesScreen.tsx +++ b/ts/features/idpay/onboarding/screens/BoolValuePrerequisitesScreen.tsx @@ -4,7 +4,6 @@ import { H2, VSpacer } from "@pagopa/io-app-design-system"; -import React from "react"; import { View } from "react-native"; import { ScrollView } from "react-native-gesture-handler"; import { SelfDeclarationBoolDTO } from "../../../../../definitions/idpay/SelfDeclarationBoolDTO"; diff --git a/ts/features/idpay/onboarding/screens/CompletionScreen.tsx b/ts/features/idpay/onboarding/screens/CompletionScreen.tsx index 04934d1a450..5c8e938cf86 100644 --- a/ts/features/idpay/onboarding/screens/CompletionScreen.tsx +++ b/ts/features/idpay/onboarding/screens/CompletionScreen.tsx @@ -5,7 +5,6 @@ import { Pictogram, VSpacer } from "@pagopa/io-app-design-system"; -import React from "react"; import { SafeAreaView, StyleSheet, View } from "react-native"; import LoadingSpinnerOverlay from "../../../../components/LoadingSpinnerOverlay"; import { IOStyles } from "../../../../components/core/variables/IOStyles"; diff --git a/ts/features/idpay/onboarding/screens/FailureScreen.tsx b/ts/features/idpay/onboarding/screens/FailureScreen.tsx index 64f24417e5d..0914b4b5fa5 100644 --- a/ts/features/idpay/onboarding/screens/FailureScreen.tsx +++ b/ts/features/idpay/onboarding/screens/FailureScreen.tsx @@ -1,6 +1,6 @@ import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; +import { useMemo } from "react"; import { OperationResultScreenContent, OperationResultScreenContentProps @@ -16,7 +16,7 @@ const FailureScreen = () => { const failureOption = useSelector(selectOnboardingFailure); - const defaultCloseAction = React.useMemo( + const defaultCloseAction = useMemo( () => ({ label: I18n.t("global.buttons.close"), accessibilityLabel: I18n.t("global.buttons.close"), @@ -25,7 +25,7 @@ const FailureScreen = () => { [machine] ); - const goToInitiativeAction = React.useMemo( + const goToInitiativeAction = useMemo( () => ({ label: I18n.t("idpay.onboarding.failure.button.goToInitiative"), accessibilityLabel: I18n.t( @@ -36,7 +36,7 @@ const FailureScreen = () => { [machine] ); - const genericErrorProps = React.useMemo( + const genericErrorProps = useMemo( () => ({ pictogram: "umbrellaNew", title: I18n.t("idpay.onboarding.failure.message.GENERIC.title"), diff --git a/ts/features/idpay/onboarding/screens/InitiativeDetailsScreen.tsx b/ts/features/idpay/onboarding/screens/InitiativeDetailsScreen.tsx index 9755eb21792..e71b0e8dc4e 100644 --- a/ts/features/idpay/onboarding/screens/InitiativeDetailsScreen.tsx +++ b/ts/features/idpay/onboarding/screens/InitiativeDetailsScreen.tsx @@ -2,7 +2,7 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import { RouteProp, useRoute } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import * as React from "react"; +import { useEffect, useState } from "react"; import { StyleSheet, View } from "react-native"; import { ForceScrollDownView } from "../../../../components/ForceScrollDownView"; import ItemSeparatorComponent from "../../../../components/ItemSeparatorComponent"; @@ -36,7 +36,7 @@ export const InitiativeDetailsScreen = () => { const { useActorRef, useSelector } = IdPayOnboardingMachineContext; const machine = useActorRef(); - React.useEffect(() => { + useEffect(() => { if (params.serviceId !== undefined) { machine.send({ type: "start-onboarding", @@ -47,7 +47,7 @@ export const InitiativeDetailsScreen = () => { const initiative = useSelector(selectInitiative); const isLoading = useSelector(isLoadingSelector); - const [isDescriptionLoaded, setDescriptionLoaded] = React.useState(false); + const [isDescriptionLoaded, setDescriptionLoaded] = useState(false); const handleGoBackPress = () => machine.send({ type: "close" }); const handleContinuePress = () => machine.send({ type: "next" }); diff --git a/ts/features/idpay/onboarding/screens/MultiValuePrerequisitesScreen.tsx b/ts/features/idpay/onboarding/screens/MultiValuePrerequisitesScreen.tsx index 090cc33e6c6..85630ada413 100644 --- a/ts/features/idpay/onboarding/screens/MultiValuePrerequisitesScreen.tsx +++ b/ts/features/idpay/onboarding/screens/MultiValuePrerequisitesScreen.tsx @@ -10,7 +10,7 @@ import { PressableListItemBase, VSpacer } from "@pagopa/io-app-design-system"; -import { default as React } from "react"; +import { useEffect, useRef, useState } from "react"; import { ScrollView, StyleSheet, View } from "react-native"; import PagerView from "react-native-pager-view"; import { SelfDeclarationMultiDTO } from "../../../../../definitions/idpay/SelfDeclarationMultiDTO"; @@ -29,7 +29,7 @@ type ListItemProps = { }; const MultiValuePrerequisitesScreen = () => { - const pagerRef = React.useRef(null); + const pagerRef = useRef(null); const multiSelfDeclarations = IdPayOnboardingMachineContext.useSelector( multiRequiredCriteriaSelector @@ -38,7 +38,7 @@ const MultiValuePrerequisitesScreen = () => { selectCurrentMultiSelfDeclarationPage ); - React.useEffect(() => { + useEffect(() => { pagerRef.current?.setPage(currentPage); }, [pagerRef, currentPage]); @@ -69,7 +69,7 @@ const MultiValuePrerequisiteItemScreenContent = ({ }: MultiValuePrerequisiteItemScreenContentProps) => { const machine = IdPayOnboardingMachineContext.useActorRef(); - const [selectedIndex, setSelectedIndex] = React.useState( + const [selectedIndex, setSelectedIndex] = useState( undefined ); diff --git a/ts/features/idpay/onboarding/screens/PDNDPrerequisitesScreen.tsx b/ts/features/idpay/onboarding/screens/PDNDPrerequisitesScreen.tsx index 94de1ac7d30..80e98c2237f 100644 --- a/ts/features/idpay/onboarding/screens/PDNDPrerequisitesScreen.tsx +++ b/ts/features/idpay/onboarding/screens/PDNDPrerequisitesScreen.tsx @@ -10,7 +10,7 @@ import { import * as pot from "@pagopa/ts-commons/lib/pot"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; +import { useState, Fragment } from "react"; import { ScrollView, StyleSheet, View } from "react-native"; import { ServiceId } from "../../../../../definitions/backend/ServiceId"; import { IOStyles } from "../../../../components/core/variables/IOStyles"; @@ -35,7 +35,7 @@ export const PDNDPrerequisitesScreen = () => { const { useActorRef, useSelector } = IdPayOnboardingMachineContext; const machine = useActorRef(); - const [authority, setAuthority] = React.useState(); + const [authority, setAuthority] = useState(); const serviceId = useSelector(selectServiceId); const serviceName = pipe( @@ -111,7 +111,7 @@ export const PDNDPrerequisitesScreen = () => { {pdndCriteria.map((criteria, index) => ( - + { }} /> - + ))} diff --git a/ts/features/idpay/payment/machine/provider.tsx b/ts/features/idpay/payment/machine/provider.tsx index 1c9e0b7426a..a001a36d387 100644 --- a/ts/features/idpay/payment/machine/provider.tsx +++ b/ts/features/idpay/payment/machine/provider.tsx @@ -1,5 +1,6 @@ import { createActorContext } from "@xstate/react"; -import React from "react"; + +import { ReactNode } from "react"; import { idPayApiBaseUrl, idPayApiUatBaseUrl, @@ -15,7 +16,7 @@ import { createActorsImplementation } from "./actors"; import { idPayPaymentMachine } from "./machine"; type Props = { - children: React.ReactNode; + children: ReactNode; }; export const IdPayPaymentMachineContext = diff --git a/ts/features/idpay/payment/navigation/navigator.tsx b/ts/features/idpay/payment/navigation/navigator.tsx index 24389edb81f..ce5d2ea56bc 100644 --- a/ts/features/idpay/payment/navigation/navigator.tsx +++ b/ts/features/idpay/payment/navigation/navigator.tsx @@ -1,5 +1,4 @@ import { createStackNavigator } from "@react-navigation/stack"; -import React from "react"; import { IdPayPaymentMachineContext, IdPayPaymentMachineProvider diff --git a/ts/features/idpay/payment/screens/IDPayPaymentAuthorizationScreen.tsx b/ts/features/idpay/payment/screens/IDPayPaymentAuthorizationScreen.tsx index 9d1d9ca8633..99bf7581d98 100644 --- a/ts/features/idpay/payment/screens/IDPayPaymentAuthorizationScreen.tsx +++ b/ts/features/idpay/payment/screens/IDPayPaymentAuthorizationScreen.tsx @@ -12,7 +12,7 @@ import { import { RouteProp, useRoute } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; +import { useEffect } from "react"; import { SafeAreaView, View } from "react-native"; import { AuthPaymentResponseDTO } from "../../../../../definitions/idpay/AuthPaymentResponseDTO"; import { IOStyles } from "../../../../components/core/variables/IOStyles"; @@ -51,7 +51,7 @@ const IDPayPaymentAuthorizationScreen = () => { const machine = useActorRef(); const dispatch = useIODispatch(); - React.useEffect(() => { + useEffect(() => { pipe( params.trxCode, O.fromNullable, diff --git a/ts/features/idpay/payment/screens/IDPayPaymentCodeInputScreen.tsx b/ts/features/idpay/payment/screens/IDPayPaymentCodeInputScreen.tsx index 1f3ba4f5c89..b1a59c5cec8 100644 --- a/ts/features/idpay/payment/screens/IDPayPaymentCodeInputScreen.tsx +++ b/ts/features/idpay/payment/screens/IDPayPaymentCodeInputScreen.tsx @@ -12,7 +12,7 @@ import { NonEmptyString } from "@pagopa/ts-commons/lib/strings"; import * as E from "fp-ts/lib/Either"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; +import { useState } from "react"; import { SafeAreaView, StatusBar, StyleSheet, View } from "react-native"; import BaseScreenComponent from "../../../../components/screens/BaseScreenComponent"; import I18n from "../../../../i18n"; @@ -30,7 +30,7 @@ const IDPayPaymentCodeInputScreen = () => { const { useActorRef, useSelector } = IdPayPaymentMachineContext; const machine = useActorRef(); - const [inputState, setInputState] = React.useState({ + const [inputState, setInputState] = useState({ value: undefined, code: O.none }); diff --git a/ts/features/idpay/payment/screens/IDPayPaymentCodeScanScreen.tsx b/ts/features/idpay/payment/screens/IDPayPaymentCodeScanScreen.tsx index 9b8620e5246..bb3ca367017 100644 --- a/ts/features/idpay/payment/screens/IDPayPaymentCodeScanScreen.tsx +++ b/ts/features/idpay/payment/screens/IDPayPaymentCodeScanScreen.tsx @@ -1,6 +1,5 @@ import { IOToast } from "@pagopa/io-app-design-system"; import { useNavigation } from "@react-navigation/native"; -import React from "react"; import { Alert } from "react-native"; import ReactNativeHapticFeedback, { HapticFeedbackTypes diff --git a/ts/features/idpay/payment/screens/IDPayPaymentResultScreen.tsx b/ts/features/idpay/payment/screens/IDPayPaymentResultScreen.tsx index 283b88e8069..7c108a541f2 100644 --- a/ts/features/idpay/payment/screens/IDPayPaymentResultScreen.tsx +++ b/ts/features/idpay/payment/screens/IDPayPaymentResultScreen.tsx @@ -1,5 +1,5 @@ import * as O from "fp-ts/lib/Option"; -import { default as React } from "react"; +import { useMemo } from "react"; import { OperationResultScreenContent, OperationResultScreenContentProps @@ -16,7 +16,7 @@ const IDPayPaymentResultScreen = () => { const failureOption = useSelector(failureSelector); const isCancelled = useSelector(isCancelledSelector); - const defaultCloseAction = React.useMemo( + const defaultCloseAction = useMemo( () => ({ label: I18n.t("global.buttons.close"), accessibilityLabel: I18n.t("global.buttons.close"), diff --git a/ts/features/idpay/timeline/components/TimelineDetailsBottomSheet.tsx b/ts/features/idpay/timeline/components/TimelineDetailsBottomSheet.tsx index 03245323b6e..e13195bb642 100644 --- a/ts/features/idpay/timeline/components/TimelineDetailsBottomSheet.tsx +++ b/ts/features/idpay/timeline/components/TimelineDetailsBottomSheet.tsx @@ -4,7 +4,7 @@ import * as E from "fp-ts/lib/Either"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; import * as t from "io-ts"; -import React from "react"; +import { useState } from "react"; import { StyleSheet, View } from "react-native"; import { ButtonOutline, @@ -58,7 +58,7 @@ const useTimelineDetailsBottomSheet = ( const isLoading = pot.isLoading(detailsPot); const isError = pot.isError(detailsPot); - const [title, setTitle] = React.useState(); + const [title, setTitle] = useState(); const titleComponent = pipe( title, diff --git a/ts/features/idpay/timeline/components/TimelineDiscountTransactionDetailsComponent.tsx b/ts/features/idpay/timeline/components/TimelineDiscountTransactionDetailsComponent.tsx index 9bea069faea..44d6a000704 100644 --- a/ts/features/idpay/timeline/components/TimelineDiscountTransactionDetailsComponent.tsx +++ b/ts/features/idpay/timeline/components/TimelineDiscountTransactionDetailsComponent.tsx @@ -8,7 +8,6 @@ import { } from "@pagopa/io-app-design-system"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; import { StyleSheet, View } from "react-native"; import { TransactionDetailDTO, diff --git a/ts/features/idpay/timeline/components/TimelineRefundDetailsComponent.tsx b/ts/features/idpay/timeline/components/TimelineRefundDetailsComponent.tsx index d9a7f1bc60a..3f780ac2913 100644 --- a/ts/features/idpay/timeline/components/TimelineRefundDetailsComponent.tsx +++ b/ts/features/idpay/timeline/components/TimelineRefundDetailsComponent.tsx @@ -10,7 +10,6 @@ import { CommonActions } from "@react-navigation/native"; import { format } from "date-fns"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; import { StyleSheet, View } from "react-native"; import { RefundDetailDTO } from "../../../../../definitions/idpay/RefundDetailDTO"; import { OperationTypeEnum } from "../../../../../definitions/idpay/RefundOperationDTO"; diff --git a/ts/features/idpay/timeline/components/TimelineTransactionDetailsComponent.tsx b/ts/features/idpay/timeline/components/TimelineTransactionDetailsComponent.tsx index ef9085d4130..6dc23e6b25a 100644 --- a/ts/features/idpay/timeline/components/TimelineTransactionDetailsComponent.tsx +++ b/ts/features/idpay/timeline/components/TimelineTransactionDetailsComponent.tsx @@ -8,7 +8,6 @@ import { } from "@pagopa/io-app-design-system"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; import { StyleSheet, View } from "react-native"; import { TransactionDetailDTO, diff --git a/ts/features/idpay/unsubscription/components/UnsubscriptionCheckListItem.tsx b/ts/features/idpay/unsubscription/components/UnsubscriptionCheckListItem.tsx index 813bd6f49ed..4e05c090f74 100644 --- a/ts/features/idpay/unsubscription/components/UnsubscriptionCheckListItem.tsx +++ b/ts/features/idpay/unsubscription/components/UnsubscriptionCheckListItem.tsx @@ -1,5 +1,4 @@ import { ListItemCheckbox } from "@pagopa/io-app-design-system"; -import React from "react"; type Props = { title: string; diff --git a/ts/features/idpay/unsubscription/navigation/navigator.tsx b/ts/features/idpay/unsubscription/navigation/navigator.tsx index a78e7060438..14791920af1 100644 --- a/ts/features/idpay/unsubscription/navigation/navigator.tsx +++ b/ts/features/idpay/unsubscription/navigation/navigator.tsx @@ -1,5 +1,4 @@ import { createStackNavigator } from "@react-navigation/stack"; -import React from "react"; import UnsubscriptionConfirmationScreen from "../screens/UnsubscriptionConfirmationScreen"; import UnsubscriptionResultScreen from "../screens/UnsubscriptionResultScreen"; import { IdPayUnsubscriptionParamsList } from "./params"; diff --git a/ts/features/idpay/unsubscription/screens/UnsubscriptionConfirmationScreen.tsx b/ts/features/idpay/unsubscription/screens/UnsubscriptionConfirmationScreen.tsx index 0bc9a47b189..ad4765c31f1 100644 --- a/ts/features/idpay/unsubscription/screens/UnsubscriptionConfirmationScreen.tsx +++ b/ts/features/idpay/unsubscription/screens/UnsubscriptionConfirmationScreen.tsx @@ -7,7 +7,7 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import { RouteProp, useRoute } from "@react-navigation/native"; -import React from "react"; +import { useEffect } from "react"; import { SafeAreaView, View } from "react-native"; import { ScrollView } from "react-native-gesture-handler"; import { InitiativeRewardTypeEnum } from "../../../../../definitions/idpay/InitiativeDTO"; @@ -94,7 +94,7 @@ const UnsubscriptionConfirmationScreen = () => { dispatch(idPayUnsubscribeAction.request({ initiativeId })); }; - React.useEffect(() => { + useEffect(() => { if (isFailure || isSuccess) { navigation.navigate(IdPayUnsubscriptionRoutes.IDPAY_UNSUBSCRIPTION_MAIN, { screen: IdPayUnsubscriptionRoutes.IDPAY_UNSUBSCRIPTION_RESULT diff --git a/ts/features/idpay/unsubscription/screens/UnsubscriptionResultScreen.tsx b/ts/features/idpay/unsubscription/screens/UnsubscriptionResultScreen.tsx index d9768e288a7..d3a35bcfba8 100644 --- a/ts/features/idpay/unsubscription/screens/UnsubscriptionResultScreen.tsx +++ b/ts/features/idpay/unsubscription/screens/UnsubscriptionResultScreen.tsx @@ -7,7 +7,6 @@ import { Pictogram, VSpacer } from "@pagopa/io-app-design-system"; -import React from "react"; import { SafeAreaView, StyleSheet, View } from "react-native"; import I18n from "../../../../i18n"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; diff --git a/ts/features/idpay/wallet/components/IDPayCardPreviewComponent.tsx b/ts/features/idpay/wallet/components/IDPayCardPreviewComponent.tsx index c76a67c0a87..0bd58a4a7af 100644 --- a/ts/features/idpay/wallet/components/IDPayCardPreviewComponent.tsx +++ b/ts/features/idpay/wallet/components/IDPayCardPreviewComponent.tsx @@ -9,7 +9,6 @@ import { import { NonEmptyString } from "@pagopa/ts-commons/lib/strings"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; import { Image, ImageBackground, diff --git a/ts/features/idpay/wallet/components/IDPayCardsInWalletContainer.tsx b/ts/features/idpay/wallet/components/IDPayCardsInWalletContainer.tsx index 4a0cfa6ef89..28d327de066 100644 --- a/ts/features/idpay/wallet/components/IDPayCardsInWalletContainer.tsx +++ b/ts/features/idpay/wallet/components/IDPayCardsInWalletContainer.tsx @@ -1,6 +1,6 @@ import * as pot from "@pagopa/ts-commons/lib/pot"; import { useNavigation } from "@react-navigation/native"; -import React from "react"; +import { memo } from "react"; import { View } from "react-native"; import { InitiativeDTO } from "../../../../../definitions/idpay/InitiativeDTO"; import { @@ -42,7 +42,7 @@ const IDPayCardsList = (props: Props) => { }; // Avoid re-rendering if the list of initiatives is the same -const IDPayCardsListMemo = React.memo(IDPayCardsList); +const IDPayCardsListMemo = memo(IDPayCardsList); const IDPayCardsInWalletContainer = () => { const initiativeList = useIOSelector( diff --git a/ts/features/idpay/wallet/components/IdPayCard.tsx b/ts/features/idpay/wallet/components/IdPayCard.tsx index 1a23c68fc70..c2c3b619773 100644 --- a/ts/features/idpay/wallet/components/IdPayCard.tsx +++ b/ts/features/idpay/wallet/components/IdPayCard.tsx @@ -1,6 +1,5 @@ import { Avatar, Body, H3, H6, VSpacer } from "@pagopa/io-app-design-system"; import { format } from "date-fns"; -import React from "react"; import { ImageURISource, StyleSheet, View } from "react-native"; import WalletCardShape from "../../../../../img/features/idpay/wallet_card.svg"; import I18n from "../../../../i18n"; diff --git a/ts/features/idpay/wallet/components/IdPayInstrumentInitiativesList.tsx b/ts/features/idpay/wallet/components/IdPayInstrumentInitiativesList.tsx index 6acac2a380a..0199c5398cf 100644 --- a/ts/features/idpay/wallet/components/IdPayInstrumentInitiativesList.tsx +++ b/ts/features/idpay/wallet/components/IdPayInstrumentInitiativesList.tsx @@ -2,7 +2,7 @@ import { Badge, Divider, ListItemSwitch } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import * as React from "react"; +import { useCallback, Fragment } from "react"; import { InitiativesStatusDTO, StatusEnum @@ -30,10 +30,10 @@ export const IdPayInstrumentInitiativesList = ({ }: Props) => ( <> {initiatives.map((item, index) => ( - + {index < initiatives.length - 1 && } - + ))} ); @@ -54,7 +54,7 @@ const IdPayInitiativeListItemSwitch = ({ idPayInitiativeFromInstrumentPotSelector(item.initiativeId) ); - const handleSwitchValueChange = React.useCallback( + const handleSwitchValueChange = useCallback( (item: InitiativesStatusDTO) => { const { status, idInstrument, initiativeId } = item; const isItemActiveAndValid = diff --git a/ts/features/idpay/wallet/components/IdPayWalletCard.tsx b/ts/features/idpay/wallet/components/IdPayWalletCard.tsx index 3cf772e7a29..0d8313fbd81 100644 --- a/ts/features/idpay/wallet/components/IdPayWalletCard.tsx +++ b/ts/features/idpay/wallet/components/IdPayWalletCard.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { Pressable } from "react-native"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; import { withWalletCardBaseComponent } from "../../../wallet/components/WalletCardBaseComponent"; diff --git a/ts/features/idpay/wallet/components/__tests__/IdPayCard.test.tsx b/ts/features/idpay/wallet/components/__tests__/IdPayCard.test.tsx index 9d511d920eb..ab4a832b7a8 100644 --- a/ts/features/idpay/wallet/components/__tests__/IdPayCard.test.tsx +++ b/ts/features/idpay/wallet/components/__tests__/IdPayCard.test.tsx @@ -1,5 +1,4 @@ import { render } from "@testing-library/react-native"; -import * as React from "react"; import { IdPayCard } from "../IdPayCard"; describe("IdPayCard", () => { diff --git a/ts/features/idpay/wallet/screens/IdPayInstrumentInitiativesScreen.tsx b/ts/features/idpay/wallet/screens/IdPayInstrumentInitiativesScreen.tsx index 27357752e93..309cd0cf41b 100644 --- a/ts/features/idpay/wallet/screens/IdPayInstrumentInitiativesScreen.tsx +++ b/ts/features/idpay/wallet/screens/IdPayInstrumentInitiativesScreen.tsx @@ -2,7 +2,7 @@ import * as pot from "@pagopa/ts-commons/lib/pot"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; +import { useEffect } from "react"; import { ScrollView, StyleSheet, View } from "react-native"; import { H2, H6, HSpacer, VSpacer } from "@pagopa/io-app-design-system"; import { Route, useRoute } from "@react-navigation/native"; @@ -34,7 +34,7 @@ export const IdPayInstrumentInitiativesScreen = () => { const dispatch = useIODispatch(); const initiatives = useIOSelector(idPayInitiativesFromInstrumentSelector); - React.useEffect(() => { + useEffect(() => { dispatch( idPayInitiativesFromInstrumentRefreshStart({ idWallet diff --git a/ts/features/ingress/screens/IngressScreen.tsx b/ts/features/ingress/screens/IngressScreen.tsx index 63b4d132e49..63faa85a92f 100644 --- a/ts/features/ingress/screens/IngressScreen.tsx +++ b/ts/features/ingress/screens/IngressScreen.tsx @@ -2,7 +2,7 @@ /** * An ingress screen to choose the real first screen the user must navigate to. */ -import React, { memo, useEffect, useRef, useState } from "react"; +import { memo, useEffect, useRef, useState } from "react"; import { fetch as fetchNetInfo, NetInfoState diff --git a/ts/features/itwallet/common/components/ItwCredentialCard.tsx b/ts/features/itwallet/common/components/ItwCredentialCard.tsx index 07abbfe2d7d..708b821125c 100644 --- a/ts/features/itwallet/common/components/ItwCredentialCard.tsx +++ b/ts/features/itwallet/common/components/ItwCredentialCard.tsx @@ -1,5 +1,4 @@ import { HStack, IOColors, IOText, Tag } from "@pagopa/io-app-design-system"; -import React from "react"; import { ImageSourcePropType, StyleSheet, View } from "react-native"; import { AnimatedImage } from "../../../../components/AnimatedImage"; import { diff --git a/ts/features/itwallet/common/components/ItwCredentialClaim.tsx b/ts/features/itwallet/common/components/ItwCredentialClaim.tsx index 90f3fc02461..bef49a41922 100644 --- a/ts/features/itwallet/common/components/ItwCredentialClaim.tsx +++ b/ts/features/itwallet/common/components/ItwCredentialClaim.tsx @@ -2,7 +2,7 @@ import { Divider, ListItemInfo } from "@pagopa/io-app-design-system"; import * as E from "fp-ts/Either"; import * as O from "fp-ts/Option"; import { pipe } from "fp-ts/lib/function"; -import React, { useMemo } from "react"; +import { Fragment, useMemo } from "react"; import { Image } from "react-native"; import I18n from "../../../../i18n"; import { useIOBottomSheetAutoresizableModal } from "../../../../utils/hooks/bottomSheet"; @@ -336,16 +336,14 @@ export const ItwCredentialClaim = ({ return ; } else if (DrivingPrivilegesClaim.is(decoded)) { return decoded.map((elem, index) => ( - + {index !== 0 && } - + )); } else if (FiscalCodeClaim.is(decoded)) { const fiscalCode = pipe( diff --git a/ts/features/itwallet/common/components/ItwCredentialNotFound.tsx b/ts/features/itwallet/common/components/ItwCredentialNotFound.tsx index e91968b3a9b..07bf1ffd7ba 100644 --- a/ts/features/itwallet/common/components/ItwCredentialNotFound.tsx +++ b/ts/features/itwallet/common/components/ItwCredentialNotFound.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; import I18n from "../../../../i18n"; import { ItwCredentialIssuanceMachineContext } from "../../machine/provider"; diff --git a/ts/features/itwallet/common/components/ItwDigitalVersionBadge.tsx b/ts/features/itwallet/common/components/ItwDigitalVersionBadge.tsx index 39b86ab5ce7..fe28902c2c5 100644 --- a/ts/features/itwallet/common/components/ItwDigitalVersionBadge.tsx +++ b/ts/features/itwallet/common/components/ItwDigitalVersionBadge.tsx @@ -5,7 +5,7 @@ import { IOColors, makeFontStyleObject } from "@pagopa/io-app-design-system"; -import React from "react"; +import { memo } from "react"; import { Platform, StyleSheet, Text, View } from "react-native"; import I18n from "../../../../i18n"; @@ -108,6 +108,6 @@ const styles = StyleSheet.create({ } }); -const MemoizedItwDigitalVersionBadge = React.memo(ItwDigitalVersionBadge); +const MemoizedItwDigitalVersionBadge = memo(ItwDigitalVersionBadge); export { MemoizedItwDigitalVersionBadge as ItwDigitalVersionBadge }; diff --git a/ts/features/itwallet/common/components/ItwEidInfoBottomSheetContent.tsx b/ts/features/itwallet/common/components/ItwEidInfoBottomSheetContent.tsx index 16e950f72d4..b90df0c6e04 100644 --- a/ts/features/itwallet/common/components/ItwEidInfoBottomSheetContent.tsx +++ b/ts/features/itwallet/common/components/ItwEidInfoBottomSheetContent.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from "react"; +import { memo, Fragment, useEffect } from "react"; import { View } from "react-native"; import { ButtonSolid, @@ -90,10 +90,10 @@ const ItwEidInfoBottomSheetContent = ({ /> {claims.map((claim, index) => ( - + {index !== 0 && } - + ))} @@ -121,8 +121,6 @@ const ItwEidInfoBottomSheetContent = ({ ); }; -const MemoizedItwEidInfoBottomSheetContent = React.memo( - ItwEidInfoBottomSheetContent -); +const MemoizedItwEidInfoBottomSheetContent = memo(ItwEidInfoBottomSheetContent); export { MemoizedItwEidInfoBottomSheetContent as ItwEidInfoBottomSheetContent }; diff --git a/ts/features/itwallet/common/components/ItwEidLifecycleAlert.tsx b/ts/features/itwallet/common/components/ItwEidLifecycleAlert.tsx index e3e94f49711..5e85efdfe25 100644 --- a/ts/features/itwallet/common/components/ItwEidLifecycleAlert.tsx +++ b/ts/features/itwallet/common/components/ItwEidLifecycleAlert.tsx @@ -3,7 +3,7 @@ import { format } from "date-fns"; import { sequenceT } from "fp-ts/lib/Apply"; import { constNull, pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; -import React, { ComponentProps } from "react"; +import { ComponentProps } from "react"; import { View } from "react-native"; import I18n from "../../../../i18n"; import { useIOSelector } from "../../../../store/hooks"; diff --git a/ts/features/itwallet/common/components/ItwFeedbackBanner.tsx b/ts/features/itwallet/common/components/ItwFeedbackBanner.tsx index c7ce69c160d..a134ecd4de0 100644 --- a/ts/features/itwallet/common/components/ItwFeedbackBanner.tsx +++ b/ts/features/itwallet/common/components/ItwFeedbackBanner.tsx @@ -1,5 +1,5 @@ import { Banner } from "@pagopa/io-app-design-system"; -import React from "react"; +import { memo } from "react"; import { View } from "react-native"; import I18n from "../../../../i18n"; import { useIODispatch, useIOSelector } from "../../../../store/hooks"; @@ -41,6 +41,6 @@ const ItwFeedbackBanner = () => { ); }; -const MemoizedItwFeedbackBanner = React.memo(ItwFeedbackBanner); +const MemoizedItwFeedbackBanner = memo(ItwFeedbackBanner); export { MemoizedItwFeedbackBanner as ItwFeedbackBanner }; diff --git a/ts/features/itwallet/common/components/ItwGenericErrorContent.tsx b/ts/features/itwallet/common/components/ItwGenericErrorContent.tsx index 9e4b0b12bdc..cdc8e4b75fb 100644 --- a/ts/features/itwallet/common/components/ItwGenericErrorContent.tsx +++ b/ts/features/itwallet/common/components/ItwGenericErrorContent.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; import I18n from "../../../../i18n"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; diff --git a/ts/features/itwallet/common/components/ItwIssuanceMetadata.tsx b/ts/features/itwallet/common/components/ItwIssuanceMetadata.tsx index d1653f82242..1b10bec6ef5 100644 --- a/ts/features/itwallet/common/components/ItwIssuanceMetadata.tsx +++ b/ts/features/itwallet/common/components/ItwIssuanceMetadata.tsx @@ -1,5 +1,5 @@ import { Divider, ListItemInfo } from "@pagopa/io-app-design-system"; -import React, { useMemo } from "react"; +import { useMemo } from "react"; import { pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; import I18n from "../../../../i18n"; diff --git a/ts/features/itwallet/common/components/ItwMarkdown.tsx b/ts/features/itwallet/common/components/ItwMarkdown.tsx index 74ac212e99d..70b3bb1616b 100644 --- a/ts/features/itwallet/common/components/ItwMarkdown.tsx +++ b/ts/features/itwallet/common/components/ItwMarkdown.tsx @@ -17,7 +17,8 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import _ from "lodash"; -import React, { ReactNode } from "react"; +import { Fragment, PropsWithChildren, ReactNode } from "react"; + import { StyleSheet } from "react-native"; import Markdown, { ASTNode } from "react-native-markdown-display"; import I18n from "../../../../i18n"; @@ -31,46 +32,46 @@ type ItwMarkdownProps = { const getRules = (onLinkOpen?: ItwMarkdownProps["onLinkOpen"]) => ({ heading1: (node: ASTNode, children: Array) => ( - +

{children}

-
+ ), heading2: (node: ASTNode, children: Array) => ( - +

{children}

-
+ ), heading3: (node: ASTNode, children: Array) => ( - +

{children}

-
+ ), heading4: (node: ASTNode, children: Array) => ( - +

{children}

-
+ ), heading5: (node: ASTNode, children: Array) => ( - +
{children}
-
+ ), heading6: (node: ASTNode, children: Array) => ( - +
{children}
-
+ ), paragraph: (node: ASTNode, children: Array) => ( - + {children} - + ), strong: (node: ASTNode, children: Array) => ( @@ -126,7 +127,7 @@ const styles = StyleSheet.create({ * Main components are mapped into rules object. * @param content - contains the text to be converted in react elements. */ -const ItwMarkdown = (props: React.PropsWithChildren) => ( +const ItwMarkdown = (props: PropsWithChildren) => ( { - const [selectedClaims, setSelectedClaims] = React.useState>( + const [selectedClaims, setSelectedClaims] = useState>( new Array(claims.length).fill(false) ); diff --git a/ts/features/itwallet/common/components/ItwQrCodeClaimImage.tsx b/ts/features/itwallet/common/components/ItwQrCodeClaimImage.tsx index 3e345e92796..9b7319d2bd9 100644 --- a/ts/features/itwallet/common/components/ItwQrCodeClaimImage.tsx +++ b/ts/features/itwallet/common/components/ItwQrCodeClaimImage.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { StyleSheet, View } from "react-native"; import { QrCodeImage } from "../../../../components/QrCodeImage"; import { ClaimDisplayFormat } from "../utils/itwClaimsUtils"; diff --git a/ts/features/itwallet/common/components/ItwSkeumorphicCard/CardBackground.tsx b/ts/features/itwallet/common/components/ItwSkeumorphicCard/CardBackground.tsx index 41cd7d6e694..cbc20b30e3a 100644 --- a/ts/features/itwallet/common/components/ItwSkeumorphicCard/CardBackground.tsx +++ b/ts/features/itwallet/common/components/ItwSkeumorphicCard/CardBackground.tsx @@ -1,5 +1,5 @@ import { IOColors } from "@pagopa/io-app-design-system"; -import React from "react"; +import { memo } from "react"; import { ImageSourcePropType, StyleSheet, View } from "react-native"; import { AnimatedImage } from "../../../../../components/AnimatedImage"; import { StoredCredential } from "../../utils/itwTypesUtils"; @@ -55,6 +55,6 @@ const styles = StyleSheet.create({ } }); -const MemoizedCardBackground = React.memo(CardBackground); +const MemoizedCardBackground = memo(CardBackground); export { MemoizedCardBackground as CardBackground }; diff --git a/ts/features/itwallet/common/components/ItwSkeumorphicCard/CardClaim.tsx b/ts/features/itwallet/common/components/ItwSkeumorphicCard/CardClaim.tsx index 521c5783dd4..70051b04a9f 100644 --- a/ts/features/itwallet/common/components/ItwSkeumorphicCard/CardClaim.tsx +++ b/ts/features/itwallet/common/components/ItwSkeumorphicCard/CardClaim.tsx @@ -2,7 +2,8 @@ import { WithTestID } from "@pagopa/io-app-design-system"; import * as E from "fp-ts/lib/Either"; import * as O from "fp-ts/lib/Option"; import { constNull, pipe } from "fp-ts/lib/function"; -import React from "react"; + +import { ReactElement, ReactNode, memo, useMemo } from "react"; import { Image, StyleSheet, View, ViewStyle } from "react-native"; import { Either, Prettify } from "../../../../../types/helpers"; import { @@ -63,7 +64,7 @@ const CardClaim = ({ dateFormat = "DD/MM/YY", ...labelProps }: WithTestID) => { - const claimContent = React.useMemo( + const claimContent = useMemo( () => pipe( claim?.value, @@ -119,7 +120,7 @@ export type CardClaimRendererProps = { // Function that check that the proviced claim is of the correct type is: (value: unknown) => value is T; // Function that renders a component with the decoded provided claim - component: (decoded: T) => React.ReactElement | Iterable; + component: (decoded: T) => ReactElement | Iterable; }; /** @@ -144,7 +145,7 @@ const CardClaimRenderer = ({ export type CardClaimContainerProps = WithTestID<{ position?: ClaimPosition; dimensions?: ClaimDimensions; - children?: React.ReactNode; + children?: ReactNode; }>; /** @@ -167,9 +168,9 @@ const styles = StyleSheet.create({ } }); -const MemoizedCardClaim = React.memo(CardClaim) as typeof CardClaim; +const MemoizedCardClaim = memo(CardClaim) as typeof CardClaim; -const MemoizedCardClaimRenderer = React.memo( +const MemoizedCardClaimRenderer = memo( CardClaimRenderer ) as typeof CardClaimRenderer; diff --git a/ts/features/itwallet/common/components/ItwSkeumorphicCard/CardData.tsx b/ts/features/itwallet/common/components/ItwSkeumorphicCard/CardData.tsx index 88fce822d10..bca4e610515 100644 --- a/ts/features/itwallet/common/components/ItwSkeumorphicCard/CardData.tsx +++ b/ts/features/itwallet/common/components/ItwSkeumorphicCard/CardData.tsx @@ -2,7 +2,7 @@ /* eslint-disable @typescript-eslint/dot-notation */ import { pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; -import { default as React, Fragment } from "react"; +import { ElementType, Fragment, memo } from "react"; import { StyleSheet, View } from "react-native"; import { QrCodeImage } from "../../../../../components/QrCodeImage"; import { @@ -239,7 +239,7 @@ const DcBackData = ({ claims }: DataComponentProps) => ( const dataComponentMap: Record< string, - Record> + Record> > = { MDL: { front: MdlFrontData, back: MdlBackData }, EuropeanDisabilityCard: { front: DcFrontData, back: DcBackData } @@ -271,6 +271,6 @@ const styles = StyleSheet.create({ } }); -const MemoizeCardData = React.memo(CardData); +const MemoizeCardData = memo(CardData); export { MemoizeCardData as CardData }; diff --git a/ts/features/itwallet/common/components/ItwSkeumorphicCard/ClaimLabel.tsx b/ts/features/itwallet/common/components/ItwSkeumorphicCard/ClaimLabel.tsx index bc1d523e995..b460b935412 100644 --- a/ts/features/itwallet/common/components/ItwSkeumorphicCard/ClaimLabel.tsx +++ b/ts/features/itwallet/common/components/ItwSkeumorphicCard/ClaimLabel.tsx @@ -2,7 +2,8 @@ import { IOFontWeight, makeFontStyleObject } from "@pagopa/io-app-design-system"; -import React from "react"; +import { FunctionComponent, PropsWithChildren } from "react"; + import { Text, TextStyle, useWindowDimensions } from "react-native"; export type ClaimLabelProps = { @@ -14,8 +15,8 @@ export type ClaimLabelProps = { /** * Custom component to display text claim components on skeumorphic credential cards */ -export const ClaimLabel: React.FunctionComponent< - React.PropsWithChildren +export const ClaimLabel: FunctionComponent< + PropsWithChildren > = ({ fontSize = 11, fontWeight = "Semibold", diff --git a/ts/features/itwallet/common/components/ItwSkeumorphicCard/FlipGestureDetector.tsx b/ts/features/itwallet/common/components/ItwSkeumorphicCard/FlipGestureDetector.tsx index 9268967bb8f..b9ad6c166bd 100644 --- a/ts/features/itwallet/common/components/ItwSkeumorphicCard/FlipGestureDetector.tsx +++ b/ts/features/itwallet/common/components/ItwSkeumorphicCard/FlipGestureDetector.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { ReactNode } from "react"; import { Directions, Gesture, @@ -14,7 +14,7 @@ const directions = { type FlipsGestureDetectorProps = { isFlipped: boolean; setIsFlipped: (isFlipped: boolean) => void; - children: React.ReactNode; + children: ReactNode; direction?: keyof typeof directions; }; diff --git a/ts/features/itwallet/common/components/ItwSkeumorphicCard/FlippableCard.tsx b/ts/features/itwallet/common/components/ItwSkeumorphicCard/FlippableCard.tsx index 8425bba0590..7de80d8dddd 100644 --- a/ts/features/itwallet/common/components/ItwSkeumorphicCard/FlippableCard.tsx +++ b/ts/features/itwallet/common/components/ItwSkeumorphicCard/FlippableCard.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { ReactElement, useEffect, memo } from "react"; import { StyleProp, StyleSheet, View, ViewStyle } from "react-native"; import Animated, { interpolate, @@ -10,8 +10,8 @@ import Animated, { const DEFAULT_DURATION = 500; export type FlippableCardProps = { - FrontComponent: React.ReactElement; - BackComponent: React.ReactElement; + FrontComponent: ReactElement; + BackComponent: ReactElement; duration?: number; isFlipped?: boolean; containerStyle?: StyleProp; @@ -29,7 +29,7 @@ const FlippableCard = ({ }: FlippableCardProps) => { const isFlipped = useSharedValue(_isFlipped); - React.useEffect(() => { + useEffect(() => { // eslint-disable-next-line functional/immutable-data isFlipped.value = _isFlipped; }, [isFlipped, _isFlipped]); @@ -85,6 +85,6 @@ const styles = StyleSheet.create({ } }); -const MemoizedFlippableCard = React.memo(FlippableCard); +const MemoizedFlippableCard = memo(FlippableCard); export { MemoizedFlippableCard as FlippableCard }; diff --git a/ts/features/itwallet/common/components/ItwSkeumorphicCard/__tests__/CardClaim.test.tsx b/ts/features/itwallet/common/components/ItwSkeumorphicCard/__tests__/CardClaim.test.tsx index 5a5d13f747d..ee78cbfb516 100644 --- a/ts/features/itwallet/common/components/ItwSkeumorphicCard/__tests__/CardClaim.test.tsx +++ b/ts/features/itwallet/common/components/ItwSkeumorphicCard/__tests__/CardClaim.test.tsx @@ -1,5 +1,4 @@ import { render } from "@testing-library/react-native"; -import React from "react"; import { Text } from "react-native"; import { DrivingPrivilegesClaim, diff --git a/ts/features/itwallet/common/components/ItwSkeumorphicCard/__tests__/CardData.test.tsx b/ts/features/itwallet/common/components/ItwSkeumorphicCard/__tests__/CardData.test.tsx index 7f31a359354..5dca4b930d5 100644 --- a/ts/features/itwallet/common/components/ItwSkeumorphicCard/__tests__/CardData.test.tsx +++ b/ts/features/itwallet/common/components/ItwSkeumorphicCard/__tests__/CardData.test.tsx @@ -1,5 +1,4 @@ import { render } from "@testing-library/react-native"; -import React from "react"; import { ItwStoredCredentialsMocks } from "../../../utils/itwMocksUtils"; import { CardData } from "../CardData"; diff --git a/ts/features/itwallet/common/components/ItwSkeumorphicCard/index.tsx b/ts/features/itwallet/common/components/ItwSkeumorphicCard/index.tsx index 0e8a7a82e41..7935415c726 100644 --- a/ts/features/itwallet/common/components/ItwSkeumorphicCard/index.tsx +++ b/ts/features/itwallet/common/components/ItwSkeumorphicCard/index.tsx @@ -1,5 +1,6 @@ import { Tag, useScaleAnimation } from "@pagopa/io-app-design-system"; -import React, { ReactNode, useMemo } from "react"; +import { memo, ReactNode, useMemo } from "react"; + import { AccessibilityProps, Pressable, @@ -64,7 +65,7 @@ const ItwSkeumorphicCard = ({ [credential, status] ); - const accessibilityProps = React.useMemo( + const accessibilityProps = useMemo( () => ({ accessible: true, @@ -163,6 +164,6 @@ const styles = StyleSheet.create({ } }); -const MemoizedItwSkeumorphicCard = React.memo(ItwSkeumorphicCard); +const MemoizedItwSkeumorphicCard = memo(ItwSkeumorphicCard); export { MemoizedItwSkeumorphicCard as ItwSkeumorphicCard }; diff --git a/ts/features/itwallet/common/components/ItwWalletReadyBanner.tsx b/ts/features/itwallet/common/components/ItwWalletReadyBanner.tsx index 5db54a700f8..3320911de26 100644 --- a/ts/features/itwallet/common/components/ItwWalletReadyBanner.tsx +++ b/ts/features/itwallet/common/components/ItwWalletReadyBanner.tsx @@ -1,5 +1,4 @@ import { Banner } from "@pagopa/io-app-design-system"; -import React from "react"; import I18n from "../../../../i18n"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; import { useIOSelector } from "../../../../store/hooks"; diff --git a/ts/features/itwallet/common/components/__tests__/ItwCredentialCard.test.tsx b/ts/features/itwallet/common/components/__tests__/ItwCredentialCard.test.tsx index 233b5a56030..21832e7c2f1 100644 --- a/ts/features/itwallet/common/components/__tests__/ItwCredentialCard.test.tsx +++ b/ts/features/itwallet/common/components/__tests__/ItwCredentialCard.test.tsx @@ -1,5 +1,4 @@ import { render } from "@testing-library/react-native"; -import * as React from "react"; import { ItwCredentialStatus } from "../../utils/itwTypesUtils"; import { ItwCredentialCard } from "../ItwCredentialCard"; diff --git a/ts/features/itwallet/common/components/__tests__/ItwDigitalVersionBadge.test.tsx b/ts/features/itwallet/common/components/__tests__/ItwDigitalVersionBadge.test.tsx index 63ff7e617c6..c0862aa39b6 100644 --- a/ts/features/itwallet/common/components/__tests__/ItwDigitalVersionBadge.test.tsx +++ b/ts/features/itwallet/common/components/__tests__/ItwDigitalVersionBadge.test.tsx @@ -1,5 +1,4 @@ import { render } from "@testing-library/react-native"; -import React from "react"; import { ItwDigitalVersionBadge } from "../ItwDigitalVersionBadge"; describe("ItwDigitalVersionBadge", () => { diff --git a/ts/features/itwallet/common/components/__tests__/ItwMarkdown.test.tsx b/ts/features/itwallet/common/components/__tests__/ItwMarkdown.test.tsx index 747fffe2e7a..c893d754101 100644 --- a/ts/features/itwallet/common/components/__tests__/ItwMarkdown.test.tsx +++ b/ts/features/itwallet/common/components/__tests__/ItwMarkdown.test.tsx @@ -1,5 +1,4 @@ import { render } from "@testing-library/react-native"; -import * as React from "react"; import ItwMarkdown from "../ItwMarkdown"; const sampleMarkdown = ` diff --git a/ts/features/itwallet/common/components/discoveryBanner/ItwDiscoveryBanner.tsx b/ts/features/itwallet/common/components/discoveryBanner/ItwDiscoveryBanner.tsx index 2d6208e5439..cf676543d15 100644 --- a/ts/features/itwallet/common/components/discoveryBanner/ItwDiscoveryBanner.tsx +++ b/ts/features/itwallet/common/components/discoveryBanner/ItwDiscoveryBanner.tsx @@ -1,6 +1,6 @@ import { Banner, IOVisualCostants } from "@pagopa/io-app-design-system"; import { useRoute } from "@react-navigation/native"; -import React from "react"; +import { createRef, useMemo } from "react"; import { StyleSheet, View } from "react-native"; import I18n from "../../../../../i18n"; import { useIONavigation } from "../../../../../navigation/params/AppParamsList"; @@ -32,13 +32,13 @@ export const ItwDiscoveryBanner = ({ closable, handleOnClose }: ItwDiscoveryBannerProps) => { - const bannerRef = React.createRef(); + const bannerRef = createRef(); const dispatch = useIODispatch(); const navigation = useIONavigation(); const route = useRoute(); - const trackBannerProperties = React.useMemo( + const trackBannerProperties = useMemo( () => ({ banner_id: "itwDiscoveryBannerTestID", banner_page: route.name, diff --git a/ts/features/itwallet/common/components/discoveryBanner/ItwDiscoveryBannerOnboarding.tsx b/ts/features/itwallet/common/components/discoveryBanner/ItwDiscoveryBannerOnboarding.tsx index 38cabb47b5c..1345ddbcb30 100644 --- a/ts/features/itwallet/common/components/discoveryBanner/ItwDiscoveryBannerOnboarding.tsx +++ b/ts/features/itwallet/common/components/discoveryBanner/ItwDiscoveryBannerOnboarding.tsx @@ -1,6 +1,6 @@ import { Banner } from "@pagopa/io-app-design-system"; import { useRoute } from "@react-navigation/native"; -import React from "react"; +import { useMemo, useCallback, memo } from "react"; import { StyleSheet, View } from "react-native"; import I18n from "../../../../../i18n"; import { useIONavigation } from "../../../../../navigation/params/AppParamsList"; @@ -24,7 +24,7 @@ const ItwDiscoveryBannerOnboarding = () => { isItwDiscoveryBannerRenderableSelector ); - const trackBannerProperties = React.useMemo( + const trackBannerProperties = useMemo( () => ({ banner_id: "itwDiscoveryBannerOnboardingTestID", banner_page: route.name, @@ -34,7 +34,7 @@ const ItwDiscoveryBannerOnboarding = () => { ); useOnFirstRender( - React.useCallback(() => { + useCallback(() => { if (isBannerRenderable) { trackITWalletBannerVisualized(trackBannerProperties); } @@ -76,8 +76,6 @@ const styles = StyleSheet.create({ } }); -const MemoizedItwDiscoveryBannerOnboarding = React.memo( - ItwDiscoveryBannerOnboarding -); +const MemoizedItwDiscoveryBannerOnboarding = memo(ItwDiscoveryBannerOnboarding); export { MemoizedItwDiscoveryBannerOnboarding as ItwDiscoveryBannerOnboarding }; diff --git a/ts/features/itwallet/common/components/discoveryBanner/ItwDiscoveryBannerStandalone.tsx b/ts/features/itwallet/common/components/discoveryBanner/ItwDiscoveryBannerStandalone.tsx index 233bcef303d..57c85261126 100644 --- a/ts/features/itwallet/common/components/discoveryBanner/ItwDiscoveryBannerStandalone.tsx +++ b/ts/features/itwallet/common/components/discoveryBanner/ItwDiscoveryBannerStandalone.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { StyleSheet, View } from "react-native"; import { useIOSelector } from "../../../../../store/hooks"; import { isItwDiscoveryBannerRenderableSelector } from "../../store/selectors"; diff --git a/ts/features/itwallet/common/hooks/useItwDisableGestureNavigation.ts b/ts/features/itwallet/common/hooks/useItwDisableGestureNavigation.ts index 69b05585832..7ccf9b2ccec 100644 --- a/ts/features/itwallet/common/hooks/useItwDisableGestureNavigation.ts +++ b/ts/features/itwallet/common/hooks/useItwDisableGestureNavigation.ts @@ -1,4 +1,4 @@ -import React from "react"; +import { useEffect } from "react"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; /** @@ -6,7 +6,7 @@ import { useIONavigation } from "../../../../navigation/params/AppParamsList"; */ export const useItwDisableGestureNavigation = () => { const navigation = useIONavigation(); - React.useEffect(() => { + useEffect(() => { // Disable swipe navigation.setOptions({ gestureEnabled: false }); navigation.getParent()?.setOptions({ gestureEnabled: false }); diff --git a/ts/features/itwallet/common/hooks/useItwInfoBottomSheet.tsx b/ts/features/itwallet/common/hooks/useItwInfoBottomSheet.tsx index f4a5c2a5842..c8348c41275 100644 --- a/ts/features/itwallet/common/hooks/useItwInfoBottomSheet.tsx +++ b/ts/features/itwallet/common/hooks/useItwInfoBottomSheet.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { View } from "react-native"; import { H6, IOStyles, VSpacer } from "@pagopa/io-app-design-system"; import { useIOBottomSheetAutoresizableModal } from "../../../../utils/hooks/bottomSheet"; diff --git a/ts/features/itwallet/common/hooks/useItwPreventNavigationEvent.tsx b/ts/features/itwallet/common/hooks/useItwPreventNavigationEvent.tsx index a17d4194ae7..46c1b71b723 100644 --- a/ts/features/itwallet/common/hooks/useItwPreventNavigationEvent.tsx +++ b/ts/features/itwallet/common/hooks/useItwPreventNavigationEvent.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { useEffect } from "react"; import { useNavigation } from "@react-navigation/native"; import { StackNavigationProp } from "@react-navigation/stack"; import { ItwParamsList } from "../../navigation/ItwParamsList"; @@ -14,7 +14,7 @@ import { ItwParamsList } from "../../navigation/ItwParamsList"; export const useItwPreventNavigationEvent = () => { const navigation = useNavigation>(); - React.useEffect( + useEffect( () => navigation.addListener("beforeRemove", e => { e.preventDefault(); diff --git a/ts/features/itwallet/discovery/components/ItwPrivacyWebViewComponent.tsx b/ts/features/itwallet/discovery/components/ItwPrivacyWebViewComponent.tsx index a82c95194c3..a5c22738035 100644 --- a/ts/features/itwallet/discovery/components/ItwPrivacyWebViewComponent.tsx +++ b/ts/features/itwallet/discovery/components/ItwPrivacyWebViewComponent.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { FooterActions, IOStyles } from "@pagopa/io-app-design-system"; import WebView from "react-native-webview"; import { View } from "react-native"; diff --git a/ts/features/itwallet/discovery/screens/ItwAlreadyActiveScreen.tsx b/ts/features/itwallet/discovery/screens/ItwAlreadyActiveScreen.tsx index 8c0bf1a5c9f..9a674ffa233 100644 --- a/ts/features/itwallet/discovery/screens/ItwAlreadyActiveScreen.tsx +++ b/ts/features/itwallet/discovery/screens/ItwAlreadyActiveScreen.tsx @@ -1,4 +1,4 @@ -import React, { useCallback } from "react"; +import { useCallback } from "react"; import { useFocusEffect } from "@react-navigation/native"; import I18n from "../../../../i18n"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; diff --git a/ts/features/itwallet/discovery/screens/ItwDiscoveryInfoScreen.tsx b/ts/features/itwallet/discovery/screens/ItwDiscoveryInfoScreen.tsx index 7ecc9f369cc..51b5965aad1 100644 --- a/ts/features/itwallet/discovery/screens/ItwDiscoveryInfoScreen.tsx +++ b/ts/features/itwallet/discovery/screens/ItwDiscoveryInfoScreen.tsx @@ -5,7 +5,6 @@ import { H1, VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { StyleSheet } from "react-native"; import { useFocusEffect } from "@react-navigation/native"; import { AnimatedImage } from "../../../../components/AnimatedImage"; diff --git a/ts/features/itwallet/discovery/screens/ItwIpzsPrivacyScreen.tsx b/ts/features/itwallet/discovery/screens/ItwIpzsPrivacyScreen.tsx index 5ec15f91383..7fceebae705 100644 --- a/ts/features/itwallet/discovery/screens/ItwIpzsPrivacyScreen.tsx +++ b/ts/features/itwallet/discovery/screens/ItwIpzsPrivacyScreen.tsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import { useState } from "react"; import { ContentWrapper, H2, VSpacer } from "@pagopa/io-app-design-system"; import { useHeaderSecondLevel } from "../../../../hooks/useHeaderSecondLevel"; import I18n from "../../../../i18n"; diff --git a/ts/features/itwallet/discovery/screens/__tests__/ItwAlreadyActiveScreen.test.tsx b/ts/features/itwallet/discovery/screens/__tests__/ItwAlreadyActiveScreen.test.tsx index b416a653ed9..dffb0b9af03 100644 --- a/ts/features/itwallet/discovery/screens/__tests__/ItwAlreadyActiveScreen.test.tsx +++ b/ts/features/itwallet/discovery/screens/__tests__/ItwAlreadyActiveScreen.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../../store/actions/application"; import { appReducer } from "../../../../../store/reducers"; diff --git a/ts/features/itwallet/discovery/screens/__tests__/ItwDiscoveryInfoScreen.test.tsx b/ts/features/itwallet/discovery/screens/__tests__/ItwDiscoveryInfoScreen.test.tsx index d4be1c9d3fc..0a689fa5f2c 100644 --- a/ts/features/itwallet/discovery/screens/__tests__/ItwDiscoveryInfoScreen.test.tsx +++ b/ts/features/itwallet/discovery/screens/__tests__/ItwDiscoveryInfoScreen.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../../store/actions/application"; import { appReducer } from "../../../../../store/reducers"; diff --git a/ts/features/itwallet/discovery/screens/__tests__/ItwIpzsPrivacyScreen.test.tsx b/ts/features/itwallet/discovery/screens/__tests__/ItwIpzsPrivacyScreen.test.tsx index b4a14986ebb..854d033301d 100644 --- a/ts/features/itwallet/discovery/screens/__tests__/ItwIpzsPrivacyScreen.test.tsx +++ b/ts/features/itwallet/discovery/screens/__tests__/ItwIpzsPrivacyScreen.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../../store/actions/application"; import { appReducer } from "../../../../../store/reducers"; diff --git a/ts/features/itwallet/identification/components/cie/WebViewComponent.tsx b/ts/features/itwallet/identification/components/cie/WebViewComponent.tsx index ac3d80cf2d0..e44b3c7d525 100644 --- a/ts/features/itwallet/identification/components/cie/WebViewComponent.tsx +++ b/ts/features/itwallet/identification/components/cie/WebViewComponent.tsx @@ -1,4 +1,4 @@ -import React, { createRef } from "react"; +import { useState, useRef, createRef } from "react"; import { Platform } from "react-native"; import { WebView } from "react-native-webview"; import type { @@ -91,9 +91,9 @@ const webView = createRef(); * @returns {JSX.Element} - The configured component with WebView. */ export const WebViewComponent = (props: WebViewComponentProps) => { - const [webViewUrl, setWebViewUrl] = React.useState(props.authUrl); - const [isCardReadingFinished, setCardReadingFinished] = React.useState(false); - const cieCompletedEventEmitted = React.useRef(false); + const [webViewUrl, setWebViewUrl] = useState(props.authUrl); + const [isCardReadingFinished, setCardReadingFinished] = useState(false); + const cieCompletedEventEmitted = useRef(false); /* * Once the reading of the card with NFC is finished, it is necessary diff --git a/ts/features/itwallet/identification/screens/ItwIdentificationIdpSelectionScreen.tsx b/ts/features/itwallet/identification/screens/ItwIdentificationIdpSelectionScreen.tsx index 1f464e3807e..a28948e010d 100644 --- a/ts/features/itwallet/identification/screens/ItwIdentificationIdpSelectionScreen.tsx +++ b/ts/features/itwallet/identification/screens/ItwIdentificationIdpSelectionScreen.tsx @@ -1,6 +1,6 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import { useFocusEffect } from "@react-navigation/native"; -import React from "react"; +import { useRef, useCallback } from "react"; import { SpidIdp } from "../../../../../definitions/content/SpidIdp"; import { isReady } from "../../../../common/model/RemoteValue"; import IdpsGrid from "../../../../components/IdpsGrid"; @@ -25,12 +25,12 @@ export const ItwIdentificationIdpSelectionScreen = () => { const idps = useIOSelector(idpsRemoteValueSelector); const idpValue = isReady(idps) ? idps.value.items : idpsFallback; - const randomIdps = React.useRef>( + const randomIdps = useRef>( randomOrderIdps(idpValue) ); useFocusEffect( - React.useCallback(() => { + useCallback(() => { trackItWalletSpidIDPSelection(); dispatch(loadIdps.request()); }, [dispatch]) diff --git a/ts/features/itwallet/identification/screens/ItwIdentificationModeSelectionScreen.tsx b/ts/features/itwallet/identification/screens/ItwIdentificationModeSelectionScreen.tsx index 419030f9b3e..987c8d0f0fa 100644 --- a/ts/features/itwallet/identification/screens/ItwIdentificationModeSelectionScreen.tsx +++ b/ts/features/itwallet/identification/screens/ItwIdentificationModeSelectionScreen.tsx @@ -4,7 +4,7 @@ import { ModuleNavigation, VStack } from "@pagopa/io-app-design-system"; -import React, { useCallback, useMemo } from "react"; +import { useCallback, useMemo } from "react"; import { useFocusEffect } from "@react-navigation/native"; import I18n from "../../../../i18n"; import { useIOSelector } from "../../../../store/hooks"; diff --git a/ts/features/itwallet/identification/screens/__tests__/ItwCieIdLoginScreen.test.tsx b/ts/features/itwallet/identification/screens/__tests__/ItwCieIdLoginScreen.test.tsx index 8ddd3d8d849..914d2c533b8 100644 --- a/ts/features/itwallet/identification/screens/__tests__/ItwCieIdLoginScreen.test.tsx +++ b/ts/features/itwallet/identification/screens/__tests__/ItwCieIdLoginScreen.test.tsx @@ -1,5 +1,4 @@ /* eslint-disable functional/no-let */ -import React from "react"; import { createStore } from "redux"; import { fireEvent, waitFor } from "@testing-library/react-native"; import { createActor } from "xstate"; diff --git a/ts/features/itwallet/identification/screens/__tests__/ItwIdentificationModeSelectionScreen.test.tsx b/ts/features/itwallet/identification/screens/__tests__/ItwIdentificationModeSelectionScreen.test.tsx index 6ed8b90582c..80b6a09d4fc 100644 --- a/ts/features/itwallet/identification/screens/__tests__/ItwIdentificationModeSelectionScreen.test.tsx +++ b/ts/features/itwallet/identification/screens/__tests__/ItwIdentificationModeSelectionScreen.test.tsx @@ -1,7 +1,6 @@ import * as O from "fp-ts/lib/Option"; import _ from "lodash"; import configureMockStore from "redux-mock-store"; -import React from "react"; import * as pot from "@pagopa/ts-commons/lib/pot"; import { appReducer } from "../../../../../store/reducers"; import { applicationChangeState } from "../../../../../store/actions/application"; diff --git a/ts/features/itwallet/identification/screens/cie/ItwActivateNfcScreen.tsx b/ts/features/itwallet/identification/screens/cie/ItwActivateNfcScreen.tsx index ccddf866d08..48c4e99c6b8 100644 --- a/ts/features/itwallet/identification/screens/cie/ItwActivateNfcScreen.tsx +++ b/ts/features/itwallet/identification/screens/cie/ItwActivateNfcScreen.tsx @@ -4,7 +4,7 @@ import { ListItemHeader, ListItemInfo } from "@pagopa/io-app-design-system"; -import React, { useCallback } from "react"; +import { useCallback } from "react"; import { Alert } from "react-native"; import { useFocusEffect } from "@react-navigation/native"; import { IOScrollViewWithLargeHeader } from "../../../../../components/ui/IOScrollViewWithLargeHeader"; diff --git a/ts/features/itwallet/identification/screens/cie/ItwCieCardReaderScreen.tsx b/ts/features/itwallet/identification/screens/cie/ItwCieCardReaderScreen.tsx index d09bb668178..290b40f7011 100644 --- a/ts/features/itwallet/identification/screens/cie/ItwCieCardReaderScreen.tsx +++ b/ts/features/itwallet/identification/screens/cie/ItwCieCardReaderScreen.tsx @@ -10,7 +10,7 @@ import { } from "@pagopa/io-app-design-system"; import { Millisecond } from "@pagopa/ts-commons/lib/units"; import * as O from "fp-ts/lib/Option"; -import React, { memo, useCallback, useRef, useState } from "react"; +import { memo, useCallback, useRef, useState } from "react"; import { AccessibilityInfo, Platform, diff --git a/ts/features/itwallet/identification/screens/cie/ItwCieExpiredOrInvalidScreen.tsx b/ts/features/itwallet/identification/screens/cie/ItwCieExpiredOrInvalidScreen.tsx index e3d09985445..3d5a3f6176c 100644 --- a/ts/features/itwallet/identification/screens/cie/ItwCieExpiredOrInvalidScreen.tsx +++ b/ts/features/itwallet/identification/screens/cie/ItwCieExpiredOrInvalidScreen.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { useCallback } from "react"; import { useFocusEffect } from "@react-navigation/native"; import I18n from "../../../../../i18n"; import { OperationResultScreenContent } from "../../../../../components/screens/OperationResultScreenContent"; @@ -13,7 +13,7 @@ export const ItwCieExpiredOrInvalidScreen = () => { useFocusEffect(trackItWalletCieCardVerifyFailure); - const handleClose = React.useCallback(() => { + const handleClose = useCallback(() => { machineRef.send({ type: "close" }); }, [machineRef]); diff --git a/ts/features/itwallet/identification/screens/cie/ItwCiePinScreen.tsx b/ts/features/itwallet/identification/screens/cie/ItwCiePinScreen.tsx index 65c1a52d759..5316946805e 100644 --- a/ts/features/itwallet/identification/screens/cie/ItwCiePinScreen.tsx +++ b/ts/features/itwallet/identification/screens/cie/ItwCiePinScreen.tsx @@ -9,7 +9,7 @@ import { import { Millisecond } from "@pagopa/ts-commons/lib/units"; import { useHeaderHeight } from "@react-navigation/elements"; import { useFocusEffect, useIsFocused } from "@react-navigation/native"; -import React, { useEffect, useRef, useState } from "react"; +import { useCallback, useEffect, useRef, useState } from "react"; import { Keyboard, KeyboardAvoidingView, @@ -83,7 +83,7 @@ export const ItwCiePinScreen = () => { }, [isFocused]); useFocusEffect( - React.useCallback(() => { + useCallback(() => { trackItWalletCiePinEnter(); setAccessibilityFocus(pinPadViewRef, 300 as Millisecond); }, []) diff --git a/ts/features/itwallet/identification/screens/cie/ItwCieUnexpectedErrorScreen.tsx b/ts/features/itwallet/identification/screens/cie/ItwCieUnexpectedErrorScreen.tsx index 64237919a62..3a279bd7fcf 100644 --- a/ts/features/itwallet/identification/screens/cie/ItwCieUnexpectedErrorScreen.tsx +++ b/ts/features/itwallet/identification/screens/cie/ItwCieUnexpectedErrorScreen.tsx @@ -1,7 +1,7 @@ /** * A screen to alert the user about the number of attempts remains */ -import * as React from "react"; +import { useCallback } from "react"; import I18n from "../../../../../i18n"; import { OperationResultScreenContent } from "../../../../../components/screens/OperationResultScreenContent"; import { ItwEidIssuanceMachineContext } from "../../../machine/provider"; @@ -16,11 +16,11 @@ export const ItwCieUnexpectedErrorScreen = () => { useOnFirstRender(() => trackItWalletCieCardReadingFailure({ reason: "KO" })); - const handleRetry = React.useCallback(() => { + const handleRetry = useCallback(() => { machineRef.send({ type: "back" }); }, [machineRef]); - const handleClose = React.useCallback(() => { + const handleClose = useCallback(() => { machineRef.send({ type: "close" }); }, [machineRef]); diff --git a/ts/features/itwallet/identification/screens/cie/ItwCieWrongCardScreen.tsx b/ts/features/itwallet/identification/screens/cie/ItwCieWrongCardScreen.tsx index a6433ea38a0..18f8c3dd9a1 100644 --- a/ts/features/itwallet/identification/screens/cie/ItwCieWrongCardScreen.tsx +++ b/ts/features/itwallet/identification/screens/cie/ItwCieWrongCardScreen.tsx @@ -1,7 +1,7 @@ /** * A screen to alert the user about the number of attempts remains */ -import * as React from "react"; +import { useCallback } from "react"; import I18n from "../../../../../i18n"; import { OperationResultScreenContent } from "../../../../../components/screens/OperationResultScreenContent"; import { ItwEidIssuanceMachineContext } from "../../../machine/provider"; @@ -12,11 +12,11 @@ export const ItwCieWrongCardScreen = () => { useItwPreventNavigationEvent(); - const handleRetry = React.useCallback(() => { + const handleRetry = useCallback(() => { machineRef.send({ type: "back" }); }, [machineRef]); - const handleClose = React.useCallback(() => { + const handleClose = useCallback(() => { machineRef.send({ type: "close" }); }, [machineRef]); diff --git a/ts/features/itwallet/identification/screens/cie/ItwCieWrongCiePinScreen.tsx b/ts/features/itwallet/identification/screens/cie/ItwCieWrongCiePinScreen.tsx index 1e317ef3208..1ddbf48a9f4 100644 --- a/ts/features/itwallet/identification/screens/cie/ItwCieWrongCiePinScreen.tsx +++ b/ts/features/itwallet/identification/screens/cie/ItwCieWrongCiePinScreen.tsx @@ -1,7 +1,7 @@ /** * A screen to alert the user about the number of attempts remains */ -import * as React from "react"; +import { useCallback, useMemo } from "react"; import { Route, useRoute } from "@react-navigation/native"; import { IOPictograms } from "@pagopa/io-app-design-system"; import { Linking } from "react-native"; @@ -71,30 +71,30 @@ export const ItwCieWrongCiePinScreen = () => { } }; - const handleRetry = React.useCallback(() => { + const handleRetry = useCallback(() => { trackItWalletCieRetryPin(); machineRef.send({ type: "back" }); }, [machineRef]); - const handleClose = React.useCallback(() => { + const handleClose = useCallback(() => { machineRef.send({ type: "close" }); }, [machineRef]); - const didYouForgetPin = React.useCallback(() => { + const didYouForgetPin = useCallback(() => { trackItWalletCiePinForgotten(); Linking.openURL( "https://www.cartaidentita.interno.gov.it/info-utili/codici-di-sicurezza-pin-e-puk/" ).catch(constNull); }, []); - const didYouForgetPuk = React.useCallback(() => { + const didYouForgetPuk = useCallback(() => { trackItWalletCiePukForgotten(); Linking.openURL( "https://www.cartaidentita.interno.gov.it/info-utili/recupero-puk/" ).catch(constNull); }, []); - const createMessageAction = React.useCallback( + const createMessageAction = useCallback( ({ label, onPress @@ -110,7 +110,7 @@ export const ItwCieWrongCiePinScreen = () => { [] ); - const messages: Messages = React.useMemo( + const messages: Messages = useMemo( () => ({ 2: { pictogram: "attention", @@ -166,7 +166,7 @@ export const ItwCieWrongCiePinScreen = () => { // This should never happen, // but it's a good practice to have a default message // in case of unexpected values of `remainingCount`. - const defaultMessageThatShouldNeverHappen: Message = React.useMemo( + const defaultMessageThatShouldNeverHappen: Message = useMemo( () => ({ pictogram: "attention", title: I18n.t("global.genericError"), @@ -183,7 +183,7 @@ export const ItwCieWrongCiePinScreen = () => { [createMessageAction, handleClose, handleRetry, remainingCount] ); - const getMessage = React.useCallback( + const getMessage = useCallback( (key: number) => { handleTrackPinErrors(key); return key in messages diff --git a/ts/features/itwallet/identification/screens/cieId/ItwCieIdLoginScreen.tsx b/ts/features/itwallet/identification/screens/cieId/ItwCieIdLoginScreen.tsx index ada88d05ba7..05e75f038a6 100644 --- a/ts/features/itwallet/identification/screens/cieId/ItwCieIdLoginScreen.tsx +++ b/ts/features/itwallet/identification/screens/cieId/ItwCieIdLoginScreen.tsx @@ -1,4 +1,4 @@ -import React, { memo, useCallback, useMemo, useState } from "react"; +import { memo, useCallback, useMemo, useState } from "react"; import { StyleSheet, View } from "react-native"; import { WebView, WebViewNavigation } from "react-native-webview"; import { isCieIdAvailable } from "@pagopa/io-react-native-cieid"; diff --git a/ts/features/itwallet/identification/screens/spid/ItwSpidIdpLoginScreen.tsx b/ts/features/itwallet/identification/screens/spid/ItwSpidIdpLoginScreen.tsx index 6a4113d2611..09dc357a297 100644 --- a/ts/features/itwallet/identification/screens/spid/ItwSpidIdpLoginScreen.tsx +++ b/ts/features/itwallet/identification/screens/spid/ItwSpidIdpLoginScreen.tsx @@ -1,4 +1,4 @@ -import React, { memo, useCallback, useMemo, useState } from "react"; +import { memo, useCallback, useMemo, useState } from "react"; import { Linking, StyleSheet, View } from "react-native"; import { WebView, WebViewNavigation } from "react-native-webview"; import * as O from "fp-ts/lib/Option"; diff --git a/ts/features/itwallet/issuance/components/ItwCredentialPreviewClaimsList.tsx b/ts/features/itwallet/issuance/components/ItwCredentialPreviewClaimsList.tsx index 9429a0366c3..91e82aae5ba 100644 --- a/ts/features/itwallet/issuance/components/ItwCredentialPreviewClaimsList.tsx +++ b/ts/features/itwallet/issuance/components/ItwCredentialPreviewClaimsList.tsx @@ -1,5 +1,5 @@ import { Divider } from "@pagopa/io-app-design-system"; -import React from "react"; +import { memo } from "react"; import { View } from "react-native"; import { ItwCredentialClaim } from "../../common/components/ItwCredentialClaim"; import { ItwIssuanceMetadata } from "../../common/components/ItwIssuanceMetadata"; @@ -42,7 +42,7 @@ const ItwCredentialPreviewClaimsList = ({ ); }; -const MemoizedItwCredentialPreviewClaimsList = React.memo( +const MemoizedItwCredentialPreviewClaimsList = memo( ItwCredentialPreviewClaimsList ); diff --git a/ts/features/itwallet/issuance/components/ItwRequiredClaimsList.tsx b/ts/features/itwallet/issuance/components/ItwRequiredClaimsList.tsx index 16759adc5f1..689aaecdac5 100644 --- a/ts/features/itwallet/issuance/components/ItwRequiredClaimsList.tsx +++ b/ts/features/itwallet/issuance/components/ItwRequiredClaimsList.tsx @@ -8,7 +8,6 @@ import { import * as E from "fp-ts/Either"; import * as RA from "fp-ts/lib/ReadonlyArray"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; import { StyleSheet, View } from "react-native"; import * as O from "fp-ts/Option"; import I18n from "../../../../i18n"; diff --git a/ts/features/itwallet/issuance/components/__tests__/ItwCredentialPreviewClaimsList.test.tsx b/ts/features/itwallet/issuance/components/__tests__/ItwCredentialPreviewClaimsList.test.tsx index 2167b62eb4a..27a8733c5ff 100644 --- a/ts/features/itwallet/issuance/components/__tests__/ItwCredentialPreviewClaimsList.test.tsx +++ b/ts/features/itwallet/issuance/components/__tests__/ItwCredentialPreviewClaimsList.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../../store/actions/application"; import { appReducer } from "../../../../../store/reducers"; diff --git a/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialAsyncContinuationScreen.tsx b/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialAsyncContinuationScreen.tsx index 9e61f85d9f8..635907cbe37 100644 --- a/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialAsyncContinuationScreen.tsx +++ b/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialAsyncContinuationScreen.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useState } from "react"; +import { useCallback, useState } from "react"; import * as t from "io-ts"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; diff --git a/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialFailureScreen.tsx b/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialFailureScreen.tsx index 695268a2ec1..3725c15e4d4 100644 --- a/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialFailureScreen.tsx +++ b/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialFailureScreen.tsx @@ -2,7 +2,6 @@ import { Errors } from "@pagopa/io-react-native-wallet"; import { sequenceS } from "fp-ts/lib/Apply"; import { constNull, pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; -import React from "react"; import { OperationResultScreenContent, OperationResultScreenContentProps diff --git a/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialPreviewScreen.tsx b/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialPreviewScreen.tsx index 5dfd6106410..d7a1a5844a4 100644 --- a/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialPreviewScreen.tsx +++ b/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialPreviewScreen.tsx @@ -8,7 +8,7 @@ import { useFocusEffect, useRoute } from "@react-navigation/native"; import { sequenceS } from "fp-ts/lib/Apply"; import { pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; -import React, { useMemo } from "react"; +import { useMemo } from "react"; import { StyleSheet, View } from "react-native"; import LoadingScreenContent from "../../../../components/screens/LoadingScreenContent"; import { FooterActions } from "../../../../components/ui/FooterActions"; diff --git a/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialTrustIssuerScreen.tsx b/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialTrustIssuerScreen.tsx index df7211c1835..ed0a2e9671b 100644 --- a/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialTrustIssuerScreen.tsx +++ b/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialTrustIssuerScreen.tsx @@ -12,7 +12,7 @@ import { import { sequenceS } from "fp-ts/lib/Apply"; import { pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; -import React, { useCallback } from "react"; +import { useCallback } from "react"; import { StyleSheet, View } from "react-native"; import { useFocusEffect, useRoute } from "@react-navigation/native"; import { FooterActions } from "../../../../components/ui/FooterActions"; diff --git a/ts/features/itwallet/issuance/screens/ItwIssuanceEidFailureScreen.tsx b/ts/features/itwallet/issuance/screens/ItwIssuanceEidFailureScreen.tsx index b69830b87bb..241af480a8c 100644 --- a/ts/features/itwallet/issuance/screens/ItwIssuanceEidFailureScreen.tsx +++ b/ts/features/itwallet/issuance/screens/ItwIssuanceEidFailureScreen.tsx @@ -1,6 +1,5 @@ import * as O from "fp-ts/lib/Option"; import { constNull, pipe } from "fp-ts/lib/function"; -import React from "react"; import { useIOToast } from "@pagopa/io-app-design-system"; import { OperationResultScreenContent, diff --git a/ts/features/itwallet/issuance/screens/ItwIssuanceEidPreviewScreen.tsx b/ts/features/itwallet/issuance/screens/ItwIssuanceEidPreviewScreen.tsx index 571dc391f13..b06b2d4f758 100644 --- a/ts/features/itwallet/issuance/screens/ItwIssuanceEidPreviewScreen.tsx +++ b/ts/features/itwallet/issuance/screens/ItwIssuanceEidPreviewScreen.tsx @@ -10,7 +10,7 @@ import { } from "@pagopa/io-app-design-system"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React, { useMemo } from "react"; +import { useLayoutEffect, useMemo } from "react"; import { StyleSheet, View } from "react-native"; import { useFocusEffect, useRoute } from "@react-navigation/native"; import { FooterActions } from "../../../../components/ui/FooterActions"; @@ -116,7 +116,7 @@ const ContentView = ({ eid }: ContentViewProps) => { ); }; - React.useLayoutEffect(() => { + useLayoutEffect(() => { navigation.setOptions({ headerShown: true, header: () => ( diff --git a/ts/features/itwallet/issuance/screens/ItwIssuanceEidResultScreen.tsx b/ts/features/itwallet/issuance/screens/ItwIssuanceEidResultScreen.tsx index ef00d9203b0..d949b89fb55 100644 --- a/ts/features/itwallet/issuance/screens/ItwIssuanceEidResultScreen.tsx +++ b/ts/features/itwallet/issuance/screens/ItwIssuanceEidResultScreen.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { useRoute } from "@react-navigation/native"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; import I18n from "../../../../i18n"; diff --git a/ts/features/itwallet/issuance/screens/__tests__/ItwIssuanceCredentialAuthScreen.test.tsx b/ts/features/itwallet/issuance/screens/__tests__/ItwIssuanceCredentialAuthScreen.test.tsx index f8a7a286008..2f64eb4ee21 100644 --- a/ts/features/itwallet/issuance/screens/__tests__/ItwIssuanceCredentialAuthScreen.test.tsx +++ b/ts/features/itwallet/issuance/screens/__tests__/ItwIssuanceCredentialAuthScreen.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../../store/actions/application"; import { appReducer } from "../../../../../store/reducers"; diff --git a/ts/features/itwallet/lifecycle/screens/ItwIdentityNotMatchingScreen.tsx b/ts/features/itwallet/lifecycle/screens/ItwIdentityNotMatchingScreen.tsx index 3be43f26286..963803fe263 100644 --- a/ts/features/itwallet/lifecycle/screens/ItwIdentityNotMatchingScreen.tsx +++ b/ts/features/itwallet/lifecycle/screens/ItwIdentityNotMatchingScreen.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { useFocusEffect } from "@react-navigation/native"; import { Banner, ContentWrapper, VStack } from "@pagopa/io-app-design-system"; import { Alert } from "react-native"; diff --git a/ts/features/itwallet/lifecycle/screens/ItwLifecycleWalletRevocationScreen.tsx b/ts/features/itwallet/lifecycle/screens/ItwLifecycleWalletRevocationScreen.tsx index 854dc0a73db..be446e96351 100644 --- a/ts/features/itwallet/lifecycle/screens/ItwLifecycleWalletRevocationScreen.tsx +++ b/ts/features/itwallet/lifecycle/screens/ItwLifecycleWalletRevocationScreen.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { View } from "react-native"; import { Body, IOStyles } from "@pagopa/io-app-design-system"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; diff --git a/ts/features/itwallet/machine/provider.tsx b/ts/features/itwallet/machine/provider.tsx index a1a9748ac45..9d419fb2a8b 100644 --- a/ts/features/itwallet/machine/provider.tsx +++ b/ts/features/itwallet/machine/provider.tsx @@ -1,6 +1,5 @@ import { useIOToast } from "@pagopa/io-app-design-system"; import { createActorContext } from "@xstate/react"; -import * as React from "react"; import { useIONavigation } from "../../../navigation/params/AppParamsList"; import { useIOStore } from "../../../store/hooks"; import { itwBypassIdentityMatch } from "../../../config"; diff --git a/ts/features/itwallet/navigation/ItwStackNavigator.tsx b/ts/features/itwallet/navigation/ItwStackNavigator.tsx index ebbf4174a5b..d4124fd2933 100644 --- a/ts/features/itwallet/navigation/ItwStackNavigator.tsx +++ b/ts/features/itwallet/navigation/ItwStackNavigator.tsx @@ -2,7 +2,6 @@ import { createStackNavigator, TransitionPresets } from "@react-navigation/stack"; -import * as React from "react"; import { Platform } from "react-native"; import { isGestureEnabled } from "../../../utils/navigation"; import { ItwDiscoveryInfoScreen } from "../discovery/screens/ItwDiscoveryInfoScreen"; diff --git a/ts/features/itwallet/onboarding/components/ItwOnboardingModuleCredential.tsx b/ts/features/itwallet/onboarding/components/ItwOnboardingModuleCredential.tsx index 32e4e715885..35153129ccd 100644 --- a/ts/features/itwallet/onboarding/components/ItwOnboardingModuleCredential.tsx +++ b/ts/features/itwallet/onboarding/components/ItwOnboardingModuleCredential.tsx @@ -1,4 +1,4 @@ -import React, { useMemo, memo } from "react"; +import { useMemo, memo } from "react"; import { Badge, IOIcons, ModuleCredential } from "@pagopa/io-app-design-system"; import I18n from "../../../../i18n"; import { getCredentialNameFromType } from "../../common/utils/itwCredentialUtils"; diff --git a/ts/features/itwallet/onboarding/screens/WalletCardOnboardingScreen.tsx b/ts/features/itwallet/onboarding/screens/WalletCardOnboardingScreen.tsx index 0efb8a6768f..30396768e3a 100644 --- a/ts/features/itwallet/onboarding/screens/WalletCardOnboardingScreen.tsx +++ b/ts/features/itwallet/onboarding/screens/WalletCardOnboardingScreen.tsx @@ -8,7 +8,8 @@ import { import { useFocusEffect } from "@react-navigation/native"; import { constFalse, pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; -import React, { useCallback } from "react"; +import { useCallback, useMemo } from "react"; + import { StyleSheet, View } from "react-native"; import { IOScrollViewWithLargeHeader } from "../../../../components/ui/IOScrollViewWithLargeHeader"; import I18n from "../../../../i18n"; @@ -60,7 +61,7 @@ const WalletCardOnboardingScreen = () => { useFocusEffect(trackShowCredentialsList); - const isItwSectionVisible = React.useMemo( + const isItwSectionVisible = useMemo( // IT Wallet credential catalog should be visible if () => isItwValid && // An eID has ben obtained and wallet is valid @@ -145,7 +146,7 @@ const OtherCardsOnboardingSection = (props: { showTitle?: boolean }) => { const isCgnLoading = useIOSelector(isCgnDetailsLoading); const isCgnActive = useIOSelector(isCgnInformationAvailableSelector); - const startCgnActiviation = React.useCallback(() => { + const startCgnActiviation = useCallback(() => { trackStartAddNewCredential("CGN"); dispatch(loadAvailableBonuses.request()); dispatch(cgnActivationStart()); @@ -158,7 +159,7 @@ const OtherCardsOnboardingSection = (props: { showTitle?: boolean }) => { }); }; - const cgnModule = React.useMemo( + const cgnModule = useMemo( () => isCgnLoading ? ( diff --git a/ts/features/itwallet/onboarding/screens/__tests__/WalletCardOnboardingScreen.test.tsx b/ts/features/itwallet/onboarding/screens/__tests__/WalletCardOnboardingScreen.test.tsx index 22821fcb956..98d1b6608e8 100644 --- a/ts/features/itwallet/onboarding/screens/__tests__/WalletCardOnboardingScreen.test.tsx +++ b/ts/features/itwallet/onboarding/screens/__tests__/WalletCardOnboardingScreen.test.tsx @@ -1,6 +1,5 @@ import * as O from "fp-ts/lib/Option"; import _ from "lodash"; -import * as React from "react"; import configureMockStore from "redux-mock-store"; import { ToolEnum } from "../../../../../../definitions/content/AssistanceToolConfig"; import { Config } from "../../../../../../definitions/content/Config"; diff --git a/ts/features/itwallet/playgrounds/components/ItwLifecycleSection.tsx b/ts/features/itwallet/playgrounds/components/ItwLifecycleSection.tsx index 62000b35678..ae8585fb867 100644 --- a/ts/features/itwallet/playgrounds/components/ItwLifecycleSection.tsx +++ b/ts/features/itwallet/playgrounds/components/ItwLifecycleSection.tsx @@ -1,5 +1,4 @@ /* eslint-disable curly */ -import * as React from "react"; import { ButtonSolid, ListItemHeader, diff --git a/ts/features/itwallet/playgrounds/components/ItwSkeumorphicCredentialSection.tsx b/ts/features/itwallet/playgrounds/components/ItwSkeumorphicCredentialSection.tsx index f2ee2f73efb..1da357f5696 100644 --- a/ts/features/itwallet/playgrounds/components/ItwSkeumorphicCredentialSection.tsx +++ b/ts/features/itwallet/playgrounds/components/ItwSkeumorphicCredentialSection.tsx @@ -1,5 +1,5 @@ import { H3, VStack } from "@pagopa/io-app-design-system"; -import * as React from "react"; +import { useState } from "react"; import { ItwSkeumorphicCard } from "../../common/components/ItwSkeumorphicCard"; import { FlipGestureDetector } from "../../common/components/ItwSkeumorphicCard/FlipGestureDetector"; import { ItwStoredCredentialsMocks } from "../../common/utils/itwMocksUtils"; @@ -37,7 +37,7 @@ const ItwSkeumorphicCredentialItem = ({ credential: StoredCredential; }) => { const navigation = useIONavigation(); - const [isFlipped, setFlipped] = React.useState(false); + const [isFlipped, setFlipped] = useState(false); const { status = "valid" } = getCredentialStatusObject(credential); const handleOnPress = () => { diff --git a/ts/features/itwallet/playgrounds/screens/ItwPlayground.tsx b/ts/features/itwallet/playgrounds/screens/ItwPlayground.tsx index b0067832e9f..b441e558bbf 100644 --- a/ts/features/itwallet/playgrounds/screens/ItwPlayground.tsx +++ b/ts/features/itwallet/playgrounds/screens/ItwPlayground.tsx @@ -7,7 +7,7 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import { useFocusEffect } from "@react-navigation/native"; -import * as React from "react"; +import { useCallback } from "react"; import { ScrollView } from "react-native-gesture-handler"; import { useHeaderSecondLevel } from "../../../../hooks/useHeaderSecondLevel"; import ItwMarkdown from "../../common/components/ItwMarkdown"; @@ -46,7 +46,7 @@ const ItwPlayground = () => { ItwCredentialIssuanceMachineContext.useActorRef(); useFocusEffect( - React.useCallback(() => { + useCallback(() => { // Resets the machine in case they were left in s failure state credentialMachineRef.send({ type: "reset" }); }, [credentialMachineRef]) diff --git a/ts/features/itwallet/presentation/components/ItwPresentationAdditionalInfoSection.tsx b/ts/features/itwallet/presentation/components/ItwPresentationAdditionalInfoSection.tsx index 9b40b6137f8..d5cdeacd57d 100644 --- a/ts/features/itwallet/presentation/components/ItwPresentationAdditionalInfoSection.tsx +++ b/ts/features/itwallet/presentation/components/ItwPresentationAdditionalInfoSection.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { memo } from "react"; import { CredentialType } from "../../common/utils/itwMocksUtils"; import { StoredCredential } from "../../common/utils/itwTypesUtils"; import { ItwPresentationFiscalCode } from "./ItwPresentationFiscalCode"; @@ -20,7 +20,7 @@ const ItwPresentationAdditionalInfoSection = ({ credential }: Props) => { } }; -const MemoizedItwPresentationAdditionalInfoSection = React.memo( +const MemoizedItwPresentationAdditionalInfoSection = memo( ItwPresentationAdditionalInfoSection ); diff --git a/ts/features/itwallet/presentation/components/ItwPresentationClaimsSection.tsx b/ts/features/itwallet/presentation/components/ItwPresentationClaimsSection.tsx index 4846a9814e2..6f44e23d536 100644 --- a/ts/features/itwallet/presentation/components/ItwPresentationClaimsSection.tsx +++ b/ts/features/itwallet/presentation/components/ItwPresentationClaimsSection.tsx @@ -4,15 +4,15 @@ import { IconButton, IOStyles } from "@pagopa/io-app-design-system"; -import { default as React, useMemo } from "react"; +import { Fragment, useMemo, useState } from "react"; import { View } from "react-native"; import I18n from "../../../../i18n"; import { ItwCredentialClaim } from "../../common/components/ItwCredentialClaim"; import { ItwIssuanceMetadata } from "../../common/components/ItwIssuanceMetadata"; import { ItwQrCodeClaimImage } from "../../common/components/ItwQrCodeClaimImage"; import { parseClaims, WellKnownClaim } from "../../common/utils/itwClaimsUtils"; -import { StoredCredential } from "../../common/utils/itwTypesUtils"; import { getCredentialStatus } from "../../common/utils/itwCredentialStatusUtils"; +import { StoredCredential } from "../../common/utils/itwTypesUtils"; type ItwPresentationClaimsSectionProps = { credential: StoredCredential; @@ -21,7 +21,7 @@ type ItwPresentationClaimsSectionProps = { export const ItwPresentationClaimsSection = ({ credential }: ItwPresentationClaimsSectionProps) => { - const [valuesHidden, setValuesHidden] = React.useState(false); + const [valuesHidden, setValuesHidden] = useState(false); const credentialStatus = useMemo( () => getCredentialStatus(credential), @@ -77,7 +77,7 @@ export const ItwPresentationClaimsSection = ({ } return ( - + {index !== 0 && } + ); })} {claims.length > 0 && } diff --git a/ts/features/itwallet/presentation/components/ItwPresentationCredentialCard.tsx b/ts/features/itwallet/presentation/components/ItwPresentationCredentialCard.tsx index cf32f269ebd..c10db5cbe9d 100644 --- a/ts/features/itwallet/presentation/components/ItwPresentationCredentialCard.tsx +++ b/ts/features/itwallet/presentation/components/ItwPresentationCredentialCard.tsx @@ -1,5 +1,6 @@ import { IOSpacingScale, VStack } from "@pagopa/io-app-design-system"; -import React from "react"; + +import { PropsWithChildren, useCallback, useState } from "react"; import { StyleSheet, View } from "react-native"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; import { useIOSelector } from "../../../../store/hooks"; @@ -22,13 +23,13 @@ type Props = { */ const ItwPresentationCredentialCard = ({ credential }: Props) => { const navigation = useIONavigation(); - const [isFlipped, setIsFlipped] = React.useState(false); + const [isFlipped, setIsFlipped] = useState(false); const { status = "valid" } = useIOSelector(state => itwCredentialStatusSelector(state, credential.credentialType) ); - const handleFlipButtonPress = React.useCallback(() => { + const handleFlipButtonPress = useCallback(() => { trackWalletShowBack(CREDENTIALS_MAP[credential.credentialType]); setIsFlipped(_ => !_); }, [credential.credentialType]); @@ -74,7 +75,7 @@ type CardContainerProps = { const CardContainer = ({ children, backgroundColor -}: React.PropsWithChildren) => ( +}: PropsWithChildren) => ( {children} diff --git a/ts/features/itwallet/presentation/components/ItwPresentationCredentialCardFlipButton.tsx b/ts/features/itwallet/presentation/components/ItwPresentationCredentialCardFlipButton.tsx index 76b78f4dbc8..00d1ecfaa27 100644 --- a/ts/features/itwallet/presentation/components/ItwPresentationCredentialCardFlipButton.tsx +++ b/ts/features/itwallet/presentation/components/ItwPresentationCredentialCardFlipButton.tsx @@ -1,5 +1,5 @@ import { ButtonLink } from "@pagopa/io-app-design-system"; -import React from "react"; +import { memo } from "react"; import { StyleSheet, View } from "react-native"; import I18n from "../../../../i18n"; @@ -43,7 +43,7 @@ const styles = StyleSheet.create({ } }); -export const MemoizedItwPresentationCredentialCardFlipButton = React.memo( +export const MemoizedItwPresentationCredentialCardFlipButton = memo( ItwPresentationCredentialCardFlipButton ); diff --git a/ts/features/itwallet/presentation/components/ItwPresentationCredentialInfoAlert.tsx b/ts/features/itwallet/presentation/components/ItwPresentationCredentialInfoAlert.tsx index 0654fb26c31..8d5f6118e5d 100644 --- a/ts/features/itwallet/presentation/components/ItwPresentationCredentialInfoAlert.tsx +++ b/ts/features/itwallet/presentation/components/ItwPresentationCredentialInfoAlert.tsx @@ -1,4 +1,4 @@ -import React, { memo } from "react"; +import { memo } from "react"; import { Alert } from "@pagopa/io-app-design-system"; import I18n from "../../../../i18n"; import { useIOSelector } from "../../../../store/hooks"; diff --git a/ts/features/itwallet/presentation/components/ItwPresentationCredentialStatusAlert.tsx b/ts/features/itwallet/presentation/components/ItwPresentationCredentialStatusAlert.tsx index e3ca317ebbe..2d1a82216a6 100644 --- a/ts/features/itwallet/presentation/components/ItwPresentationCredentialStatusAlert.tsx +++ b/ts/features/itwallet/presentation/components/ItwPresentationCredentialStatusAlert.tsx @@ -1,4 +1,4 @@ -import React, { memo } from "react"; +import { memo } from "react"; import { Alert, Body } from "@pagopa/io-app-design-system"; import I18n from "../../../../i18n"; import { StoredCredential } from "../../common/utils/itwTypesUtils"; diff --git a/ts/features/itwallet/presentation/components/ItwPresentationCredentialVerificationExpired.tsx b/ts/features/itwallet/presentation/components/ItwPresentationCredentialVerificationExpired.tsx index e1d6da8b508..8b780375308 100644 --- a/ts/features/itwallet/presentation/components/ItwPresentationCredentialVerificationExpired.tsx +++ b/ts/features/itwallet/presentation/components/ItwPresentationCredentialVerificationExpired.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; import I18n from "../../../../i18n"; import { getCredentialNameFromType } from "../../common/utils/itwCredentialUtils"; diff --git a/ts/features/itwallet/presentation/components/ItwPresentationDetailsFooter.tsx b/ts/features/itwallet/presentation/components/ItwPresentationDetailsFooter.tsx index eb7190e8d5a..b7b2ef1209e 100644 --- a/ts/features/itwallet/presentation/components/ItwPresentationDetailsFooter.tsx +++ b/ts/features/itwallet/presentation/components/ItwPresentationDetailsFooter.tsx @@ -4,7 +4,7 @@ import { useIOToast, VSpacer } from "@pagopa/io-app-design-system"; -import React from "react"; +import { memo } from "react"; import { Alert } from "react-native"; import { useStartSupportRequest } from "../../../../hooks/useStartSupportRequest"; import I18n from "../../../../i18n"; @@ -112,8 +112,6 @@ const ItwPresentationDetailsFooter = ({ ); }; -const MemoizedItwPresentationDetailsFooter = React.memo( - ItwPresentationDetailsFooter -); +const MemoizedItwPresentationDetailsFooter = memo(ItwPresentationDetailsFooter); export { MemoizedItwPresentationDetailsFooter as ItwPresentationDetailsFooter }; diff --git a/ts/features/itwallet/presentation/components/ItwPresentationDetailsHeader.tsx b/ts/features/itwallet/presentation/components/ItwPresentationDetailsHeader.tsx index 12bb2a41880..2325ab2c3a6 100644 --- a/ts/features/itwallet/presentation/components/ItwPresentationDetailsHeader.tsx +++ b/ts/features/itwallet/presentation/components/ItwPresentationDetailsHeader.tsx @@ -3,7 +3,7 @@ import { makeFontStyleObject, useIOExperimentalDesign } from "@pagopa/io-app-design-system"; -import React from "react"; +import { useMemo, memo } from "react"; import { StyleSheet, Text, View } from "react-native"; import FocusAwareStatusBar from "../../../../components/ui/FocusAwareStatusBar"; import { getCredentialNameFromType } from "../../common/utils/itwCredentialUtils"; @@ -34,7 +34,7 @@ const ItwPresentationDetailsHeader = ({ const { backgroundColor, textColor, statusBarStyle } = getThemeColorByCredentialType(credential.credentialType as CredentialType); - const headerContent = React.useMemo(() => { + const headerContent = useMemo(() => { if (credentialsWithSkeumorphicCard.includes(credential.credentialType)) { return ; } @@ -84,8 +84,6 @@ const styles = StyleSheet.create({ } }); -const MemoizedItwPresentationDetailsHeader = React.memo( - ItwPresentationDetailsHeader -); +const MemoizedItwPresentationDetailsHeader = memo(ItwPresentationDetailsHeader); export { MemoizedItwPresentationDetailsHeader as ItwPresentationDetailsHeader }; diff --git a/ts/features/itwallet/presentation/components/ItwPresentationDetailsScreenBase.tsx b/ts/features/itwallet/presentation/components/ItwPresentationDetailsScreenBase.tsx index 7ca11292c29..34875140f8d 100644 --- a/ts/features/itwallet/presentation/components/ItwPresentationDetailsScreenBase.tsx +++ b/ts/features/itwallet/presentation/components/ItwPresentationDetailsScreenBase.tsx @@ -6,7 +6,8 @@ import { IOVisualCostants, buttonSolidHeight } from "@pagopa/io-app-design-system"; -import React from "react"; + +import { Fragment, ReactNode, useMemo } from "react"; import Animated, { Easing, useAnimatedRef, @@ -24,7 +25,7 @@ export type CredentialCtaProps = Omit; export type ItwPresentationDetailsScreenBaseProps = { credential: StoredCredential; - children?: React.ReactNode; + children?: ReactNode; ctaProps?: CredentialCtaProps; }; @@ -45,7 +46,7 @@ const ItwPresentationDetailsScreenBase = ({ const gradientOpacity = useSharedValue(1); const scrollTranslationY = useSharedValue(0); - const bottomMargin: number = React.useMemo( + const bottomMargin: number = useMemo( () => safeAreaInsets.bottom === 0 ? IOVisualCostants.appMarginDefault @@ -53,12 +54,12 @@ const ItwPresentationDetailsScreenBase = ({ [safeAreaInsets] ); - const safeBottomAreaHeight: number = React.useMemo( + const safeBottomAreaHeight: number = useMemo( () => bottomMargin + buttonSolidHeight + contentEndMargin, [bottomMargin] ); - const gradientAreaHeight: number = React.useMemo( + const gradientAreaHeight: number = useMemo( () => bottomMargin + buttonSolidHeight + gradientSafeArea, [bottomMargin] ); @@ -112,7 +113,7 @@ const ItwPresentationDetailsScreenBase = ({ ); return ( - + {footerComponent} - + ); }; diff --git a/ts/features/itwallet/presentation/components/ItwPresentationFiscalCode.tsx b/ts/features/itwallet/presentation/components/ItwPresentationFiscalCode.tsx index 2568ddd0d6d..f2427ad7577 100644 --- a/ts/features/itwallet/presentation/components/ItwPresentationFiscalCode.tsx +++ b/ts/features/itwallet/presentation/components/ItwPresentationFiscalCode.tsx @@ -5,7 +5,7 @@ import { useIOTheme, useScaleAnimation } from "@pagopa/io-app-design-system"; -import React from "react"; +import { memo } from "react"; import { Dimensions, Pressable, StyleSheet } from "react-native"; import Barcode from "react-native-barcode-builder"; import Animated from "react-native-reanimated"; @@ -98,6 +98,6 @@ const styles = StyleSheet.create({ } }); -const MemoizedItwPresentationFiscalCode = React.memo(ItwPresentationFiscalCode); +const MemoizedItwPresentationFiscalCode = memo(ItwPresentationFiscalCode); export { MemoizedItwPresentationFiscalCode as ItwPresentationFiscalCode }; diff --git a/ts/features/itwallet/presentation/components/__tests__/ItwPresentationClaimsSection.test.tsx b/ts/features/itwallet/presentation/components/__tests__/ItwPresentationClaimsSection.test.tsx index d37c5ec78fd..9dc48a5cb19 100644 --- a/ts/features/itwallet/presentation/components/__tests__/ItwPresentationClaimsSection.test.tsx +++ b/ts/features/itwallet/presentation/components/__tests__/ItwPresentationClaimsSection.test.tsx @@ -1,5 +1,4 @@ import { fireEvent } from "@testing-library/react-native"; -import React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../../store/actions/application"; import { appReducer } from "../../../../../store/reducers"; diff --git a/ts/features/itwallet/presentation/components/__tests__/ItwPresentationDetailFooter.test.tsx b/ts/features/itwallet/presentation/components/__tests__/ItwPresentationDetailFooter.test.tsx index b70e85026b6..7387af0d5c1 100644 --- a/ts/features/itwallet/presentation/components/__tests__/ItwPresentationDetailFooter.test.tsx +++ b/ts/features/itwallet/presentation/components/__tests__/ItwPresentationDetailFooter.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../../store/actions/application"; import { appReducer } from "../../../../../store/reducers"; diff --git a/ts/features/itwallet/presentation/screens/ItwPresentationCredentialAttachmentScreen.tsx b/ts/features/itwallet/presentation/screens/ItwPresentationCredentialAttachmentScreen.tsx index a04300f0260..e22b3155292 100644 --- a/ts/features/itwallet/presentation/screens/ItwPresentationCredentialAttachmentScreen.tsx +++ b/ts/features/itwallet/presentation/screens/ItwPresentationCredentialAttachmentScreen.tsx @@ -1,5 +1,5 @@ import { IOColors, IOStyles, useIOToast } from "@pagopa/io-app-design-system"; -import React from "react"; +import { useState } from "react"; import { Platform, StyleSheet, View } from "react-native"; import Pdf from "react-native-pdf"; import Share from "react-native-share"; @@ -44,7 +44,7 @@ export const ItwPresentationCredentialAttachmentScreen = ({ const toast = useIOToast(); const [footerActionsMeasurements, setfooterActionsMeasurements] = - React.useState({ + useState({ actionBlockHeight: 0, safeBottomAreaHeight: 0 }); diff --git a/ts/features/itwallet/presentation/screens/ItwPresentationCredentialCardModal.tsx b/ts/features/itwallet/presentation/screens/ItwPresentationCredentialCardModal.tsx index a9669ea5ad8..ec6fa29cca8 100644 --- a/ts/features/itwallet/presentation/screens/ItwPresentationCredentialCardModal.tsx +++ b/ts/features/itwallet/presentation/screens/ItwPresentationCredentialCardModal.tsx @@ -4,7 +4,7 @@ import { useIOTheme, VSpacer } from "@pagopa/io-app-design-system"; -import React from "react"; +import { useState, useLayoutEffect, memo } from "react"; import { StyleSheet, View } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import I18n from "../../../../i18n"; @@ -38,12 +38,12 @@ type Props = IOStackNavigationRouteProps< const ItwPresentationCredentialCardModal = ({ route, navigation }: Props) => { const { credential, status } = route.params; const safeAreaInsets = useSafeAreaInsets(); - const [isFlipped, setFlipped] = React.useState(false); + const [isFlipped, setFlipped] = useState(false); const theme = useIOTheme(); useMaxBrightness({ useSmoothTransition: true }); - React.useLayoutEffect(() => { + useLayoutEffect(() => { navigation.setOptions({ header: () => ( { useMaxBrightness({ useSmoothTransition: true }); - React.useLayoutEffect(() => { + useLayoutEffect(() => { navigation.setOptions({ header: () => ( ; diff --git a/ts/features/itwallet/trustmark/screens/ItwCredentialTrustmarkScreen.tsx b/ts/features/itwallet/trustmark/screens/ItwCredentialTrustmarkScreen.tsx index d29cf008aeb..516b88cbdfd 100644 --- a/ts/features/itwallet/trustmark/screens/ItwCredentialTrustmarkScreen.tsx +++ b/ts/features/itwallet/trustmark/screens/ItwCredentialTrustmarkScreen.tsx @@ -8,7 +8,6 @@ import { VStack } from "@pagopa/io-app-design-system"; import { format } from "date-fns"; -import React from "react"; import { StyleSheet, View } from "react-native"; import Placeholder from "rn-placeholder"; import { QrCodeImage } from "../../../../components/QrCodeImage"; diff --git a/ts/features/itwallet/wallet/components/ItwCredentialWalletCard.tsx b/ts/features/itwallet/wallet/components/ItwCredentialWalletCard.tsx index f5f0f82eabf..49bbbdafb57 100644 --- a/ts/features/itwallet/wallet/components/ItwCredentialWalletCard.tsx +++ b/ts/features/itwallet/wallet/components/ItwCredentialWalletCard.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { withWalletCardBaseComponent } from "../../../wallet/components/WalletCardBaseComponent"; import { ItwCredentialCard } from "../../common/components/ItwCredentialCard"; import { WalletCardPressableBase } from "../../../wallet/components/WalletCardPressableBase"; diff --git a/ts/features/landingScreenMultiBanner/components/LandingScreenBannerPicker.tsx b/ts/features/landingScreenMultiBanner/components/LandingScreenBannerPicker.tsx index e0c5be7a579..167e74432ee 100644 --- a/ts/features/landingScreenMultiBanner/components/LandingScreenBannerPicker.tsx +++ b/ts/features/landingScreenMultiBanner/components/LandingScreenBannerPicker.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { useCallback } from "react"; import { useIODispatch, useIOSelector } from "../../../store/hooks"; import { landingScreenBannerToRenderSelector } from "../store/selectors"; import { updateLandingScreenBannerVisibility } from "../store/actions"; @@ -8,7 +8,7 @@ export const LandingScreenBannerPicker = () => { const dispatch = useIODispatch(); const bannerToRender = useIOSelector(landingScreenBannerToRenderSelector); - const closeHandler = React.useCallback(() => { + const closeHandler = useCallback(() => { if (bannerToRender) { dispatch( updateLandingScreenBannerVisibility({ diff --git a/ts/features/landingScreenMultiBanner/components/__mocks__/LandingScreenBannerPicker.tsx b/ts/features/landingScreenMultiBanner/components/__mocks__/LandingScreenBannerPicker.tsx index cd1814b71e0..08f2f96df26 100644 --- a/ts/features/landingScreenMultiBanner/components/__mocks__/LandingScreenBannerPicker.tsx +++ b/ts/features/landingScreenMultiBanner/components/__mocks__/LandingScreenBannerPicker.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { View } from "react-native"; export const LandingScreenBannerPicker = () => ( diff --git a/ts/features/landingScreenMultiBanner/components/__tests__/LandingScreenBannerPicker.test.tsx b/ts/features/landingScreenMultiBanner/components/__tests__/LandingScreenBannerPicker.test.tsx index 852000fdb2c..be6cf467e4f 100644 --- a/ts/features/landingScreenMultiBanner/components/__tests__/LandingScreenBannerPicker.test.tsx +++ b/ts/features/landingScreenMultiBanner/components/__tests__/LandingScreenBannerPicker.test.tsx @@ -1,5 +1,4 @@ import { fireEvent } from "@testing-library/react-native"; -import * as React from "react"; import { Button } from "react-native"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../store/actions/application"; diff --git a/ts/features/landingScreenMultiBanner/utils/landingScreenBannerMap.tsx b/ts/features/landingScreenMultiBanner/utils/landingScreenBannerMap.tsx index 68f6d682821..2beb03129ec 100644 --- a/ts/features/landingScreenMultiBanner/utils/landingScreenBannerMap.tsx +++ b/ts/features/landingScreenMultiBanner/utils/landingScreenBannerMap.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { ReactElement } from "react"; import { SettingsDiscoveryBanner } from "../../../screens/profile/components/SettingsDiscoveryBanner"; import { GlobalState } from "../../../store/reducers/types"; import { ItwDiscoveryBanner } from "../../itwallet/common/components/discoveryBanner/ItwDiscoveryBanner"; @@ -7,9 +7,7 @@ import { hasUserAcknowledgedSettingsBannerSelector } from "../../profileSettings import { PushNotificationsBanner } from "../../pushNotifications/components/PushNotificationsBanner"; import { isPushNotificationsBannerRenderableSelector } from "../../pushNotifications/store/selectors"; -type ComponentWithCloseHandler = ( - closeHandler: () => void -) => React.ReactElement; +type ComponentWithCloseHandler = (closeHandler: () => void) => ReactElement; type ComponentAndLogic = { component: ComponentWithCloseHandler; isRenderableSelector: (state: GlobalState) => boolean; diff --git a/ts/features/lollipop/playgrounds/LollipopPlayground.tsx b/ts/features/lollipop/playgrounds/LollipopPlayground.tsx index 0d0e0fb16ba..bc7f2d19690 100644 --- a/ts/features/lollipop/playgrounds/LollipopPlayground.tsx +++ b/ts/features/lollipop/playgrounds/LollipopPlayground.tsx @@ -3,7 +3,7 @@ import * as E from "fp-ts/lib/Either"; import * as O from "fp-ts/lib/Option"; import * as TE from "fp-ts/lib/TaskEither"; import { pipe } from "fp-ts/lib/function"; -import React, { useCallback } from "react"; +import { useState, useCallback } from "react"; import { SafeAreaView, ScrollView } from "react-native"; import { ProblemJson } from "../../../../definitions/lollipop/ProblemJson"; import { SignMessageResponse } from "../../../../definitions/lollipop/SignMessageResponse"; @@ -32,8 +32,7 @@ const INITIAL_STATE = { }; const LollipopPlayground = () => { - const [state, setState] = - React.useState(INITIAL_STATE); + const [state, setState] = useState(INITIAL_STATE); const keyTag = useIOSelector(lollipopKeyTagSelector); const maybePublicKey = useIOSelector(lollipopPublicKeySelector); diff --git a/ts/features/lollipop/playgrounds/LollipopPlaygroundContent.tsx b/ts/features/lollipop/playgrounds/LollipopPlaygroundContent.tsx index 8c2d580f275..728e1a0e315 100644 --- a/ts/features/lollipop/playgrounds/LollipopPlaygroundContent.tsx +++ b/ts/features/lollipop/playgrounds/LollipopPlaygroundContent.tsx @@ -8,7 +8,7 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import * as O from "fp-ts/lib/Option"; -import React from "react"; +import { useState } from "react"; import { StyleSheet, TextInput, View } from "react-native"; import { WithTestID } from "../../../types/WithTestID"; import { maybeNotNullyString } from "../../../utils/strings"; @@ -48,8 +48,7 @@ type Props = WithTestID<{ }>; const LollipopPlaygroundContent = (props: Props) => { - const [httpRequestBodyText, setHttpRequestBodyText] = - React.useState(""); + const [httpRequestBodyText, setHttpRequestBodyText] = useState(""); const isMessageBodySet = O.isSome(maybeNotNullyString(httpRequestBodyText)); diff --git a/ts/features/lollipop/screens/UnsupportedDeviceScreen.tsx b/ts/features/lollipop/screens/UnsupportedDeviceScreen.tsx index 293fd3313e9..5be348c1ac7 100644 --- a/ts/features/lollipop/screens/UnsupportedDeviceScreen.tsx +++ b/ts/features/lollipop/screens/UnsupportedDeviceScreen.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { Modal } from "react-native"; import I18n from "../../../i18n"; import { unsupportedDeviceLearnMoreUrl } from "../../../config"; diff --git a/ts/features/messages/components/Home/ArchiveRestoreBar.tsx b/ts/features/messages/components/Home/ArchiveRestoreBar.tsx index ad0d034ec66..8ad5bbc8495 100644 --- a/ts/features/messages/components/Home/ArchiveRestoreBar.tsx +++ b/ts/features/messages/components/Home/ArchiveRestoreBar.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect } from "react"; +import { useCallback, useEffect } from "react"; import { StyleSheet, View } from "react-native"; import { ButtonOutline, ButtonSolid } from "@pagopa/io-app-design-system"; import { useSafeAreaInsets } from "react-native-safe-area-context"; diff --git a/ts/features/messages/components/Home/DS/AvatarDouble.tsx b/ts/features/messages/components/Home/DS/AvatarDouble.tsx index eb1275a5228..07808f94cbd 100644 --- a/ts/features/messages/components/Home/DS/AvatarDouble.tsx +++ b/ts/features/messages/components/Home/DS/AvatarDouble.tsx @@ -1,4 +1,4 @@ -import React, { useCallback } from "react"; +import { useRef, useState, useCallback } from "react"; import { Image, ImageRequireSource, @@ -81,13 +81,13 @@ const getImageState = ( */ export const AvatarDouble = ({ backgroundLogoUri }: AvatarDoubleProps) => { const theme = useIOTheme(); - const indexValue = React.useRef(0); + const indexValue = useRef(0); const imageInitialState = useCallback( () => getImageState(backgroundLogoUri), [backgroundLogoUri] ); - const [imageSource, setImageSource] = React.useState(imageInitialState); + const [imageSource, setImageSource] = useState(imageInitialState); const onError = () => { if ( diff --git a/ts/features/messages/components/Home/DS/ListItemMessage.tsx b/ts/features/messages/components/Home/DS/ListItemMessage.tsx index fdc0941645a..2d526327ae9 100644 --- a/ts/features/messages/components/Home/DS/ListItemMessage.tsx +++ b/ts/features/messages/components/Home/DS/ListItemMessage.tsx @@ -13,7 +13,7 @@ import { useListItemAnimation, WithTestID } from "@pagopa/io-app-design-system"; -import React, { ComponentProps } from "react"; +import { ComponentProps } from "react"; import { ImageURISource, Pressable, StyleSheet, View } from "react-native"; import Animated from "react-native-reanimated"; import Svg, { Circle } from "react-native-svg"; diff --git a/ts/features/messages/components/Home/DS/ListItemMessageSkeleton.tsx b/ts/features/messages/components/Home/DS/ListItemMessageSkeleton.tsx index b91e632a14e..0d9c55a6942 100644 --- a/ts/features/messages/components/Home/DS/ListItemMessageSkeleton.tsx +++ b/ts/features/messages/components/Home/DS/ListItemMessageSkeleton.tsx @@ -4,7 +4,6 @@ import { IOVisualCostants, WithTestID } from "@pagopa/io-app-design-system"; -import React from "react"; import { StyleSheet, View } from "react-native"; import Placeholder from "rn-placeholder"; import { ListItemMessageStandardHeight } from "./ListItemMessage"; diff --git a/ts/features/messages/components/Home/EmptyList.tsx b/ts/features/messages/components/Home/EmptyList.tsx index 9dfb2950b30..54a02cf71a7 100644 --- a/ts/features/messages/components/Home/EmptyList.tsx +++ b/ts/features/messages/components/Home/EmptyList.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useMemo } from "react"; +import { useCallback, useMemo } from "react"; import { constUndefined, pipe } from "fp-ts/lib/function"; import * as B from "fp-ts/lib/boolean"; import { ButtonSolidProps, IOPictograms } from "@pagopa/io-app-design-system"; diff --git a/ts/features/messages/components/Home/Footer.tsx b/ts/features/messages/components/Home/Footer.tsx index 4bae8e24178..abd007855e4 100644 --- a/ts/features/messages/components/Home/Footer.tsx +++ b/ts/features/messages/components/Home/Footer.tsx @@ -1,4 +1,3 @@ -import React from "react"; import I18n from "../../../../i18n"; import { useIOSelector } from "../../../../store/hooks"; import { shouldShowFooterListComponentSelector } from "../../store/reducers/allPaginated"; diff --git a/ts/features/messages/components/Home/MessageList.tsx b/ts/features/messages/components/Home/MessageList.tsx index 7f7f012a8ab..54babb13c18 100644 --- a/ts/features/messages/components/Home/MessageList.tsx +++ b/ts/features/messages/components/Home/MessageList.tsx @@ -1,5 +1,5 @@ import { Divider, IOColors } from "@pagopa/io-app-design-system"; -import React, { useCallback, useMemo } from "react"; +import { forwardRef, useCallback, useMemo } from "react"; import { FlatList, RefreshControl, StyleSheet } from "react-native"; import { useSafeAreaFrame, @@ -47,7 +47,7 @@ type MessageListProps = { const topBarHeight = 108; const bottomTabHeight = 54; -export const MessageList = React.forwardRef( +export const MessageList = forwardRef( ({ category }: MessageListProps, ref) => { const store = useIOStore(); const dispatch = useIODispatch(); diff --git a/ts/features/messages/components/Home/PagerViewContainer.tsx b/ts/features/messages/components/Home/PagerViewContainer.tsx index 4a6d3b7db06..fa66a98b731 100644 --- a/ts/features/messages/components/Home/PagerViewContainer.tsx +++ b/ts/features/messages/components/Home/PagerViewContainer.tsx @@ -1,5 +1,5 @@ import { pipe } from "fp-ts/lib/function"; -import React, { useCallback, useRef } from "react"; +import { forwardRef, useCallback, useRef } from "react"; import { FlatList, NativeSyntheticEvent } from "react-native"; import { useFocusEffect } from "@react-navigation/native"; import PagerView from "react-native-pager-view"; @@ -27,7 +27,7 @@ import { } from "./homeUtils"; import { ArchiveRestoreBar } from "./ArchiveRestoreBar"; -export const PagerViewContainer = React.forwardRef((_, ref) => { +export const PagerViewContainer = forwardRef((_, ref) => { const dispatch = useIODispatch(); const store = useIOStore(); const archiveFlatListRef = useRef(null); diff --git a/ts/features/messages/components/Home/Preconditions.tsx b/ts/features/messages/components/Home/Preconditions.tsx index 757d47e36c6..6db9ce387c5 100644 --- a/ts/features/messages/components/Home/Preconditions.tsx +++ b/ts/features/messages/components/Home/Preconditions.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect } from "react"; +import { useCallback, useEffect } from "react"; import { Keyboard } from "react-native"; import { useIOBottomSheetModal } from "../../../../utils/hooks/bottomSheet"; import { diff --git a/ts/features/messages/components/Home/PreconditionsContent.tsx b/ts/features/messages/components/Home/PreconditionsContent.tsx index 1e78e78e52c..770ff7d599b 100644 --- a/ts/features/messages/components/Home/PreconditionsContent.tsx +++ b/ts/features/messages/components/Home/PreconditionsContent.tsx @@ -1,4 +1,4 @@ -import React, { useCallback } from "react"; +import { useCallback } from "react"; import { View } from "react-native"; import Placeholder from "rn-placeholder"; import { VSpacer } from "@pagopa/io-app-design-system"; diff --git a/ts/features/messages/components/Home/PreconditionsFeedback.tsx b/ts/features/messages/components/Home/PreconditionsFeedback.tsx index 7b7bdafdad9..682787184dd 100644 --- a/ts/features/messages/components/Home/PreconditionsFeedback.tsx +++ b/ts/features/messages/components/Home/PreconditionsFeedback.tsx @@ -6,7 +6,6 @@ import { useIOTheme, VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { StyleSheet, View } from "react-native"; const styles = StyleSheet.create({ diff --git a/ts/features/messages/components/Home/PreconditionsFooter.tsx b/ts/features/messages/components/Home/PreconditionsFooter.tsx index 193a7ba8d87..e7873aba1e8 100644 --- a/ts/features/messages/components/Home/PreconditionsFooter.tsx +++ b/ts/features/messages/components/Home/PreconditionsFooter.tsx @@ -1,4 +1,4 @@ -import React, { useCallback } from "react"; +import { useCallback } from "react"; import { View } from "react-native"; import { useIOSelector, useIOStore } from "../../../../store/hooks"; import { diff --git a/ts/features/messages/components/Home/PreconditionsTitle.tsx b/ts/features/messages/components/Home/PreconditionsTitle.tsx index 5976a1a6bc1..f5f8c53c747 100644 --- a/ts/features/messages/components/Home/PreconditionsTitle.tsx +++ b/ts/features/messages/components/Home/PreconditionsTitle.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { View } from "react-native"; import Placeholder from "rn-placeholder"; import { H3, IOStyles } from "@pagopa/io-app-design-system"; diff --git a/ts/features/messages/components/Home/TabNavigationContainer.tsx b/ts/features/messages/components/Home/TabNavigationContainer.tsx index c1d8fbb9b86..755b85b5d4d 100644 --- a/ts/features/messages/components/Home/TabNavigationContainer.tsx +++ b/ts/features/messages/components/Home/TabNavigationContainer.tsx @@ -1,4 +1,5 @@ -import React, { useCallback } from "react"; +import { MutableRefObject, useCallback } from "react"; + import { StyleSheet, View } from "react-native"; import PagerView from "react-native-pager-view"; import { TabItem, TabNavigation } from "@pagopa/io-app-design-system"; @@ -16,7 +17,7 @@ const styles = StyleSheet.create({ export const TabNavigationContainer = ({ pagerViewRef }: { - pagerViewRef: React.MutableRefObject; + pagerViewRef: MutableRefObject; }) => { const shownMessageCategory = useIOSelector(shownMessageCategorySelector); const shownPageIndex = diff --git a/ts/features/messages/components/Home/WrappedListItemMessage.tsx b/ts/features/messages/components/Home/WrappedListItemMessage.tsx index 46cfe2378ca..111b0fe7492 100644 --- a/ts/features/messages/components/Home/WrappedListItemMessage.tsx +++ b/ts/features/messages/components/Home/WrappedListItemMessage.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useMemo, useRef } from "react"; +import { useCallback, useMemo, useRef } from "react"; import { useIODispatch, useIOSelector, diff --git a/ts/features/messages/components/Home/__mocks__/PagerViewContainer.tsx b/ts/features/messages/components/Home/__mocks__/PagerViewContainer.tsx index a6ef59f57ad..408a8cf2b55 100644 --- a/ts/features/messages/components/Home/__mocks__/PagerViewContainer.tsx +++ b/ts/features/messages/components/Home/__mocks__/PagerViewContainer.tsx @@ -1,8 +1,8 @@ -import React from "react"; +import { forwardRef } from "react"; import { View } from "react-native"; import PagerView from "react-native-pager-view"; -export const PagerViewContainer = React.forwardRef((_, ref) => ( +export const PagerViewContainer = forwardRef((_, ref) => ( Mock Inbox Mock Archive diff --git a/ts/features/messages/components/Home/__mocks__/Preconditions.tsx b/ts/features/messages/components/Home/__mocks__/Preconditions.tsx index 96c4c5fe81c..fb76380b17e 100644 --- a/ts/features/messages/components/Home/__mocks__/Preconditions.tsx +++ b/ts/features/messages/components/Home/__mocks__/Preconditions.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { View } from "react-native"; export const Preconditions = () => ( diff --git a/ts/features/messages/components/Home/__mocks__/PreconditionsContent.tsx b/ts/features/messages/components/Home/__mocks__/PreconditionsContent.tsx index 0d2542b2cbe..a81ef33ce25 100644 --- a/ts/features/messages/components/Home/__mocks__/PreconditionsContent.tsx +++ b/ts/features/messages/components/Home/__mocks__/PreconditionsContent.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { View } from "react-native"; export const PreconditionsContent = () => ( diff --git a/ts/features/messages/components/Home/__mocks__/SecuritySuggestions.tsx b/ts/features/messages/components/Home/__mocks__/SecuritySuggestions.tsx index 26e15e91a19..5834a3aca89 100644 --- a/ts/features/messages/components/Home/__mocks__/SecuritySuggestions.tsx +++ b/ts/features/messages/components/Home/__mocks__/SecuritySuggestions.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { View } from "react-native"; export const SecuritySuggestions = () => ( diff --git a/ts/features/messages/components/Home/__mocks__/TabNavigationContainer.tsx b/ts/features/messages/components/Home/__mocks__/TabNavigationContainer.tsx index 473d406d6ae..fd780890bda 100644 --- a/ts/features/messages/components/Home/__mocks__/TabNavigationContainer.tsx +++ b/ts/features/messages/components/Home/__mocks__/TabNavigationContainer.tsx @@ -1,8 +1,8 @@ -import React from "react"; +import { forwardRef } from "react"; import { View } from "react-native"; import PagerView from "react-native-pager-view"; -export const TabNavigationContainer = React.forwardRef((_, _ref) => ( +export const TabNavigationContainer = forwardRef((_, _ref) => ( This is a mock for TabNavigationContainer diff --git a/ts/features/messages/components/Home/__mocks__/Toasts.tsx b/ts/features/messages/components/Home/__mocks__/Toasts.tsx index 93dea9693b0..2d2fc096870 100644 --- a/ts/features/messages/components/Home/__mocks__/Toasts.tsx +++ b/ts/features/messages/components/Home/__mocks__/Toasts.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { View } from "react-native"; export const Toasts = () => ( diff --git a/ts/features/messages/components/Home/__tests__/EmptyList.test.tsx b/ts/features/messages/components/Home/__tests__/EmptyList.test.tsx index fdd99ed8a5f..742cef761c7 100644 --- a/ts/features/messages/components/Home/__tests__/EmptyList.test.tsx +++ b/ts/features/messages/components/Home/__tests__/EmptyList.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import * as pot from "@pagopa/ts-commons/lib/pot"; import { createStore } from "redux"; import { fireEvent } from "@testing-library/react-native"; diff --git a/ts/features/messages/components/Home/__tests__/Footer.test.tsx b/ts/features/messages/components/Home/__tests__/Footer.test.tsx index 501192d89d5..4c8d0d2b159 100644 --- a/ts/features/messages/components/Home/__tests__/Footer.test.tsx +++ b/ts/features/messages/components/Home/__tests__/Footer.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../../store/actions/application"; import { preferencesDesignSystemSetEnabled } from "../../../../../store/actions/persistedPreferences"; diff --git a/ts/features/messages/components/Home/__tests__/MessageList.test.tsx b/ts/features/messages/components/Home/__tests__/MessageList.test.tsx index 20c8129dc28..6ab141a36b0 100644 --- a/ts/features/messages/components/Home/__tests__/MessageList.test.tsx +++ b/ts/features/messages/components/Home/__tests__/MessageList.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { RefreshControlProps } from "react-native"; import { createStore } from "redux"; import { fireEvent } from "@testing-library/react-native"; diff --git a/ts/features/messages/components/Home/__tests__/PagerViewContainer.test.tsx b/ts/features/messages/components/Home/__tests__/PagerViewContainer.test.tsx index 57a57407157..9585312d0dc 100644 --- a/ts/features/messages/components/Home/__tests__/PagerViewContainer.test.tsx +++ b/ts/features/messages/components/Home/__tests__/PagerViewContainer.test.tsx @@ -1,24 +1,24 @@ -import React from "react"; import * as pot from "@pagopa/ts-commons/lib/pot"; -import PagerView from "react-native-pager-view"; -import { createStore } from "redux"; +import { MutableRefObject, RefObject } from "react"; import { NativeSyntheticEvent } from "react-native"; +import PagerView from "react-native-pager-view"; import { OnPageSelectedEventData } from "react-native-pager-view/lib/typescript/specs/PagerViewNativeComponent"; +import { createStore } from "redux"; +import { pageSize } from "../../../../../config"; import { applicationChangeState } from "../../../../../store/actions/application"; import { preferencesDesignSystemSetEnabled } from "../../../../../store/actions/persistedPreferences"; import { appReducer } from "../../../../../store/reducers"; -import { MessageListCategory } from "../../../types/messageListCategory"; +import { GlobalState } from "../../../../../store/reducers/types"; +import { mockAccessibilityInfo } from "../../../../../utils/testAccessibility"; import { renderScreenWithNavigationStoreContext } from "../../../../../utils/testWrapper"; -import { PagerViewContainer } from "../PagerViewContainer"; import { MESSAGES_ROUTES } from "../../../navigation/routes"; -import { GlobalState } from "../../../../../store/reducers/types"; -import { MessagePagePot } from "../../../store/reducers/allPaginated"; import { reloadAllMessages, setShownMessageCategoryAction } from "../../../store/actions"; -import { pageSize } from "../../../../../config"; -import { mockAccessibilityInfo } from "../../../../../utils/testAccessibility"; +import { MessagePagePot } from "../../../store/reducers/allPaginated"; +import { MessageListCategory } from "../../../types/messageListCategory"; +import { PagerViewContainer } from "../PagerViewContainer"; const mockDispatch = jest.fn(); jest.mock("react-redux", () => ({ @@ -41,7 +41,7 @@ describe("PagerViewContainer", () => { expect(mockDispatch.mock.calls.length).toBe(0); }); it("should not dispatch 'reloadAllMessages.request' when INBOX has (empty) data, should dispatch both 'setShownMessageCategoryAction('ARCHIVE')' when setting page 1 and 'reloadAllMessages.request'", () => { - const mockUseRefOutput: React.MutableRefObject = { + const mockUseRefOutput: MutableRefObject = { current: null }; const { store } = renderComponent( @@ -77,7 +77,7 @@ describe("PagerViewContainer", () => { ); }); it("should not dispatch 'reloadAllMessages.request' when INBOX has (empty) data, should dispatch 'setShownMessageCategoryAction('ARCHIVE')' when setting page 1 but no 'reloadAllMessages.request' when ARCHIVE has data", () => { - const mockUseRefOutput: React.MutableRefObject = { + const mockUseRefOutput: MutableRefObject = { current: null }; const { store } = renderComponent( @@ -108,7 +108,7 @@ describe("PagerViewContainer", () => { }); it("should not dispatch 'reloadAllMessages.request' when ARCHIVE has (empty) data, should dispatch both 'setShownMessageCategoryAction('INBOX')' when setting page 0 and 'reloadAllMessages.request'", () => { - const mockUseRefOutput: React.MutableRefObject = { + const mockUseRefOutput: MutableRefObject = { current: null }; const { store } = renderComponent( @@ -144,7 +144,7 @@ describe("PagerViewContainer", () => { ); }); it("should not dispatch 'reloadAllMessages.request' when ARCHIVE has (empty) data, should dispatch 'setShownMessageCategoryAction('INBOX')' when setting page 0 but no 'reloadAllMessages.request' when INBOX has data", () => { - const mockUseRefOutput: React.MutableRefObject = { + const mockUseRefOutput: MutableRefObject = { current: null }; const { store } = renderComponent( @@ -179,7 +179,7 @@ const renderComponent = ( shownCategory: MessageListCategory, inboxMessagePagePot: MessagePagePot, archiveMessagePagePot: MessagePagePot, - ref?: React.RefObject + ref?: RefObject ) => { const initialState = appReducer(undefined, applicationChangeState("active")); const designSystemState = appReducer( diff --git a/ts/features/messages/components/Home/__tests__/Preconditions.test.tsx b/ts/features/messages/components/Home/__tests__/Preconditions.test.tsx index d531e939206..06509ae1e34 100644 --- a/ts/features/messages/components/Home/__tests__/Preconditions.test.tsx +++ b/ts/features/messages/components/Home/__tests__/Preconditions.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { constUndefined } from "fp-ts/lib/function"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../../store/actions/application"; diff --git a/ts/features/messages/components/Home/__tests__/PreconditionsContent.test.tsx b/ts/features/messages/components/Home/__tests__/PreconditionsContent.test.tsx index f71d0f86fb6..7959b906df9 100644 --- a/ts/features/messages/components/Home/__tests__/PreconditionsContent.test.tsx +++ b/ts/features/messages/components/Home/__tests__/PreconditionsContent.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { constUndefined } from "fp-ts/lib/function"; import { createStore } from "redux"; import { appReducer } from "../../../../../store/reducers"; diff --git a/ts/features/messages/components/Home/__tests__/PreconditionsFeedback.test.tsx b/ts/features/messages/components/Home/__tests__/PreconditionsFeedback.test.tsx index ad2e306e0f8..ec5d5ff8f2b 100644 --- a/ts/features/messages/components/Home/__tests__/PreconditionsFeedback.test.tsx +++ b/ts/features/messages/components/Home/__tests__/PreconditionsFeedback.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../../store/actions/application"; import { preferencesDesignSystemSetEnabled } from "../../../../../store/actions/persistedPreferences"; diff --git a/ts/features/messages/components/Home/__tests__/PreconditionsFooter.test.tsx b/ts/features/messages/components/Home/__tests__/PreconditionsFooter.test.tsx index 63596fec5b9..4d4373626d8 100644 --- a/ts/features/messages/components/Home/__tests__/PreconditionsFooter.test.tsx +++ b/ts/features/messages/components/Home/__tests__/PreconditionsFooter.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { constUndefined } from "fp-ts/lib/function"; import { fireEvent } from "@testing-library/react-native"; import { createStore } from "redux"; diff --git a/ts/features/messages/components/Home/__tests__/PreconditionsTitle.test.tsx b/ts/features/messages/components/Home/__tests__/PreconditionsTitle.test.tsx index 16afc30c135..8d39da9c220 100644 --- a/ts/features/messages/components/Home/__tests__/PreconditionsTitle.test.tsx +++ b/ts/features/messages/components/Home/__tests__/PreconditionsTitle.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { constUndefined } from "fp-ts/lib/function"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../../store/actions/application"; diff --git a/ts/features/messages/components/Home/__tests__/SecuritySuggestions.test.tsx b/ts/features/messages/components/Home/__tests__/SecuritySuggestions.test.tsx index cde82033997..4acd4101b84 100644 --- a/ts/features/messages/components/Home/__tests__/SecuritySuggestions.test.tsx +++ b/ts/features/messages/components/Home/__tests__/SecuritySuggestions.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { appReducer } from "../../../../../store/reducers"; import { applicationChangeState } from "../../../../../store/actions/application"; diff --git a/ts/features/messages/components/Home/__tests__/TabNavigationContainer.test.tsx b/ts/features/messages/components/Home/__tests__/TabNavigationContainer.test.tsx index bffcbd82814..6a092ea1dc6 100644 --- a/ts/features/messages/components/Home/__tests__/TabNavigationContainer.test.tsx +++ b/ts/features/messages/components/Home/__tests__/TabNavigationContainer.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import PagerView from "react-native-pager-view"; import { fireEvent } from "@testing-library/react-native"; diff --git a/ts/features/messages/components/Home/__tests__/WrappedListItemMessage.test.tsx b/ts/features/messages/components/Home/__tests__/WrappedListItemMessage.test.tsx index e157e55e211..3e975885306 100644 --- a/ts/features/messages/components/Home/__tests__/WrappedListItemMessage.test.tsx +++ b/ts/features/messages/components/Home/__tests__/WrappedListItemMessage.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { fireEvent } from "@testing-library/react-native"; import { appReducer } from "../../../../../store/reducers"; diff --git a/ts/features/messages/components/MessageAttachment/MessageAttachment.tsx b/ts/features/messages/components/MessageAttachment/MessageAttachment.tsx index 7ed25652889..782628390c5 100644 --- a/ts/features/messages/components/MessageAttachment/MessageAttachment.tsx +++ b/ts/features/messages/components/MessageAttachment/MessageAttachment.tsx @@ -5,7 +5,7 @@ import { } from "@pagopa/io-app-design-system"; import * as B from "fp-ts/lib/boolean"; import { pipe } from "fp-ts/lib/function"; -import React, { useCallback, useState } from "react"; +import { useCallback, useState } from "react"; import ReactNativeBlobUtil from "react-native-blob-util"; import { ServiceId } from "../../../../../definitions/backend/ServiceId"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; diff --git a/ts/features/messages/components/MessageAttachment/PdfViewer.tsx b/ts/features/messages/components/MessageAttachment/PdfViewer.tsx index 04ec664299f..825aaa6d365 100644 --- a/ts/features/messages/components/MessageAttachment/PdfViewer.tsx +++ b/ts/features/messages/components/MessageAttachment/PdfViewer.tsx @@ -1,4 +1,5 @@ -import React, { useState } from "react"; +import { ComponentProps, useState } from "react"; + import { StyleSheet, View } from "react-native"; import Pdf from "react-native-pdf"; import { IOColors } from "@pagopa/io-app-design-system"; @@ -16,7 +17,7 @@ type OwnProps = { downloadPath: string; }; -type Props = OwnProps & Omit, "source">; +type Props = OwnProps & Omit, "source">; export const PdfViewer = ({ style, diff --git a/ts/features/messages/components/MessageAttachment/__test__/PdfViewer.test.tsx b/ts/features/messages/components/MessageAttachment/__test__/PdfViewer.test.tsx index 72145e61fab..93f44356942 100644 --- a/ts/features/messages/components/MessageAttachment/__test__/PdfViewer.test.tsx +++ b/ts/features/messages/components/MessageAttachment/__test__/PdfViewer.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { render } from "@testing-library/react-native"; import configureMockStore from "redux-mock-store"; import { Provider } from "react-redux"; diff --git a/ts/features/messages/components/MessageDetail/ContactsListItem.tsx b/ts/features/messages/components/MessageDetail/ContactsListItem.tsx index ce2f084d1dd..8ee07bb3a0e 100644 --- a/ts/features/messages/components/MessageDetail/ContactsListItem.tsx +++ b/ts/features/messages/components/MessageDetail/ContactsListItem.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { Linking } from "react-native"; import { Body, ListItemAction, VSpacer } from "@pagopa/io-app-design-system"; import I18n from "../../../../i18n"; diff --git a/ts/features/messages/components/MessageDetail/MessageDetailsAttachmentItem.tsx b/ts/features/messages/components/MessageDetail/MessageDetailsAttachmentItem.tsx index 9f6e8663863..5300db03b7d 100644 --- a/ts/features/messages/components/MessageDetail/MessageDetailsAttachmentItem.tsx +++ b/ts/features/messages/components/MessageDetail/MessageDetailsAttachmentItem.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { ModuleAttachment, VSpacer } from "@pagopa/io-app-design-system"; import { ServiceId } from "../../../../../definitions/backend/ServiceId"; import { ThirdPartyAttachment } from "../../../../../definitions/backend/ThirdPartyAttachment"; diff --git a/ts/features/messages/components/MessageDetail/MessageDetailsAttachments.tsx b/ts/features/messages/components/MessageDetail/MessageDetailsAttachments.tsx index ab5557ff710..6896b5c39b1 100644 --- a/ts/features/messages/components/MessageDetail/MessageDetailsAttachments.tsx +++ b/ts/features/messages/components/MessageDetail/MessageDetailsAttachments.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { pipe } from "fp-ts/lib/function"; import * as B from "fp-ts/lib/boolean"; import { ListItemHeader } from "@pagopa/io-app-design-system"; diff --git a/ts/features/messages/components/MessageDetail/MessageDetailsFooter.tsx b/ts/features/messages/components/MessageDetail/MessageDetailsFooter.tsx index 8fd0c0287a5..dadfab27b4c 100644 --- a/ts/features/messages/components/MessageDetail/MessageDetailsFooter.tsx +++ b/ts/features/messages/components/MessageDetail/MessageDetailsFooter.tsx @@ -1,4 +1,4 @@ -import React, { useMemo } from "react"; +import { useMemo } from "react"; import { StyleSheet, View } from "react-native"; import { IOColors, diff --git a/ts/features/messages/components/MessageDetail/MessageDetailsHeader.tsx b/ts/features/messages/components/MessageDetail/MessageDetailsHeader.tsx index 5d6bb630f16..40e17c3d524 100644 --- a/ts/features/messages/components/MessageDetail/MessageDetailsHeader.tsx +++ b/ts/features/messages/components/MessageDetail/MessageDetailsHeader.tsx @@ -1,4 +1,4 @@ -import React, { PropsWithChildren } from "react"; +import { PropsWithChildren } from "react"; import { StyleSheet, View } from "react-native"; import { Divider, H3, BodySmall, VSpacer } from "@pagopa/io-app-design-system"; import { pipe } from "fp-ts/lib/function"; diff --git a/ts/features/messages/components/MessageDetail/MessageDetailsPayment.tsx b/ts/features/messages/components/MessageDetail/MessageDetailsPayment.tsx index 5cdef78c88d..ed5cc0e391b 100644 --- a/ts/features/messages/components/MessageDetail/MessageDetailsPayment.tsx +++ b/ts/features/messages/components/MessageDetail/MessageDetailsPayment.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { ListItemHeader, VSpacer } from "@pagopa/io-app-design-system"; import { UIMessageId } from "../../types"; import { useIOSelector } from "../../../../store/hooks"; diff --git a/ts/features/messages/components/MessageDetail/MessageDetailsPaymentButton.tsx b/ts/features/messages/components/MessageDetail/MessageDetailsPaymentButton.tsx index cf95005f2b3..9afe3253aec 100644 --- a/ts/features/messages/components/MessageDetail/MessageDetailsPaymentButton.tsx +++ b/ts/features/messages/components/MessageDetail/MessageDetailsPaymentButton.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { ButtonSolid, useIOToast } from "@pagopa/io-app-design-system"; import { PaymentData } from "../../types"; import { useIODispatch, useIOStore } from "../../../../store/hooks"; diff --git a/ts/features/messages/components/MessageDetail/MessageDetailsReminder.tsx b/ts/features/messages/components/MessageDetail/MessageDetailsReminder.tsx index 1a6f4c8932a..33978a4c5be 100644 --- a/ts/features/messages/components/MessageDetail/MessageDetailsReminder.tsx +++ b/ts/features/messages/components/MessageDetail/MessageDetailsReminder.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { VSpacer } from "@pagopa/io-app-design-system"; import { UIMessageId } from "../../types"; import { useIOSelector } from "../../../../store/hooks"; diff --git a/ts/features/messages/components/MessageDetail/MessageDetailsReminderExpired.tsx b/ts/features/messages/components/MessageDetail/MessageDetailsReminderExpired.tsx index d68caa605c4..e21232f183f 100644 --- a/ts/features/messages/components/MessageDetail/MessageDetailsReminderExpired.tsx +++ b/ts/features/messages/components/MessageDetail/MessageDetailsReminderExpired.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { Alert, IOAlertRadius } from "@pagopa/io-app-design-system"; import Placeholder from "rn-placeholder"; import { localeDateFormat } from "../../../../utils/locale"; diff --git a/ts/features/messages/components/MessageDetail/MessageDetailsReminderExpiring.tsx b/ts/features/messages/components/MessageDetail/MessageDetailsReminderExpiring.tsx index fbe70a9d270..865d98a818d 100644 --- a/ts/features/messages/components/MessageDetail/MessageDetailsReminderExpiring.tsx +++ b/ts/features/messages/components/MessageDetail/MessageDetailsReminderExpiring.tsx @@ -1,4 +1,4 @@ -import React, { useCallback } from "react"; +import { useCallback } from "react"; import { Alert } from "@pagopa/io-app-design-system"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; import { useIOSelector } from "../../../../store/hooks"; diff --git a/ts/features/messages/components/MessageDetail/MessageDetailsScrollViewAdditionalSpace.tsx b/ts/features/messages/components/MessageDetail/MessageDetailsScrollViewAdditionalSpace.tsx index 4850db104e9..994d095129a 100644 --- a/ts/features/messages/components/MessageDetail/MessageDetailsScrollViewAdditionalSpace.tsx +++ b/ts/features/messages/components/MessageDetail/MessageDetailsScrollViewAdditionalSpace.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import { IOStyles, buttonSolidHeight } from "@pagopa/io-app-design-system"; import { View } from "react-native"; diff --git a/ts/features/messages/components/MessageDetail/MessageDetailsStickyFooter.tsx b/ts/features/messages/components/MessageDetail/MessageDetailsStickyFooter.tsx index a3568e1924a..11f54d24681 100644 --- a/ts/features/messages/components/MessageDetail/MessageDetailsStickyFooter.tsx +++ b/ts/features/messages/components/MessageDetail/MessageDetailsStickyFooter.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { useCallback } from "react"; import { StyleSheet, View } from "react-native"; import { useLinkTo } from "@react-navigation/native"; import { @@ -287,7 +287,7 @@ export const MessageDetailsStickyFooter = ({ canNavigateToPaymentFromMessageSelector(state) ); - const onCTAPreActionCallback = React.useCallback( + const onCTAPreActionCallback = useCallback( (cta: CTA) => (type: CTAActionType) => { const state = store.getState(); computeAndTrackFIMSAuthenticationStart(type, cta.text, serviceId, state); @@ -296,7 +296,7 @@ export const MessageDetailsStickyFooter = ({ ); const linkTo = useLinkTo(); - const onCTAPressedCallback = React.useCallback( + const onCTAPressedCallback = useCallback( (isFirstCTA: boolean, cta: CTA, isPNOptInMessage: boolean) => { const state = store.getState(); computeAndTrackCTAPressAnalytics(isFirstCTA, cta, serviceId, state); diff --git a/ts/features/messages/components/MessageDetail/MessageDetailsTagBox.tsx b/ts/features/messages/components/MessageDetail/MessageDetailsTagBox.tsx index 0afa1ddb5b7..1089fc1627e 100644 --- a/ts/features/messages/components/MessageDetail/MessageDetailsTagBox.tsx +++ b/ts/features/messages/components/MessageDetail/MessageDetailsTagBox.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { ReactNode } from "react"; import { StyleSheet, View } from "react-native"; import { gapBetweenItemsInAGrid } from "../../utils"; @@ -11,7 +11,7 @@ const styles = StyleSheet.create({ }); export type MessageDetailsTagBoxProps = { - children: React.ReactNode; + children: ReactNode; }; export const MessageDetailsTagBox = ({ diff --git a/ts/features/messages/components/MessageDetail/MessageMarkdown.tsx b/ts/features/messages/components/MessageDetail/MessageMarkdown.tsx index 346ac3bd6a9..af99f5ce3e6 100644 --- a/ts/features/messages/components/MessageDetail/MessageMarkdown.tsx +++ b/ts/features/messages/components/MessageDetail/MessageMarkdown.tsx @@ -1,5 +1,4 @@ import { Omit } from "@pagopa/ts-commons/lib/types"; -import React from "react"; import customVariables from "../../../../theme/variables"; import { Markdown, diff --git a/ts/features/messages/components/MessageDetail/MessagePaymentItem.tsx b/ts/features/messages/components/MessageDetail/MessagePaymentItem.tsx index 9364cea5e65..c85b1808fd0 100644 --- a/ts/features/messages/components/MessageDetail/MessagePaymentItem.tsx +++ b/ts/features/messages/components/MessageDetail/MessagePaymentItem.tsx @@ -6,7 +6,7 @@ import { } from "@pagopa/io-app-design-system"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React, { useCallback, useEffect } from "react"; +import { useCallback, useEffect } from "react"; import { View } from "react-native"; import { PaymentAmount } from "../../../../../definitions/backend/PaymentAmount"; import I18n from "../../../../i18n"; diff --git a/ts/features/messages/components/MessageDetail/OrganizationHeader.tsx b/ts/features/messages/components/MessageDetail/OrganizationHeader.tsx index acb02120b2b..22d78afc602 100644 --- a/ts/features/messages/components/MessageDetail/OrganizationHeader.tsx +++ b/ts/features/messages/components/MessageDetail/OrganizationHeader.tsx @@ -6,7 +6,7 @@ import { BodySmall, useIOTheme } from "@pagopa/io-app-design-system"; -import React, { useCallback } from "react"; +import { useCallback } from "react"; import { ImageURISource, StyleSheet, View } from "react-native"; import { ServiceId } from "../../../../../definitions/backend/ServiceId"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; diff --git a/ts/features/messages/components/MessageDetail/RemoteContentBanner.tsx b/ts/features/messages/components/MessageDetail/RemoteContentBanner.tsx index 81952bb0177..11234ea5894 100644 --- a/ts/features/messages/components/MessageDetail/RemoteContentBanner.tsx +++ b/ts/features/messages/components/MessageDetail/RemoteContentBanner.tsx @@ -1,4 +1,4 @@ -import React, { useMemo } from "react"; +import { useMemo } from "react"; import { Banner, BodyProps, diff --git a/ts/features/messages/components/MessageDetail/ShowMoreListItem.tsx b/ts/features/messages/components/MessageDetail/ShowMoreListItem.tsx index c06ef7be1f4..332ac2fbc0b 100644 --- a/ts/features/messages/components/MessageDetail/ShowMoreListItem.tsx +++ b/ts/features/messages/components/MessageDetail/ShowMoreListItem.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { Fragment } from "react"; import { View } from "react-native"; import { Divider, @@ -34,13 +34,13 @@ export const ShowMoreListItem = ({ sections }: ShowMoreListItemProps) => { component: ( <> {sections.map((section, sectionIndex) => ( - + {section.items.map((item, itemIndex, items) => ( - + { {itemIndex < items.length - 1 && ( )} - + ))} - + ))} ), diff --git a/ts/features/messages/components/MessageDetail/__mocks__/MessageMarkdown.tsx b/ts/features/messages/components/MessageDetail/__mocks__/MessageMarkdown.tsx index 40327dc068a..5cab7b7b275 100644 --- a/ts/features/messages/components/MessageDetail/__mocks__/MessageMarkdown.tsx +++ b/ts/features/messages/components/MessageDetail/__mocks__/MessageMarkdown.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { View } from "react-native"; import { MarkdownProps } from "../../../../../components/ui/Markdown/Markdown"; diff --git a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsAttachmentItem.test.tsx b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsAttachmentItem.test.tsx index d41de060dc9..db185409be9 100644 --- a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsAttachmentItem.test.tsx +++ b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsAttachmentItem.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../../store/actions/application"; import { preferencesDesignSystemSetEnabled } from "../../../../../store/actions/persistedPreferences"; diff --git a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsAttachments.test.tsx b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsAttachments.test.tsx index 7865045300b..04f1dc9fc6c 100644 --- a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsAttachments.test.tsx +++ b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsAttachments.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../../store/actions/application"; import { preferencesDesignSystemSetEnabled } from "../../../../../store/actions/persistedPreferences"; diff --git a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsFooter.test.tsx b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsFooter.test.tsx index 78403760eda..645bcdc16c5 100644 --- a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsFooter.test.tsx +++ b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsFooter.test.tsx @@ -1,4 +1,5 @@ -import React, { ComponentProps } from "react"; +import { ComponentProps } from "react"; + import { Action, Store } from "redux"; import configureMockStore from "redux-mock-store"; import { fireEvent } from "@testing-library/react-native"; @@ -262,7 +263,7 @@ describe("MessageDetailsFooter component", () => { const renderComponent = ( state: GlobalState, - props: React.ComponentProps + props: ComponentProps ) => { const mockStore = configureMockStore(); const store: Store = mockStore(state); diff --git a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsHeader.test.tsx b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsHeader.test.tsx index a8f1d22c38f..5bc1871976c 100644 --- a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsHeader.test.tsx +++ b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsHeader.test.tsx @@ -1,4 +1,5 @@ -import React, { ComponentProps } from "react"; +import { ComponentProps } from "react"; + import { Action, Store } from "redux"; import configureMockStore from "redux-mock-store"; import { MessageDetailsHeader } from "../MessageDetailsHeader"; @@ -37,7 +38,7 @@ describe("MessageDetailsHeader component", () => { }); const renderComponent = ( - props: React.ComponentProps + props: ComponentProps ) => { const sequenceOfActions: ReadonlyArray = [ applicationChangeState("active"), diff --git a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsPayment.test.tsx b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsPayment.test.tsx index 1009a56a127..779e9d96be7 100644 --- a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsPayment.test.tsx +++ b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsPayment.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../../store/actions/application"; import { preferencesDesignSystemSetEnabled } from "../../../../../store/actions/persistedPreferences"; diff --git a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsPaymentButton.test.tsx b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsPaymentButton.test.tsx index f09fc024ceb..fb3132275b2 100644 --- a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsPaymentButton.test.tsx +++ b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsPaymentButton.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../../store/actions/application"; import { preferencesDesignSystemSetEnabled } from "../../../../../store/actions/persistedPreferences"; diff --git a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsReminder.test.tsx b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsReminder.test.tsx index 1c472b2bdba..076ec6d4917 100644 --- a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsReminder.test.tsx +++ b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsReminder.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { MessageDetailsReminder } from "../MessageDetailsReminder"; import { appReducer } from "../../../../../store/reducers"; diff --git a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsReminderExpired.test.tsx b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsReminderExpired.test.tsx index e7c69f1f7ae..72d90752389 100644 --- a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsReminderExpired.test.tsx +++ b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsReminderExpired.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { appReducer } from "../../../../../store/reducers"; import { applicationChangeState } from "../../../../../store/actions/application"; diff --git a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsReminderExpiring.test.tsx b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsReminderExpiring.test.tsx index c3325d9abef..8e92f501b76 100644 --- a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsReminderExpiring.test.tsx +++ b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsReminderExpiring.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { MessageDetailsReminderExpiring } from "../MessageDetailsReminderExpiring"; import { appReducer } from "../../../../../store/reducers"; diff --git a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsScrollViewAdditionalSpace.test.tsx b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsScrollViewAdditionalSpace.test.tsx index bc1d8571115..b4d3d7d7dc7 100644 --- a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsScrollViewAdditionalSpace.test.tsx +++ b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsScrollViewAdditionalSpace.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { createStore } from "redux"; import { appReducer } from "../../../../../store/reducers"; import { applicationChangeState } from "../../../../../store/actions/application"; diff --git a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsStickyFooter.test.tsx b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsStickyFooter.test.tsx index 9eed4479714..14dd484fef8 100644 --- a/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsStickyFooter.test.tsx +++ b/ts/features/messages/components/MessageDetail/__tests__/MessageDetailsStickyFooter.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { createStore } from "redux"; import { appReducer } from "../../../../../store/reducers"; import { applicationChangeState } from "../../../../../store/actions/application"; diff --git a/ts/features/messages/components/MessageDetail/__tests__/MessagePaymentItem.test.tsx b/ts/features/messages/components/MessageDetail/__tests__/MessagePaymentItem.test.tsx index 238415b7a5a..456f4a8d49c 100644 --- a/ts/features/messages/components/MessageDetail/__tests__/MessagePaymentItem.test.tsx +++ b/ts/features/messages/components/MessageDetail/__tests__/MessagePaymentItem.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../../store/actions/application"; import { appReducer } from "../../../../../store/reducers"; diff --git a/ts/features/messages/components/MessageDetail/__tests__/OrganizationHeader.test.tsx b/ts/features/messages/components/MessageDetail/__tests__/OrganizationHeader.test.tsx index 1eb4c00e7b8..b8a89fb9069 100644 --- a/ts/features/messages/components/MessageDetail/__tests__/OrganizationHeader.test.tsx +++ b/ts/features/messages/components/MessageDetail/__tests__/OrganizationHeader.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { OrganizationHeader } from "../OrganizationHeader"; import { ServiceId } from "../../../../../../definitions/backend/ServiceId"; diff --git a/ts/features/messages/components/MessageDetail/__tests__/RemoteContentBanner.test.tsx b/ts/features/messages/components/MessageDetail/__tests__/RemoteContentBanner.test.tsx index 7a767aefaa0..94906200745 100644 --- a/ts/features/messages/components/MessageDetail/__tests__/RemoteContentBanner.test.tsx +++ b/ts/features/messages/components/MessageDetail/__tests__/RemoteContentBanner.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { appReducer } from "../../../../../store/reducers"; import { applicationChangeState } from "../../../../../store/actions/application"; diff --git a/ts/features/messages/components/MessageDetail/__tests__/ShowMoreListItem.test.tsx b/ts/features/messages/components/MessageDetail/__tests__/ShowMoreListItem.test.tsx index c5e26160fe3..31132250be0 100644 --- a/ts/features/messages/components/MessageDetail/__tests__/ShowMoreListItem.test.tsx +++ b/ts/features/messages/components/MessageDetail/__tests__/ShowMoreListItem.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../../store/actions/application"; import { preferencesDesignSystemSetEnabled } from "../../../../../store/actions/persistedPreferences"; diff --git a/ts/features/messages/components/Search/EmptyList.tsx b/ts/features/messages/components/Search/EmptyList.tsx index 7817f4dd3c6..e109e719382 100644 --- a/ts/features/messages/components/Search/EmptyList.tsx +++ b/ts/features/messages/components/Search/EmptyList.tsx @@ -6,7 +6,6 @@ import { VStack, WithTestID } from "@pagopa/io-app-design-system"; -import React from "react"; export type EmptyListProps = WithTestID<{ pictogram: IOPictograms; diff --git a/ts/features/messages/navigation/MessagesNavigator.tsx b/ts/features/messages/navigation/MessagesNavigator.tsx index e2db78dc22c..2a0b3b7162d 100644 --- a/ts/features/messages/navigation/MessagesNavigator.tsx +++ b/ts/features/messages/navigation/MessagesNavigator.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStackNavigator } from "@react-navigation/stack"; import { MessageDetailsScreen } from "../screens/MessageDetailsScreen"; import { MessageCalendarScreen } from "../screens/MessageCalendarScreen"; diff --git a/ts/features/messages/screens/MessageAttachmentScreen.tsx b/ts/features/messages/screens/MessageAttachmentScreen.tsx index 05e8f99e487..70cda00a76e 100644 --- a/ts/features/messages/screens/MessageAttachmentScreen.tsx +++ b/ts/features/messages/screens/MessageAttachmentScreen.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { UIMessageId } from "../types"; import { IOStackNavigationRouteProps } from "../../../navigation/params/AppParamsList"; import { MessagesParamsList } from "../navigation/params"; diff --git a/ts/features/messages/screens/MessageCalendarScreen.tsx b/ts/features/messages/screens/MessageCalendarScreen.tsx index 3b5949f1105..16e8ab54593 100644 --- a/ts/features/messages/screens/MessageCalendarScreen.tsx +++ b/ts/features/messages/screens/MessageCalendarScreen.tsx @@ -9,7 +9,7 @@ import { RouteProp, useRoute } from "@react-navigation/native"; import { pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; import * as TE from "fp-ts/lib/TaskEither"; -import React, { useCallback, useEffect, useState } from "react"; +import { useCallback, useEffect, useState } from "react"; import { ScrollView, View } from "react-native"; import { Calendar } from "react-native-calendar-events"; import { CalendarList } from "../../../components/CalendarList"; diff --git a/ts/features/messages/screens/MessageDetailsScreen.tsx b/ts/features/messages/screens/MessageDetailsScreen.tsx index bf85081bff9..6aa73649f1d 100644 --- a/ts/features/messages/screens/MessageDetailsScreen.tsx +++ b/ts/features/messages/screens/MessageDetailsScreen.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect, useMemo, useRef } from "react"; +import { useCallback, useEffect, useMemo, useRef } from "react"; import { ScrollView, StyleSheet, View } from "react-native"; import { ContentWrapper, Icon, VSpacer } from "@pagopa/io-app-design-system"; import { useFocusEffect } from "@react-navigation/native"; diff --git a/ts/features/messages/screens/MessageGreenPassScreen.tsx b/ts/features/messages/screens/MessageGreenPassScreen.tsx index 2b30554bd1d..71638da7497 100644 --- a/ts/features/messages/screens/MessageGreenPassScreen.tsx +++ b/ts/features/messages/screens/MessageGreenPassScreen.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { useIONavigation } from "../../../navigation/params/AppParamsList"; import { useHeaderSecondLevel } from "../../../hooks/useHeaderSecondLevel"; import { OperationResultScreenContent } from "../../../components/screens/OperationResultScreenContent"; diff --git a/ts/features/messages/screens/MessageRouterScreen.tsx b/ts/features/messages/screens/MessageRouterScreen.tsx index a2037cf1b4e..71ec1237737 100644 --- a/ts/features/messages/screens/MessageRouterScreen.tsx +++ b/ts/features/messages/screens/MessageRouterScreen.tsx @@ -1,4 +1,5 @@ -import React, { useCallback, useEffect, useRef } from "react"; +import { ReactElement, useCallback, useEffect, useRef } from "react"; + import { View } from "react-native"; import { StackActions } from "@react-navigation/native"; import { Body, VSpacer } from "@pagopa/io-app-design-system"; @@ -39,9 +40,7 @@ type NavigationProps = IOStackNavigationRouteProps< "MESSAGE_ROUTER" >; -export const MessageRouterScreen = ( - props: NavigationProps -): React.ReactElement => { +export const MessageRouterScreen = (props: NavigationProps): ReactElement => { const messageId = props.route.params.messageId; const fromPushNotification = props.route.params.fromNotification; const dispatch = useIODispatch(); diff --git a/ts/features/messages/screens/MessagesHomeScreen.tsx b/ts/features/messages/screens/MessagesHomeScreen.tsx index 944eb14ae29..0835dd34257 100644 --- a/ts/features/messages/screens/MessagesHomeScreen.tsx +++ b/ts/features/messages/screens/MessagesHomeScreen.tsx @@ -1,5 +1,5 @@ import { HeaderActionProps, IOStyles } from "@pagopa/io-app-design-system"; -import React, { useCallback, useMemo, useRef } from "react"; +import { useCallback, useMemo, useRef } from "react"; import { View } from "react-native"; import PagerView from "react-native-pager-view"; import { useHeaderFirstLevel } from "../../../hooks/useHeaderFirstLevel"; diff --git a/ts/features/messages/screens/MessagesSearchScreen.tsx b/ts/features/messages/screens/MessagesSearchScreen.tsx index 17c1e152fa9..6419fea61d0 100644 --- a/ts/features/messages/screens/MessagesSearchScreen.tsx +++ b/ts/features/messages/screens/MessagesSearchScreen.tsx @@ -6,13 +6,7 @@ import { SearchInputRef, VSpacer } from "@pagopa/io-app-design-system"; -import React, { - useCallback, - useEffect, - useMemo, - useRef, - useState -} from "react"; +import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { FlatList, ListRenderItemInfo, diff --git a/ts/features/messages/screens/__tests__/MessagesHomeScreen.test.tsx b/ts/features/messages/screens/__tests__/MessagesHomeScreen.test.tsx index 86f6dd0e928..777052b2f4a 100644 --- a/ts/features/messages/screens/__tests__/MessagesHomeScreen.test.tsx +++ b/ts/features/messages/screens/__tests__/MessagesHomeScreen.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { appReducer } from "../../../../store/reducers"; import { applicationChangeState } from "../../../../store/actions/application"; diff --git a/ts/features/payments/barcode/components/PaymentNoticeListItem.tsx b/ts/features/payments/barcode/components/PaymentNoticeListItem.tsx index 542165cd5e2..49cce6f4c53 100644 --- a/ts/features/payments/barcode/components/PaymentNoticeListItem.tsx +++ b/ts/features/payments/barcode/components/PaymentNoticeListItem.tsx @@ -3,7 +3,6 @@ import { AmountInEuroCents } from "@pagopa/io-pagopa-commons/lib/pagopa"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; import { toInteger } from "lodash"; -import React from "react"; import { centsToAmount, formatNumberAmount diff --git a/ts/features/payments/barcode/navigation/navigator.tsx b/ts/features/payments/barcode/navigation/navigator.tsx index c797d6e0556..4bae7236948 100644 --- a/ts/features/payments/barcode/navigation/navigator.tsx +++ b/ts/features/payments/barcode/navigation/navigator.tsx @@ -4,7 +4,6 @@ import { StackNavigationProp, TransitionPresets } from "@react-navigation/stack"; -import React from "react"; import { isGestureEnabled } from "../../../../utils/navigation"; import { PaymentsBarcodeChoiceScreen } from "../screens/PaymentsBarcodeChoiceScreen"; import { PaymentsBarcodeScanScreen } from "../screens/PaymentsBarcodeScanScreen"; diff --git a/ts/features/payments/barcode/screens/PaymentsBarcodeChoiceScreen.tsx b/ts/features/payments/barcode/screens/PaymentsBarcodeChoiceScreen.tsx index cf95ab0fbaa..f1b74f2ebf1 100644 --- a/ts/features/payments/barcode/screens/PaymentsBarcodeChoiceScreen.tsx +++ b/ts/features/payments/barcode/screens/PaymentsBarcodeChoiceScreen.tsx @@ -10,7 +10,7 @@ import * as A from "fp-ts/lib/Array"; import { contramap } from "fp-ts/lib/Ord"; import { pipe } from "fp-ts/lib/function"; import * as N from "fp-ts/number"; -import React from "react"; +import { useCallback, Fragment } from "react"; import { ScrollView } from "react-native-gesture-handler"; import BaseScreenComponent from "../../../../components/screens/BaseScreenComponent"; import I18n from "../../../../i18n"; @@ -33,7 +33,7 @@ const PaymentsBarcodeChoiceScreen = () => { const { startPaymentFlowWithRptId } = usePagoPaPayment(); useFocusEffect( - React.useCallback(() => { + useCallback(() => { analytics.trackBarcodeMultipleCodesScreenView(); }, []) ); @@ -80,10 +80,10 @@ const PaymentsBarcodeChoiceScreen = () => {

{I18n.t("wallet.payment.barcodes.choice.title")}

{sortedBarcodes.map((item, index) => ( - + {renderBarcodeItem(item)} {index <= sortedBarcodes.length - 2 && } - + ))} diff --git a/ts/features/payments/barcode/screens/PaymentsBarcodeScanScreen.tsx b/ts/features/payments/barcode/screens/PaymentsBarcodeScanScreen.tsx index 8f13185d52e..91fe71be217 100644 --- a/ts/features/payments/barcode/screens/PaymentsBarcodeScanScreen.tsx +++ b/ts/features/payments/barcode/screens/PaymentsBarcodeScanScreen.tsx @@ -2,7 +2,6 @@ import { IOToast } from "@pagopa/io-app-design-system"; import { useNavigation } from "@react-navigation/native"; import * as A from "fp-ts/lib/Array"; import { pipe } from "fp-ts/lib/function"; -import * as React from "react"; import ReactNativeHapticFeedback, { HapticFeedbackTypes } from "react-native-haptic-feedback"; diff --git a/ts/features/payments/checkout/components/CheckoutPaymentMethodsList.tsx b/ts/features/payments/checkout/components/CheckoutPaymentMethodsList.tsx index 905a0b75443..b5b2cbee74d 100644 --- a/ts/features/payments/checkout/components/CheckoutPaymentMethodsList.tsx +++ b/ts/features/payments/checkout/components/CheckoutPaymentMethodsList.tsx @@ -9,7 +9,7 @@ import * as A from "fp-ts/lib/Array"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; import _, { capitalize } from "lodash"; -import React, { useEffect, useMemo } from "react"; +import { useState, useEffect, useMemo } from "react"; import { WalletInfo } from "../../../../../definitions/pagopa/ecommerce/WalletInfo"; import { PaymentMethodResponse } from "../../../../../definitions/pagopa/walletv3/PaymentMethodResponse"; import I18n from "../../../../i18n"; @@ -32,7 +32,7 @@ const CheckoutPaymentMethodsList = () => { const dispatch = useIODispatch(); const [shouldShowWarningBanner, setShouldShowWarningBanner] = - React.useState(false); + useState(false); const paymentAmountPot = useIOSelector(walletPaymentAmountSelector); const allPaymentMethods = useIOSelector(walletPaymentAllMethodsSelector); diff --git a/ts/features/payments/checkout/components/WalletPaymentFailureDetail.tsx b/ts/features/payments/checkout/components/WalletPaymentFailureDetail.tsx index a6d21ea60e3..c7bd4930613 100644 --- a/ts/features/payments/checkout/components/WalletPaymentFailureDetail.tsx +++ b/ts/features/payments/checkout/components/WalletPaymentFailureDetail.tsx @@ -1,5 +1,4 @@ import { useNavigation } from "@react-navigation/native"; -import React from "react"; import { OperationResultScreenContent, OperationResultScreenContentProps diff --git a/ts/features/payments/checkout/components/WalletPaymentFeedbackBanner.tsx b/ts/features/payments/checkout/components/WalletPaymentFeedbackBanner.tsx index ff326c5a0a4..c6419668e90 100644 --- a/ts/features/payments/checkout/components/WalletPaymentFeedbackBanner.tsx +++ b/ts/features/payments/checkout/components/WalletPaymentFeedbackBanner.tsx @@ -1,6 +1,6 @@ import { Banner, VSpacer } from "@pagopa/io-app-design-system"; import { openAuthenticationSession } from "@pagopa/io-react-native-login-utils"; -import { default as React } from "react"; +import { useRef } from "react"; import { View } from "react-native"; import { mixpanelTrack } from "../../../../mixpanel"; import { useIOSelector } from "../../../../store/hooks"; @@ -11,7 +11,7 @@ import { import { getFullLocale } from "../../../../utils/locale"; const WalletPaymentFeebackBanner = () => { - const bannerViewRef = React.useRef(null); + const bannerViewRef = useRef(null); const isBannerEnabled = useIOSelector( isPaymentsFeedbackBannerEnabledSelector ); diff --git a/ts/features/payments/checkout/components/WalletPaymentHeader.tsx b/ts/features/payments/checkout/components/WalletPaymentHeader.tsx index ccb2840d430..9a49f21dc03 100644 --- a/ts/features/payments/checkout/components/WalletPaymentHeader.tsx +++ b/ts/features/payments/checkout/components/WalletPaymentHeader.tsx @@ -6,7 +6,7 @@ import { } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; -import React from "react"; +import { useCallback } from "react"; import { useStartSupportRequest } from "../../../../hooks/useStartSupportRequest"; import I18n from "../../../../i18n"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; @@ -38,7 +38,7 @@ const WalletPaymentHeader = ({ currentStep }: WalletPaymentHeaderProps) => { contextualHelp: emptyContextualHelp }); - const handleGoBack = React.useCallback(() => { + const handleGoBack = useCallback(() => { if (currentStep === WalletPaymentStepEnum.PICK_PAYMENT_METHOD) { analytics.trackPaymentBack( WalletPaymentStepScreenNames[WalletPaymentStepEnum.PICK_PAYMENT_METHOD] diff --git a/ts/features/payments/checkout/components/WalletPaymentTotalAmount.tsx b/ts/features/payments/checkout/components/WalletPaymentTotalAmount.tsx index 945aa2415cd..39b4afc3d7a 100644 --- a/ts/features/payments/checkout/components/WalletPaymentTotalAmount.tsx +++ b/ts/features/payments/checkout/components/WalletPaymentTotalAmount.tsx @@ -1,4 +1,3 @@ -import React from "react"; import Placeholder from "rn-placeholder"; import { StyleSheet, View } from "react-native"; import { Divider, H3, H6, IOStyles } from "@pagopa/io-app-design-system"; diff --git a/ts/features/payments/checkout/components/WalletPspListSkeleton.tsx b/ts/features/payments/checkout/components/WalletPspListSkeleton.tsx index 4d94bbbed9b..7b515a6ff69 100644 --- a/ts/features/payments/checkout/components/WalletPspListSkeleton.tsx +++ b/ts/features/payments/checkout/components/WalletPspListSkeleton.tsx @@ -4,7 +4,6 @@ import { IOStyles, VSpacer } from "@pagopa/io-app-design-system"; -import React from "react"; import { View } from "react-native"; import Placeholder from "rn-placeholder"; diff --git a/ts/features/payments/checkout/components/__tests__/WalletPaymentFailureDetail.test.tsx b/ts/features/payments/checkout/components/__tests__/WalletPaymentFailureDetail.test.tsx index 892ab45491f..8d80c8eb58a 100644 --- a/ts/features/payments/checkout/components/__tests__/WalletPaymentFailureDetail.test.tsx +++ b/ts/features/payments/checkout/components/__tests__/WalletPaymentFailureDetail.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import configureMockStore from "redux-mock-store"; import { fireEvent } from "@testing-library/react-native"; diff --git a/ts/features/payments/checkout/hooks/useOnTransactionActivationEffect.tsx b/ts/features/payments/checkout/hooks/useOnTransactionActivationEffect.tsx index 5dc250626cb..e91dbb36d6b 100644 --- a/ts/features/payments/checkout/hooks/useOnTransactionActivationEffect.tsx +++ b/ts/features/payments/checkout/hooks/useOnTransactionActivationEffect.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { useRef, useEffect } from "react"; import { TransactionInfo } from "../../../../../definitions/pagopa/ecommerce/TransactionInfo"; import { TransactionStatusEnum } from "../../../../../definitions/pagopa/ecommerce/TransactionStatus"; import { useIODispatch, useIOSelector } from "../../../../store/hooks"; @@ -25,14 +25,14 @@ const useOnTransactionActivationEffect = (effect: EffectCallback) => { // This flag is used to avoid triggering the effect everytime this hook is mounted // It is set to false as soon the transaction is activated and avoids any other activation - const requiresActivation = React.useRef(true); + const requiresActivation = useRef(true); // Polling - const delayRef = React.useRef(INITIAL_DELAY); - const countRef = React.useRef(0); + const delayRef = useRef(INITIAL_DELAY); + const countRef = useRef(0); /* eslint-disable functional/immutable-data */ - React.useEffect(() => { + useEffect(() => { if (!requiresActivation.current) { // Skips the activation if the transactions is already activated for this payment istance return undefined; diff --git a/ts/features/payments/checkout/hooks/usePaymentFailureSupportModal.tsx b/ts/features/payments/checkout/hooks/usePaymentFailureSupportModal.tsx index b0aebba1c15..08d6fc1bf90 100644 --- a/ts/features/payments/checkout/hooks/usePaymentFailureSupportModal.tsx +++ b/ts/features/payments/checkout/hooks/usePaymentFailureSupportModal.tsx @@ -11,7 +11,7 @@ import { import { OrganizationFiscalCode } from "@pagopa/ts-commons/lib/strings"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { Linking } from "react-native"; import { ToolEnum } from "../../../../../definitions/content/AssistanceToolConfig"; import I18n from "../../../../i18n"; diff --git a/ts/features/payments/checkout/hooks/usePaymentReversedInfoBottomSheet.tsx b/ts/features/payments/checkout/hooks/usePaymentReversedInfoBottomSheet.tsx index d0c33e7969e..4f491970048 100644 --- a/ts/features/payments/checkout/hooks/usePaymentReversedInfoBottomSheet.tsx +++ b/ts/features/payments/checkout/hooks/usePaymentReversedInfoBottomSheet.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { VSpacer } from "@pagopa/io-app-design-system"; import { useIOBottomSheetAutoresizableModal } from "../../../../utils/hooks/bottomSheet"; import I18n from "../../../../i18n"; diff --git a/ts/features/payments/checkout/hooks/useSortPspBottomSheet.tsx b/ts/features/payments/checkout/hooks/useSortPspBottomSheet.tsx index 4877e4cb77f..e422518f94c 100644 --- a/ts/features/payments/checkout/hooks/useSortPspBottomSheet.tsx +++ b/ts/features/payments/checkout/hooks/useSortPspBottomSheet.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { useState } from "react"; import { RadioGroup, RadioItem } from "@pagopa/io-app-design-system"; import { useIOBottomSheetAutoresizableModal } from "../../../../utils/hooks/bottomSheet"; import { WalletPaymentPspSortType } from "../types"; @@ -30,8 +30,7 @@ type WalletPaymentSortPspBottomSheetProps = { const useSortPspBottomSheet = ({ onSortChange }: WalletPaymentSortPspBottomSheetProps) => { - const [sortType, setSortType] = - React.useState("default"); + const [sortType, setSortType] = useState("default"); const handleChangeSort = (sortType: WalletPaymentPspSortType) => { setSortType(sortType); diff --git a/ts/features/payments/checkout/hooks/useWalletPaymentAuthorizationModal.tsx b/ts/features/payments/checkout/hooks/useWalletPaymentAuthorizationModal.tsx index 5aab883cdda..ae80e4c1ce8 100644 --- a/ts/features/payments/checkout/hooks/useWalletPaymentAuthorizationModal.tsx +++ b/ts/features/payments/checkout/hooks/useWalletPaymentAuthorizationModal.tsx @@ -3,7 +3,7 @@ import * as pot from "@pagopa/ts-commons/lib/pot"; import * as E from "fp-ts/lib/Either"; import * as TE from "fp-ts/lib/TaskEither"; import { pipe } from "fp-ts/lib/function"; -import * as React from "react"; +import { useState, useCallback, useEffect } from "react"; import URLParse from "url-parse"; import { useIODispatch, useIOSelector } from "../../../../store/hooks"; import { WALLET_WEBVIEW_OUTCOME_SCHEMA } from "../../common/utils/const"; @@ -38,11 +38,11 @@ export const useWalletPaymentAuthorizationModal = ({ walletPaymentAuthorizationUrlSelector ); const [isPendingAuthorization, setIsPendingAuthorization] = - React.useState(false); + useState(false); const isLoading = pot.isLoading(authorizationUrlPot); const isError = pot.isError(authorizationUrlPot); - const handleAuthorizationOutcome = React.useCallback( + const handleAuthorizationOutcome = useCallback( (outcome: WalletPaymentOutcome) => { onAuthorizationOutcome(outcome); dispatch(storePaymentOutcomeToHistory(outcome)); @@ -50,7 +50,7 @@ export const useWalletPaymentAuthorizationModal = ({ [onAuthorizationOutcome, dispatch] ); - const handleAuthorizationResult = React.useCallback( + const handleAuthorizationResult = useCallback( (resultUrl: string) => { const outcome = pipe( new URLParse(resultUrl, true), @@ -63,7 +63,7 @@ export const useWalletPaymentAuthorizationModal = ({ [handleAuthorizationOutcome] ); - React.useEffect(() => { + useEffect(() => { if (isPendingAuthorization) { return; } @@ -100,7 +100,7 @@ export const useWalletPaymentAuthorizationModal = ({ dispatch ]); - React.useEffect( + useEffect( () => () => { setIsPendingAuthorization(false); dispatch(paymentsStartPaymentAuthorizationAction.cancel()); diff --git a/ts/features/payments/checkout/navigation/navigator.tsx b/ts/features/payments/checkout/navigation/navigator.tsx index 9d631a6b1cf..a3e1b6d1660 100644 --- a/ts/features/payments/checkout/navigation/navigator.tsx +++ b/ts/features/payments/checkout/navigation/navigator.tsx @@ -3,7 +3,6 @@ import { createStackNavigator, StackNavigationProp } from "@react-navigation/stack"; -import React from "react"; import { isGestureEnabled } from "../../../../utils/navigation"; import { WalletPaymentDetailScreen } from "../screens/WalletPaymentDetailScreen"; import { WalletPaymentFailureScreen } from "../screens/WalletPaymentFailureScreen"; diff --git a/ts/features/payments/checkout/screens/WalletPaymentConfirmScreen.tsx b/ts/features/payments/checkout/screens/WalletPaymentConfirmScreen.tsx index 10d92a17d22..5effa574299 100644 --- a/ts/features/payments/checkout/screens/WalletPaymentConfirmScreen.tsx +++ b/ts/features/payments/checkout/screens/WalletPaymentConfirmScreen.tsx @@ -10,7 +10,7 @@ import { useFocusEffect } from "@react-navigation/native"; import { sequenceS } from "fp-ts/lib/Apply"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import { default as React } from "react"; +import { useCallback, useEffect } from "react"; import { AmountEuroCents } from "../../../../../definitions/pagopa/ecommerce/AmountEuroCents"; import { IOScrollView } from "../../../../components/ui/IOScrollView"; import I18n from "../../../../i18n"; @@ -119,7 +119,7 @@ const WalletPaymentConfirmScreen = () => { }) ); - const handleAuthorizationOutcome = React.useCallback( + const handleAuthorizationOutcome = useCallback( (outcome: WalletPaymentOutcome) => { navigation.replace(PaymentsCheckoutRoutes.PAYMENT_CHECKOUT_NAVIGATOR, { screen: PaymentsCheckoutRoutes.PAYMENT_CHECKOUT_OUTCOME, @@ -143,14 +143,14 @@ const WalletPaymentConfirmScreen = () => { const isLoading = isAuthUrlLoading || isPendingAuthorization; const isError = isAuthUrlError; - React.useEffect(() => { + useEffect(() => { if (isError) { handleAuthorizationOutcome(WalletPaymentOutcomeEnum.AUTH_REQUEST_ERROR); } }, [isError, handleAuthorizationOutcome]); useFocusEffect( - React.useCallback(() => { + useCallback(() => { if (currentStep !== WalletPaymentStepEnum.CONFIRM_TRANSACTION) { return; } diff --git a/ts/features/payments/checkout/screens/WalletPaymentDetailScreen.tsx b/ts/features/payments/checkout/screens/WalletPaymentDetailScreen.tsx index a9aaac50f71..9d5b0f300a2 100644 --- a/ts/features/payments/checkout/screens/WalletPaymentDetailScreen.tsx +++ b/ts/features/payments/checkout/screens/WalletPaymentDetailScreen.tsx @@ -20,7 +20,7 @@ import { } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React, { ComponentProps, useLayoutEffect } from "react"; +import { useCallback, ComponentProps, useLayoutEffect } from "react"; import { SafeAreaView, StyleSheet } from "react-native"; import { OrganizationFiscalCode } from "../../../../../definitions/backend/OrganizationFiscalCode"; import { PaymentRequestsGetResponse } from "../../../../../definitions/pagopa/ecommerce/PaymentRequestsGetResponse"; @@ -81,7 +81,7 @@ const WalletPaymentDetailScreen = () => { const paymentDetailsPot = useIOSelector(walletPaymentDetailsSelector); useFocusEffect( - React.useCallback(() => { + useCallback(() => { dispatch(paymentsGetPaymentDetailsAction.request(rptId)); }, [dispatch, rptId]) ); diff --git a/ts/features/payments/checkout/screens/WalletPaymentFailureScreen.tsx b/ts/features/payments/checkout/screens/WalletPaymentFailureScreen.tsx index 42fae8efdcd..638ec1b2389 100644 --- a/ts/features/payments/checkout/screens/WalletPaymentFailureScreen.tsx +++ b/ts/features/payments/checkout/screens/WalletPaymentFailureScreen.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; import { RouteProp, useRoute } from "@react-navigation/native"; diff --git a/ts/features/payments/checkout/screens/WalletPaymentInputFiscalCodeScreen.tsx b/ts/features/payments/checkout/screens/WalletPaymentInputFiscalCodeScreen.tsx index 0d05bf0a4c0..cb2c674b97f 100644 --- a/ts/features/payments/checkout/screens/WalletPaymentInputFiscalCodeScreen.tsx +++ b/ts/features/payments/checkout/screens/WalletPaymentInputFiscalCodeScreen.tsx @@ -16,7 +16,7 @@ import { RouteProp, useNavigation, useRoute } from "@react-navigation/native"; import { sequenceS } from "fp-ts/lib/Apply"; import * as O from "fp-ts/lib/Option"; import { flow, pipe } from "fp-ts/lib/function"; -import React from "react"; +import { useState, useRef } from "react"; import { Keyboard, KeyboardAvoidingView, @@ -62,12 +62,12 @@ const WalletPaymentInputFiscalCodeScreen = () => { const { startPaymentFlowWithRptId } = usePagoPaPayment(); - const [inputState, setInputState] = React.useState({ + const [inputState, setInputState] = useState({ fiscalCodeText: "", fiscalCode: O.none }); - const textInputWrappperRef = React.useRef(null); + const textInputWrappperRef = useRef(null); const focusTextInput = () => { setAccessibilityFocus(textInputWrappperRef); }; diff --git a/ts/features/payments/checkout/screens/WalletPaymentInputNoticeNumberScreen.tsx b/ts/features/payments/checkout/screens/WalletPaymentInputNoticeNumberScreen.tsx index f78d7bf8940..ad0a2c9f17a 100644 --- a/ts/features/payments/checkout/screens/WalletPaymentInputNoticeNumberScreen.tsx +++ b/ts/features/payments/checkout/screens/WalletPaymentInputNoticeNumberScreen.tsx @@ -11,7 +11,7 @@ import { PaymentNoticeNumberFromString } from "@pagopa/io-pagopa-commons/lib/pag import { useNavigation } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; +import { useState, useRef } from "react"; import { Keyboard, KeyboardAvoidingView, @@ -46,7 +46,7 @@ const MAX_LENGTH_NOTICE_NUMBER = 18; const WalletPaymentInputNoticeNumberScreen = () => { const navigation = useNavigation>(); - const [inputState, setInputState] = React.useState({ + const [inputState, setInputState] = useState({ noticeNumberText: "", noticeNumber: O.none }); @@ -79,7 +79,7 @@ const WalletPaymentInputNoticeNumberScreen = () => { analytics.trackPaymentNoticeDataEntry(); }); - const textInputWrappperRef = React.useRef(null); + const textInputWrappperRef = useRef(null); return ( diff --git a/ts/features/payments/checkout/screens/WalletPaymentMakeScreen.tsx b/ts/features/payments/checkout/screens/WalletPaymentMakeScreen.tsx index e3ca4ab3ee0..1582c2f7ee8 100644 --- a/ts/features/payments/checkout/screens/WalletPaymentMakeScreen.tsx +++ b/ts/features/payments/checkout/screens/WalletPaymentMakeScreen.tsx @@ -1,5 +1,5 @@ import { IOStyles } from "@pagopa/io-app-design-system"; -import React, { useLayoutEffect } from "react"; +import { useRef, useEffect, useLayoutEffect } from "react"; import { View } from "react-native"; import PagerView from "react-native-pager-view"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; @@ -12,10 +12,10 @@ import { WalletPaymentPickPspScreen } from "./WalletPaymentPickPspScreen"; const WalletPaymentMakeScreen = () => { const navigation = useIONavigation(); - const ref = React.useRef(null); + const ref = useRef(null); const currentStep = useIOSelector(selectWalletPaymentCurrentStep); - React.useEffect(() => { + useEffect(() => { ref.current?.setPage(currentStep - 1); }, [ref, currentStep]); diff --git a/ts/features/payments/checkout/screens/WalletPaymentOutcomeScreen.tsx b/ts/features/payments/checkout/screens/WalletPaymentOutcomeScreen.tsx index 1e83c8288b9..5bc6c5a13ed 100644 --- a/ts/features/payments/checkout/screens/WalletPaymentOutcomeScreen.tsx +++ b/ts/features/payments/checkout/screens/WalletPaymentOutcomeScreen.tsx @@ -2,7 +2,7 @@ import * as pot from "@pagopa/ts-commons/lib/pot"; import { RouteProp, useRoute } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; +import { useEffect } from "react"; import { OperationResultScreenContent, OperationResultScreenContentProps @@ -83,7 +83,7 @@ const WalletPaymentOutcomeScreen = () => { // TODO: This is a workaround to disable swipe back gesture on this screen // .. it should be removed as soon as the migration to react-navigation v6 is completed (https://pagopa.atlassian.net/browse/IOBP-522) - React.useEffect(() => { + useEffect(() => { // Disable swipe if not in the payment methods not available outcome if (outcome === WalletPaymentOutcomeEnum.PAYMENT_METHODS_NOT_AVAILABLE) { return; diff --git a/ts/features/payments/checkout/screens/WalletPaymentPickMethodScreen.tsx b/ts/features/payments/checkout/screens/WalletPaymentPickMethodScreen.tsx index f1aeb23d4a4..fd78b8c9484 100644 --- a/ts/features/payments/checkout/screens/WalletPaymentPickMethodScreen.tsx +++ b/ts/features/payments/checkout/screens/WalletPaymentPickMethodScreen.tsx @@ -4,7 +4,7 @@ import { useFocusEffect } from "@react-navigation/native"; import { sequenceT } from "fp-ts/lib/Apply"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; +import { useState, useCallback, useEffect } from "react"; import { IOScrollView } from "../../../../components/ui/IOScrollView"; import I18n from "../../../../i18n"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; @@ -67,10 +67,10 @@ const WalletPaymentPickMethodScreen = () => { walletPaymentSelectedPaymentMethodIdOptionSelector ); const [waitingTransactionActivation, setWaitingTransactionActivation] = - React.useState(false); + useState(false); useFocusEffect( - React.useCallback(() => { + useCallback(() => { dispatch( paymentsGetPaymentMethodsAction.request({ amount: pot.toUndefined(pot.map(paymentDetailsPot, el => el.amount)) @@ -83,7 +83,7 @@ const WalletPaymentPickMethodScreen = () => { dispatch(paymentsGetRecentPaymentMethodUsedAction.request()); }); - const calculateFeesForSelectedPaymentMethod = React.useCallback(() => { + const calculateFeesForSelectedPaymentMethod = useCallback(() => { pipe( sequenceT(O.Monad)( pot.toOption(paymentAmountPot), @@ -158,7 +158,7 @@ const WalletPaymentPickMethodScreen = () => { pot.isError(userWalletsPots) || pot.isError(pspListPot); - const getFirstPotError = React.useCallback(() => { + const getFirstPotError = useCallback(() => { if (pot.isError(transactionPot)) { return transactionPot.error; } @@ -197,7 +197,7 @@ const WalletPaymentPickMethodScreen = () => { () => !isLoading && !!paymentAnalyticsData ); - React.useEffect(() => { + useEffect(() => { if (isError) { const error = getFirstPotError(); navigation.replace(PaymentsCheckoutRoutes.PAYMENT_CHECKOUT_NAVIGATOR, { diff --git a/ts/features/payments/checkout/screens/WalletPaymentPickPspScreen.tsx b/ts/features/payments/checkout/screens/WalletPaymentPickPspScreen.tsx index e57dd8b0ba2..31fce333352 100644 --- a/ts/features/payments/checkout/screens/WalletPaymentPickPspScreen.tsx +++ b/ts/features/payments/checkout/screens/WalletPaymentPickPspScreen.tsx @@ -11,7 +11,7 @@ import * as pot from "@pagopa/ts-commons/lib/pot"; import { useFocusEffect } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React from "react"; +import { useState, useEffect, useCallback, useMemo } from "react"; import { Bundle } from "../../../../../definitions/pagopa/ecommerce/Bundle"; import I18n from "../../../../i18n"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; @@ -41,7 +41,7 @@ const WalletPaymentPickPspScreen = () => { const navigation = useIONavigation(); const currentStep = useIOSelector(selectWalletPaymentCurrentStep); - const [showFeaturedPsp, setShowFeaturedPsp] = React.useState(true); + const [showFeaturedPsp, setShowFeaturedPsp] = useState(true); const pspListPot = useIOSelector(walletPaymentPspListSelector); const selectedPspOption = useIOSelector(walletPaymentSelectedPspSelector); @@ -72,7 +72,7 @@ const WalletPaymentPickPspScreen = () => { O.toUndefined ); - React.useEffect(() => { + useEffect(() => { if ( isError && (pspListPot.error as WalletPaymentFailure)?.faultCodeCategory === @@ -88,7 +88,7 @@ const WalletPaymentPickPspScreen = () => { }, [isError, navigation, pspListPot]); useFocusEffect( - React.useCallback(() => { + useCallback(() => { if ( !pot.isSome(pspListPot) || pot.isLoading(pspListPot) || @@ -115,7 +115,7 @@ const WalletPaymentPickPspScreen = () => { }, [pspListPot]) ); - const handlePspSelection = React.useCallback( + const handlePspSelection = useCallback( (bundleId: string) => { if (!sortedPspList) { return; @@ -150,7 +150,7 @@ const WalletPaymentPickPspScreen = () => { ); }; - const sortButtonProps: ListItemHeader["endElement"] = React.useMemo( + const sortButtonProps: ListItemHeader["endElement"] = useMemo( () => ({ type: "buttonLink", componentProps: { @@ -164,7 +164,7 @@ const WalletPaymentPickPspScreen = () => { const pspSelected = pipe(selectedPspOption, O.toUndefined); - const SelectPspHeadingContent = React.useCallback( + const SelectPspHeadingContent = useCallback( () => ( <>

{I18n.t("wallet.payment.psp.title")}

diff --git a/ts/features/payments/checkout/screens/__tests__/WalletPaymentDetailScreen.test.tsx b/ts/features/payments/checkout/screens/__tests__/WalletPaymentDetailScreen.test.tsx index 2b28ddc0703..c45c1f3751a 100644 --- a/ts/features/payments/checkout/screens/__tests__/WalletPaymentDetailScreen.test.tsx +++ b/ts/features/payments/checkout/screens/__tests__/WalletPaymentDetailScreen.test.tsx @@ -1,5 +1,4 @@ import { View } from "react-native"; -import React from "react"; import { fireEvent } from "@testing-library/react-native"; import { createStore } from "redux"; import configureMockStore from "redux-mock-store"; diff --git a/ts/features/payments/common/components/PaymentCard.tsx b/ts/features/payments/common/components/PaymentCard.tsx index 700b8c4f661..131ba4ddb25 100644 --- a/ts/features/payments/common/components/PaymentCard.tsx +++ b/ts/features/payments/common/components/PaymentCard.tsx @@ -8,7 +8,6 @@ import { } from "@pagopa/io-app-design-system"; import { format } from "date-fns"; import { capitalize } from "lodash"; -import React from "react"; import { StyleSheet, View } from "react-native"; import Placeholder, { BoxProps } from "rn-placeholder"; import BPayLogo from "../../../../../img/wallet/payment-methods/bpay_logo_full.svg"; diff --git a/ts/features/payments/common/components/PaymentCardSmall.tsx b/ts/features/payments/common/components/PaymentCardSmall.tsx index 7ba6922e333..25eee810b4a 100644 --- a/ts/features/payments/common/components/PaymentCardSmall.tsx +++ b/ts/features/payments/common/components/PaymentCardSmall.tsx @@ -5,7 +5,7 @@ import { LabelMini, VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; +import { useMemo } from "react"; import { StyleSheet, View } from "react-native"; import Placeholder from "rn-placeholder"; import { LogoPaymentWithFallback } from "../../../../components/ui/utils/components/LogoPaymentWithFallback"; @@ -27,7 +27,7 @@ const PaymentCardSmall = ({ accessibilityLabel, ...props }: PaymentCardSmallProps) => { - const labelText = React.useMemo(() => { + const labelText = useMemo(() => { if (props.hpan) { return `•••• ${props.hpan}`; } @@ -47,7 +47,7 @@ const PaymentCardSmall = ({ return props.brand; }, [props]); - const iconName = React.useMemo(() => { + const iconName = useMemo(() => { if (props.holderEmail) { return "paypal"; } diff --git a/ts/features/payments/common/components/__tests__/PaymentCard.test.tsx b/ts/features/payments/common/components/__tests__/PaymentCard.test.tsx index 39de6b1a196..7fdf4f4a2fe 100644 --- a/ts/features/payments/common/components/__tests__/PaymentCard.test.tsx +++ b/ts/features/payments/common/components/__tests__/PaymentCard.test.tsx @@ -1,6 +1,5 @@ import { render } from "@testing-library/react-native"; import { format } from "date-fns"; -import { default as React } from "react"; import I18n from "../../../../../i18n"; import { PaymentCard } from "../PaymentCard"; diff --git a/ts/features/payments/common/components/__tests__/PaymentCardSmall.test.tsx b/ts/features/payments/common/components/__tests__/PaymentCardSmall.test.tsx index 8dedf23ecd1..623e2c1fb33 100644 --- a/ts/features/payments/common/components/__tests__/PaymentCardSmall.test.tsx +++ b/ts/features/payments/common/components/__tests__/PaymentCardSmall.test.tsx @@ -1,4 +1,3 @@ -import { default as React } from "react"; import { createStore } from "redux"; import ROUTES from "../../../../../navigation/routes"; import { applicationChangeState } from "../../../../../store/actions/application"; diff --git a/ts/features/payments/common/components/utils/BankLogoOrLoadingSkeleton.tsx b/ts/features/payments/common/components/utils/BankLogoOrLoadingSkeleton.tsx index a8b9731f0b9..f744729cc4f 100644 --- a/ts/features/payments/common/components/utils/BankLogoOrLoadingSkeleton.tsx +++ b/ts/features/payments/common/components/utils/BankLogoOrLoadingSkeleton.tsx @@ -1,5 +1,5 @@ import { IOColors } from "@pagopa/io-app-design-system"; -import * as React from "react"; +import { useState, useEffect } from "react"; import { Image } from "react-native"; import Placeholder from "rn-placeholder"; import { getBankLogosCdnUri } from "../../../../../components/ui/utils/strings"; @@ -24,10 +24,10 @@ export const BankLogoOrSkeleton = ({ placeHolderColor = "grey-200", imageA11yLabel }: BankLogoOrSkeletonProps) => { - const [imageUrl, setImageUrl] = React.useState(undefined); + const [imageUrl, setImageUrl] = useState(undefined); const { height, width: maxWidth } = dimensions; - const [width, setWidth] = React.useState(maxWidth); - React.useEffect(() => { + const [width, setWidth] = useState(maxWidth); + useEffect(() => { // we pre-fetch the image to avoid having to render both items // at the same time, which looks like an untidy hack if (abiCode === undefined) { diff --git a/ts/features/payments/details/components/PaymentsMethodDetailsBaseScreenComponent.tsx b/ts/features/payments/details/components/PaymentsMethodDetailsBaseScreenComponent.tsx index f5990dbf38d..fcd566ca0fa 100644 --- a/ts/features/payments/details/components/PaymentsMethodDetailsBaseScreenComponent.tsx +++ b/ts/features/payments/details/components/PaymentsMethodDetailsBaseScreenComponent.tsx @@ -6,22 +6,23 @@ import { useIOTheme, VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; + +import { PropsWithChildren, useState } from "react"; +import { LayoutChangeEvent, StyleSheet, View } from "react-native"; import Animated, { useAnimatedRef, useAnimatedScrollHandler, useSharedValue } from "react-native-reanimated"; import { useSafeAreaInsets } from "react-native-safe-area-context"; -import { LayoutChangeEvent, StyleSheet, View } from "react-native"; import FocusAwareStatusBar from "../../../../components/ui/FocusAwareStatusBar"; +import { useHeaderSecondLevel } from "../../../../hooks/useHeaderSecondLevel"; import { useIOSelector } from "../../../../store/hooks"; import { isDesignSystemEnabledSelector } from "../../../../store/reducers/persistedPreferences"; import { PaymentCard, PaymentCardComponentProps } from "../../common/components/PaymentCard"; -import { useHeaderSecondLevel } from "../../../../hooks/useHeaderSecondLevel"; type Props = { card: PaymentCardComponentProps; @@ -35,11 +36,11 @@ const PaymentsMethodDetailsBaseScreenComponent = ({ card, headerTitle = "", children -}: React.PropsWithChildren) => { +}: PropsWithChildren) => { const isDSenabled = useIOSelector(isDesignSystemEnabledSelector); const insets = useSafeAreaInsets(); const translationY = useSharedValue(0); - const [titleHeight, setTitleHeight] = React.useState(0); + const [titleHeight, setTitleHeight] = useState(0); const theme = useIOTheme(); const backgroundColor = IOColors[theme["appBackground-primary"]]; diff --git a/ts/features/payments/details/components/PaymentsMethodDetailsDeleteButton.tsx b/ts/features/payments/details/components/PaymentsMethodDetailsDeleteButton.tsx index 560bcc219d1..738cc69c5e5 100644 --- a/ts/features/payments/details/components/PaymentsMethodDetailsDeleteButton.tsx +++ b/ts/features/payments/details/components/PaymentsMethodDetailsDeleteButton.tsx @@ -1,5 +1,4 @@ import { IOToast, ListItemAction } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { Alert, Platform } from "react-native"; import { WalletInfo } from "../../../../../definitions/pagopa/walletv3/WalletInfo"; import I18n from "../../../../i18n"; diff --git a/ts/features/payments/details/components/PaymentsMethodDetailsErrorContent.tsx b/ts/features/payments/details/components/PaymentsMethodDetailsErrorContent.tsx index 3c3b21acc58..9cebdb65548 100644 --- a/ts/features/payments/details/components/PaymentsMethodDetailsErrorContent.tsx +++ b/ts/features/payments/details/components/PaymentsMethodDetailsErrorContent.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; import I18n from "../../../../i18n"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; diff --git a/ts/features/payments/details/components/PaymentsMethodPspDetailsAlert.tsx b/ts/features/payments/details/components/PaymentsMethodPspDetailsAlert.tsx index bc0b0dd3c97..3a342f3862d 100644 --- a/ts/features/payments/details/components/PaymentsMethodPspDetailsAlert.tsx +++ b/ts/features/payments/details/components/PaymentsMethodPspDetailsAlert.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { Alert, VSpacer } from "@pagopa/io-app-design-system"; import Animated, { LinearTransition } from "react-native-reanimated"; import I18n from "../../../../i18n"; diff --git a/ts/features/payments/details/components/PaymentsMethodPspDetailsBottomSheet.tsx b/ts/features/payments/details/components/PaymentsMethodPspDetailsBottomSheet.tsx index 82a2488f190..1f0a6c72612 100644 --- a/ts/features/payments/details/components/PaymentsMethodPspDetailsBottomSheet.tsx +++ b/ts/features/payments/details/components/PaymentsMethodPspDetailsBottomSheet.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { VSpacer, Body } from "@pagopa/io-app-design-system"; import I18n from "../../../../i18n"; import { useIOBottomSheetAutoresizableModal } from "../../../../utils/hooks/bottomSheet"; diff --git a/ts/features/payments/details/components/PaymentsMethodPspPayPalBanner.tsx b/ts/features/payments/details/components/PaymentsMethodPspPayPalBanner.tsx index 37aae35c315..16a2d8569b8 100644 --- a/ts/features/payments/details/components/PaymentsMethodPspPayPalBanner.tsx +++ b/ts/features/payments/details/components/PaymentsMethodPspPayPalBanner.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { useRef } from "react"; import { VSpacer, Banner } from "@pagopa/io-app-design-system"; import Animated, { FadeOut } from "react-native-reanimated"; @@ -8,7 +8,7 @@ import { paymentsPayPalBannerSetIsClosedAction } from "../store/actions"; import { walletPayPalBannerClosedSelector } from "../store/selectors"; const PaymentsMethodPspPayPalBanner = () => { - const bannerViewRef = React.useRef(null); + const bannerViewRef = useRef(null); const dispatch = useIODispatch(); const bannerClosed = useIOSelector(walletPayPalBannerClosedSelector); diff --git a/ts/features/payments/details/components/WalletDetailsPagoPaPaymentCapability.tsx b/ts/features/payments/details/components/WalletDetailsPagoPaPaymentCapability.tsx index d404890d0b7..4db7318f876 100644 --- a/ts/features/payments/details/components/WalletDetailsPagoPaPaymentCapability.tsx +++ b/ts/features/payments/details/components/WalletDetailsPagoPaPaymentCapability.tsx @@ -1,5 +1,6 @@ import { IOToast, ListItemSwitch } from "@pagopa/io-app-design-system"; -import * as React from "react"; + +import { FC, useState } from "react"; import { WalletInfo } from "../../../../../definitions/pagopa/walletv3/WalletInfo"; import I18n from "../../../../i18n"; import { useIODispatch } from "../../../../store/hooks"; @@ -12,9 +13,9 @@ type Props = { paymentMethod: WalletInfo }; * Represent the capability to pay in PagoPa of a payment method. * @param props */ -const WalletDetailsPagoPaPaymentCapability: React.FC = props => { +const WalletDetailsPagoPaPaymentCapability: FC = props => { const dispatch = useIODispatch(); - const [loading, setLoading] = React.useState(false); + const [loading, setLoading] = useState(false); const handleSwitchSuccess = () => { setLoading(false); diff --git a/ts/features/payments/details/components/WalletDetailsPaymentMethodFeatures.tsx b/ts/features/payments/details/components/WalletDetailsPaymentMethodFeatures.tsx index 81610155361..bb09e5ff736 100644 --- a/ts/features/payments/details/components/WalletDetailsPaymentMethodFeatures.tsx +++ b/ts/features/payments/details/components/WalletDetailsPaymentMethodFeatures.tsx @@ -1,5 +1,4 @@ import { Alert } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { WalletInfo } from "../../../../../definitions/pagopa/walletv3/WalletInfo"; import I18n from "../../../../i18n"; import { useIOSelector } from "../../../../store/hooks"; diff --git a/ts/features/payments/details/components/WalletDetailsPaymentMethodInitiatives.tsx b/ts/features/payments/details/components/WalletDetailsPaymentMethodInitiatives.tsx index 2c1bbd4a512..2d1441c7418 100644 --- a/ts/features/payments/details/components/WalletDetailsPaymentMethodInitiatives.tsx +++ b/ts/features/payments/details/components/WalletDetailsPaymentMethodInitiatives.tsx @@ -1,6 +1,7 @@ import { Body, H6, IOStyles, VSpacer } from "@pagopa/io-app-design-system"; import { useFocusEffect, useNavigation } from "@react-navigation/native"; -import * as React from "react"; + +import { ComponentProps, ReactElement, useCallback } from "react"; import { View } from "react-native"; import { WalletInfo } from "../../../../../definitions/pagopa/walletv3/WalletInfo"; import I18n from "../../../../i18n"; @@ -17,7 +18,7 @@ import { idPayEnabledInitiativesFromInstrumentSelector } from "../../../idpay/wa type Props = { paymentMethod: WalletInfo; -} & Pick, "style">; +} & Pick, "style">; /** * This component enlists the different initiatives active on the payment methods @@ -26,13 +27,13 @@ type Props = { */ const WalletDetailsPaymentMethodInitiatives = ( props: Props -): React.ReactElement | null => { +): ReactElement | null => { const navigation = useNavigation>(); const idWalletString = props.paymentMethod.walletId; const dispatch = useIODispatch(); - const startInitiativeRefreshPolling = React.useCallback(() => { + const startInitiativeRefreshPolling = useCallback(() => { dispatch( idPayInitiativesFromInstrumentRefreshStart({ idWallet: idWalletString diff --git a/ts/features/payments/details/components/WalletDetailsPaymentMethodSettings.tsx b/ts/features/payments/details/components/WalletDetailsPaymentMethodSettings.tsx index 6f29a7fdec2..ef72aa506c7 100644 --- a/ts/features/payments/details/components/WalletDetailsPaymentMethodSettings.tsx +++ b/ts/features/payments/details/components/WalletDetailsPaymentMethodSettings.tsx @@ -1,5 +1,6 @@ import { Divider, ListItemHeader } from "@pagopa/io-app-design-system"; -import * as React from "react"; + +import { ReactElement } from "react"; import { WalletInfo } from "../../../../../definitions/pagopa/walletv3/WalletInfo"; import I18n from "../../../../i18n"; import WalletDetailsPagoPaPaymentCapability from "./WalletDetailsPagoPaPaymentCapability"; @@ -11,9 +12,7 @@ type Props = { paymentMethod: WalletInfo }; * @param props * @constructor */ -const WalletDetailsPaymentMethodSettings = ( - props: Props -): React.ReactElement => ( +const WalletDetailsPaymentMethodSettings = (props: Props): ReactElement => ( <> diff --git a/ts/features/payments/details/navigation/navigator.tsx b/ts/features/payments/details/navigation/navigator.tsx index 5a56761c0c7..e2692c01069 100644 --- a/ts/features/payments/details/navigation/navigator.tsx +++ b/ts/features/payments/details/navigation/navigator.tsx @@ -3,7 +3,6 @@ import { createStackNavigator, StackNavigationProp } from "@react-navigation/stack"; -import React from "react"; import { isGestureEnabled } from "../../../../utils/navigation"; import PaymentsMethodDetailsScreen from "../screens/PaymentsMethodDetailsScreen"; import { PaymentsMethodDetailsParamsList } from "./params"; diff --git a/ts/features/payments/details/screens/PaymentsMethodDetailsScreen.tsx b/ts/features/payments/details/screens/PaymentsMethodDetailsScreen.tsx index 4d61fc60200..8862420c633 100644 --- a/ts/features/payments/details/screens/PaymentsMethodDetailsScreen.tsx +++ b/ts/features/payments/details/screens/PaymentsMethodDetailsScreen.tsx @@ -1,7 +1,7 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; import { RouteProp, useRoute } from "@react-navigation/native"; -import * as React from "react"; +import { useEffect } from "react"; import { useIODispatch, useIOSelector } from "../../../../store/hooks"; import { isIdPayEnabledSelector } from "../../../../store/reducers/backendStatus/remoteConfig"; import { capitalize } from "../../../../utils/strings"; @@ -44,7 +44,7 @@ const PaymentsMethodDetailsScreen = () => { pot.isUpdating(walletDetailsPot) || areIdpayInitiativesLoading; - React.useEffect(() => { + useEffect(() => { dispatch(paymentsGetMethodDetailsAction.request({ walletId })); if (isIdpayEnabled) { dispatch( diff --git a/ts/features/payments/home/components/PaymentsAlertStatus.tsx b/ts/features/payments/home/components/PaymentsAlertStatus.tsx index c0da4e2739d..8b8bd813fcd 100644 --- a/ts/features/payments/home/components/PaymentsAlertStatus.tsx +++ b/ts/features/payments/home/components/PaymentsAlertStatus.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { constVoid } from "fp-ts/lib/function"; import { Alert } from "@pagopa/io-app-design-system"; import Animated, { FadeIn, FadeOut, Layout } from "react-native-reanimated"; diff --git a/ts/features/payments/home/components/PaymentsCardsCarousel.tsx b/ts/features/payments/home/components/PaymentsCardsCarousel.tsx index ecc88d5f996..cb8c5af67f8 100644 --- a/ts/features/payments/home/components/PaymentsCardsCarousel.tsx +++ b/ts/features/payments/home/components/PaymentsCardsCarousel.tsx @@ -3,7 +3,6 @@ import { IOSpacingScale, IOVisualCostants } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { FlatListProps, StyleSheet } from "react-native"; import { FlatList } from "react-native-gesture-handler"; import { WithTestID } from "../../../../types/WithTestID"; diff --git a/ts/features/payments/home/components/PaymentsHomeEmptyScreenContent.tsx b/ts/features/payments/home/components/PaymentsHomeEmptyScreenContent.tsx index 52661ed349e..249dd2aebf3 100644 --- a/ts/features/payments/home/components/PaymentsHomeEmptyScreenContent.tsx +++ b/ts/features/payments/home/components/PaymentsHomeEmptyScreenContent.tsx @@ -6,7 +6,6 @@ import { Pictogram, VSpacer } from "@pagopa/io-app-design-system"; -import React from "react"; import { StyleSheet, View } from "react-native"; import I18n from "../../../../i18n"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; diff --git a/ts/features/payments/home/components/PaymentsHomeTransactionsList.tsx b/ts/features/payments/home/components/PaymentsHomeTransactionsList.tsx index 6b506341448..061e086a21f 100644 --- a/ts/features/payments/home/components/PaymentsHomeTransactionsList.tsx +++ b/ts/features/payments/home/components/PaymentsHomeTransactionsList.tsx @@ -5,7 +5,7 @@ import { ListItemTransaction } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; -import * as React from "react"; +import { useEffect, useCallback, Fragment } from "react"; import { View } from "react-native"; import Animated, { LinearTransition } from "react-native-reanimated"; import { NoticeListItem } from "../../../../../definitions/pagopa/biz-events/NoticeListItem"; @@ -55,7 +55,7 @@ const PaymentsHomeTransactionsList = ({ enforcedLoadingState }: Props) => { } }); - React.useEffect(() => { + useEffect(() => { if ( pot.isSome(latestTransactionsPot) && !pot.isLoading(latestTransactionsPot) @@ -66,7 +66,7 @@ const PaymentsHomeTransactionsList = ({ enforcedLoadingState }: Props) => { } }, [dispatch, latestTransactionsPot]); - const handleNavigateToTransactionDetails = React.useCallback( + const handleNavigateToTransactionDetails = useCallback( ({ eventId, isPayer }: NoticeListItem) => { if (eventId === undefined) { return; @@ -100,7 +100,7 @@ const PaymentsHomeTransactionsList = ({ enforcedLoadingState }: Props) => { return ( {latestTransactionsPot.value.map((latestTransaction, index) => ( - + @@ -109,7 +109,7 @@ const PaymentsHomeTransactionsList = ({ enforcedLoadingState }: Props) => { transaction={latestTransaction} /> {index < latestTransactionsPot.value.length - 1 && } - + ))} ); diff --git a/ts/features/payments/home/components/PaymentsHomeUserMethodsList.tsx b/ts/features/payments/home/components/PaymentsHomeUserMethodsList.tsx index 45a276bb801..13ad6a954b4 100644 --- a/ts/features/payments/home/components/PaymentsHomeUserMethodsList.tsx +++ b/ts/features/payments/home/components/PaymentsHomeUserMethodsList.tsx @@ -5,7 +5,7 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; -import * as React from "react"; +import { createRef, useMemo, useEffect, useCallback } from "react"; import { View } from "react-native"; import * as analytics from "../analytics"; import { WalletInfo } from "../../../../../definitions/pagopa/walletv3/WalletInfo"; @@ -37,7 +37,7 @@ type Props = { const PAYMENTS_HOME_USER_METHODS_BACKOFF = "PAYMENTS_HOME_USER_METHODS_BACKOFF"; const PaymentsHomeUserMethodsList = ({ enforcedLoadingState }: Props) => { - const bannerRef = React.createRef(); + const bannerRef = createRef(); const navigation = useIONavigation(); const dispatch = useIODispatch(); @@ -51,7 +51,7 @@ const PaymentsHomeUserMethodsList = ({ enforcedLoadingState }: Props) => { const { canRetryRequest } = usePaymentsBackoffRetry( PAYMENTS_HOME_USER_METHODS_BACKOFF ); - const isError = React.useMemo( + const isError = useMemo( () => pot.isError(paymentMethodsPot) && !pot.isSome(paymentMethodsPot), [paymentMethodsPot] ); @@ -67,7 +67,7 @@ const PaymentsHomeUserMethodsList = ({ enforcedLoadingState }: Props) => { } }); - React.useEffect(() => { + useEffect(() => { if (pot.isSome(paymentMethodsPot) && !pot.isLoading(paymentMethodsPot)) { dispatch(clearPaymentsBackoffRetry(PAYMENTS_HOME_USER_METHODS_BACKOFF)); } @@ -98,7 +98,7 @@ const PaymentsHomeUserMethodsList = ({ enforcedLoadingState }: Props) => { }); }; - const handleOnRetry = React.useCallback(() => { + const handleOnRetry = useCallback(() => { if (canRetryRequest()) { dispatch(getPaymentsWalletUserMethods.request()); } @@ -111,7 +111,7 @@ const PaymentsHomeUserMethodsList = ({ enforcedLoadingState }: Props) => { }) ); - const PaymentCardsCarouselContent = React.useMemo( + const PaymentCardsCarouselContent = useMemo( () => isError ? ( { walletLatestReceiptListPotSelector ); - const [isRefreshing, setIsRefreshing] = React.useState(false); + const [isRefreshing, setIsRefreshing] = useState(false); const cannotRefresh = pot.isError(paymentMethodsPot) && pot.isNone(paymentMethodsPot) && diff --git a/ts/features/payments/onboarding/components/PaymentsOnboardingAuthErrorBottomSheet.tsx b/ts/features/payments/onboarding/components/PaymentsOnboardingAuthErrorBottomSheet.tsx index 11ecf27239d..73747685672 100644 --- a/ts/features/payments/onboarding/components/PaymentsOnboardingAuthErrorBottomSheet.tsx +++ b/ts/features/payments/onboarding/components/PaymentsOnboardingAuthErrorBottomSheet.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { VSpacer } from "@pagopa/io-app-design-system"; import { useIOBottomSheetAutoresizableModal } from "../../../../utils/hooks/bottomSheet"; import I18n from "../../../../i18n"; diff --git a/ts/features/payments/onboarding/components/WalletOnboardingPaymentMethodsList.tsx b/ts/features/payments/onboarding/components/WalletOnboardingPaymentMethodsList.tsx index 459be18b22b..5f204a9b93a 100644 --- a/ts/features/payments/onboarding/components/WalletOnboardingPaymentMethodsList.tsx +++ b/ts/features/payments/onboarding/components/WalletOnboardingPaymentMethodsList.tsx @@ -10,7 +10,6 @@ import { } from "@pagopa/io-app-design-system"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import * as React from "react"; import { FlatList } from "react-native"; import { PaymentMethodResponse } from "../../../../../definitions/pagopa/walletv3/PaymentMethodResponse"; import { useIOSelector } from "../../../../store/hooks"; diff --git a/ts/features/payments/onboarding/components/WalletPaymentMethodItemSkeleton.tsx b/ts/features/payments/onboarding/components/WalletPaymentMethodItemSkeleton.tsx index 211ac763dcf..4e1b40520d6 100644 --- a/ts/features/payments/onboarding/components/WalletPaymentMethodItemSkeleton.tsx +++ b/ts/features/payments/onboarding/components/WalletPaymentMethodItemSkeleton.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { IOListItemVisualParams, IOStyles, diff --git a/ts/features/payments/onboarding/hooks/useWalletOnboardingWebView.tsx b/ts/features/payments/onboarding/hooks/useWalletOnboardingWebView.tsx index db7cdaf2993..b468bb93342 100644 --- a/ts/features/payments/onboarding/hooks/useWalletOnboardingWebView.tsx +++ b/ts/features/payments/onboarding/hooks/useWalletOnboardingWebView.tsx @@ -3,7 +3,7 @@ import * as pot from "@pagopa/ts-commons/lib/pot"; import * as E from "fp-ts/lib/Either"; import * as TE from "fp-ts/lib/TaskEither"; import { pipe } from "fp-ts/lib/function"; -import * as React from "react"; +import { useState, useCallback, useEffect } from "react"; import URLParse from "url-parse"; import { useIODispatch, useIOSelector } from "../../../../store/hooks"; import { selectPaymentOnboardingRequestResult } from "../store/selectors"; @@ -40,11 +40,11 @@ export const useWalletOnboardingWebView = ({ const onboardingUrlPot = useIOSelector(selectPaymentOnboardingRequestResult); const [isPendingOnboarding, setIsPendingOnboarding] = - React.useState(false); + useState(false); const isLoading = pot.isLoading(onboardingUrlPot); const isError = pot.isError(onboardingUrlPot); - const handleOnboardingResult = React.useCallback( + const handleOnboardingResult = useCallback( (resultUrl: string) => { const url = new URLParse(resultUrl, true); @@ -59,7 +59,7 @@ export const useWalletOnboardingWebView = ({ [onOnboardingOutcome] ); - React.useEffect(() => { + useEffect(() => { if (isPendingOnboarding) { return; } @@ -94,7 +94,7 @@ export const useWalletOnboardingWebView = ({ dispatch ]); - React.useEffect( + useEffect( () => () => { setIsPendingOnboarding(false); dispatch(paymentsStartOnboardingAction.cancel()); diff --git a/ts/features/payments/onboarding/navigation/navigator.tsx b/ts/features/payments/onboarding/navigation/navigator.tsx index a752dc9cb02..d9a2742cade 100644 --- a/ts/features/payments/onboarding/navigation/navigator.tsx +++ b/ts/features/payments/onboarding/navigation/navigator.tsx @@ -3,7 +3,6 @@ import { createStackNavigator, StackNavigationProp } from "@react-navigation/stack"; -import React from "react"; import { isGestureEnabled } from "../../../../utils/navigation"; import { PaymentsOnboardingFeedbackScreen } from "../screens/PaymentsOnboardingFeedbackScreen"; import { PaymentsOnboardingSelectMethodScreen } from "../screens/PaymentsOnboardingSelectMethodScreen"; diff --git a/ts/features/payments/onboarding/screens/PaymentsOnboardingFeedbackScreen.tsx b/ts/features/payments/onboarding/screens/PaymentsOnboardingFeedbackScreen.tsx index 7b0dde195a4..1f27170030d 100644 --- a/ts/features/payments/onboarding/screens/PaymentsOnboardingFeedbackScreen.tsx +++ b/ts/features/payments/onboarding/screens/PaymentsOnboardingFeedbackScreen.tsx @@ -3,7 +3,7 @@ import * as pot from "@pagopa/ts-commons/lib/pot"; import { RouteProp, useNavigation, useRoute } from "@react-navigation/native"; import { pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; -import * as React from "react"; +import { useRef, useEffect } from "react"; import { View } from "react-native"; import { IOStyles } from "../../../../components/core/variables/IOStyles"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; @@ -76,7 +76,7 @@ const PaymentsOnboardingFeedbackScreen = () => { outcome, isOnboarding: true }); - const paymentMethodSelectedRef = React.useRef(); + const paymentMethodSelectedRef = useRef(); const outcomeEnumKey = Object.keys(WalletOnboardingOutcomeEnum)[ Object.values(WalletOnboardingOutcomeEnum).indexOf(outcome) @@ -91,7 +91,7 @@ const PaymentsOnboardingFeedbackScreen = () => { analytics.trackAddOnboardingPaymentMethod(outcome, payment_method_selected); }); - React.useEffect( + useEffect( () => () => { dispatch(paymentsResetRptIdToResume()); }, @@ -102,7 +102,7 @@ const PaymentsOnboardingFeedbackScreen = () => { useAvoidHardwareBackButton(); // Disables the swipe back gesture on iOS to the parent stack navigator - React.useEffect(() => { + useEffect(() => { navigation.getParent()?.setOptions({ gestureEnabled: false }); // Re-enable swipe after going back return () => { diff --git a/ts/features/payments/onboarding/screens/PaymentsOnboardingSelectMethodScreen.tsx b/ts/features/payments/onboarding/screens/PaymentsOnboardingSelectMethodScreen.tsx index 311b1bed57c..bafdf73e585 100644 --- a/ts/features/payments/onboarding/screens/PaymentsOnboardingSelectMethodScreen.tsx +++ b/ts/features/payments/onboarding/screens/PaymentsOnboardingSelectMethodScreen.tsx @@ -1,5 +1,4 @@ import * as pot from "@pagopa/ts-commons/lib/pot"; -import * as React from "react"; import { PaymentMethodResponse } from "../../../../../definitions/pagopa/walletv3/PaymentMethodResponse"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; import I18n from "../../../../i18n"; diff --git a/ts/features/payments/onboarding/screens/__tests__/PaymentsOnboardingFeedbackScreen.test.tsx b/ts/features/payments/onboarding/screens/__tests__/PaymentsOnboardingFeedbackScreen.test.tsx index 674a80dd15b..b99793ebaa4 100644 --- a/ts/features/payments/onboarding/screens/__tests__/PaymentsOnboardingFeedbackScreen.test.tsx +++ b/ts/features/payments/onboarding/screens/__tests__/PaymentsOnboardingFeedbackScreen.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import * as pot from "@pagopa/ts-commons/lib/pot"; import { fireEvent } from "@testing-library/react-native"; import configureMockStore from "redux-mock-store"; diff --git a/ts/features/payments/receipts/components/HideReceiptButton.tsx b/ts/features/payments/receipts/components/HideReceiptButton.tsx index 5a614f2062c..2aa4bf429dd 100644 --- a/ts/features/payments/receipts/components/HideReceiptButton.tsx +++ b/ts/features/payments/receipts/components/HideReceiptButton.tsx @@ -1,5 +1,4 @@ import { IOStyles, ListItemAction } from "@pagopa/io-app-design-system"; -import React from "react"; import { Alert, View } from "react-native"; import { useDispatch } from "react-redux"; import I18n from "../../../../i18n"; diff --git a/ts/features/payments/receipts/components/ReceiptCartList.tsx b/ts/features/payments/receipts/components/ReceiptCartList.tsx index 83c347f3f26..d6a1070063b 100644 --- a/ts/features/payments/receipts/components/ReceiptCartList.tsx +++ b/ts/features/payments/receipts/components/ReceiptCartList.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { View } from "react-native"; import Placeholder from "rn-placeholder"; import { diff --git a/ts/features/payments/receipts/components/ReceiptDivider.tsx b/ts/features/payments/receipts/components/ReceiptDivider.tsx index a59427928ed..16da338cdb0 100644 --- a/ts/features/payments/receipts/components/ReceiptDivider.tsx +++ b/ts/features/payments/receipts/components/ReceiptDivider.tsx @@ -1,5 +1,4 @@ import { IOColors, useIOTheme } from "@pagopa/io-app-design-system"; -import React from "react"; import Svg, { Path } from "react-native-svg"; export const ReceiptDivider = () => { diff --git a/ts/features/payments/receipts/components/ReceiptFadeInOutAnimationView.tsx b/ts/features/payments/receipts/components/ReceiptFadeInOutAnimationView.tsx index eb6b259490c..114984aac34 100644 --- a/ts/features/payments/receipts/components/ReceiptFadeInOutAnimationView.tsx +++ b/ts/features/payments/receipts/components/ReceiptFadeInOutAnimationView.tsx @@ -1,9 +1,9 @@ -import React from "react"; import { IOStyles } from "@pagopa/io-app-design-system"; +import { memo, ReactNode } from "react"; import Animated, { FadeIn, FadeOut } from "react-native-reanimated"; -export const ReceiptFadeInOutAnimationView = React.memo( - ({ children }: { children: React.ReactNode }) => ( +export const ReceiptFadeInOutAnimationView = memo( + ({ children }: { children: ReactNode }) => ( void; }; -const ReceiptListItemTransaction = React.memo( +const ReceiptListItemTransaction = memo( ({ transaction, onPress }: Props) => { const recipient = transaction.payeeName ?? ""; diff --git a/ts/features/payments/receipts/components/ReceiptLoadingList.tsx b/ts/features/payments/receipts/components/ReceiptLoadingList.tsx index 4ef4d897a41..19ff78889aa 100644 --- a/ts/features/payments/receipts/components/ReceiptLoadingList.tsx +++ b/ts/features/payments/receipts/components/ReceiptLoadingList.tsx @@ -1,5 +1,4 @@ import { ListItemTransaction, VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { View } from "react-native"; import Placeholder from "rn-placeholder"; import { ReceiptFadeInOutAnimationView } from "./ReceiptFadeInOutAnimationView"; diff --git a/ts/features/payments/receipts/components/ReceiptSectionListHeader.tsx b/ts/features/payments/receipts/components/ReceiptSectionListHeader.tsx index 7770aa29acd..fb029be02fe 100644 --- a/ts/features/payments/receipts/components/ReceiptSectionListHeader.tsx +++ b/ts/features/payments/receipts/components/ReceiptSectionListHeader.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { memo } from "react"; import { H2, VSpacer } from "@pagopa/io-app-design-system"; import { LayoutChangeEvent, View } from "react-native"; import I18n from "../../../../i18n"; @@ -11,7 +11,7 @@ type Props = { onCategorySelected: (category: ReceiptsCategoryFilter) => void; }; -export const ReceiptSectionListHeader = React.memo( +export const ReceiptSectionListHeader = memo( ({ onLayout, selectedCategory, onCategorySelected }: Props) => (

{ diff --git a/ts/features/payments/receipts/components/___tests___/ReceiptTotalAmount.test.tsx b/ts/features/payments/receipts/components/___tests___/ReceiptTotalAmount.test.tsx index c65dec2aecd..54957a535d0 100644 --- a/ts/features/payments/receipts/components/___tests___/ReceiptTotalAmount.test.tsx +++ b/ts/features/payments/receipts/components/___tests___/ReceiptTotalAmount.test.tsx @@ -1,5 +1,4 @@ import { render } from "@testing-library/react-native"; -import React from "react"; import I18n from "../../../../../i18n"; import { ReceiptTotalAmount } from "../ReceiptTotalAmount"; import { formatAmountText } from "../../utils"; diff --git a/ts/features/payments/receipts/navigation/navigator.tsx b/ts/features/payments/receipts/navigation/navigator.tsx index e0a3678d481..7ab90f1a6ec 100644 --- a/ts/features/payments/receipts/navigation/navigator.tsx +++ b/ts/features/payments/receipts/navigation/navigator.tsx @@ -3,7 +3,6 @@ import { createStackNavigator, StackNavigationProp } from "@react-navigation/stack"; -import React from "react"; import { isGestureEnabled } from "../../../../utils/navigation"; import WalletTransactionCartItemDetailsScreen from "../screens/ReceiptCartItemDetailsScreen"; import { ReceiptDetailsScreen } from "../screens/ReceiptDetailsScreen"; diff --git a/ts/features/payments/receipts/screens/ReceiptCartItemDetailsScreen.tsx b/ts/features/payments/receipts/screens/ReceiptCartItemDetailsScreen.tsx index 24da8379219..6809efaeeee 100644 --- a/ts/features/payments/receipts/screens/ReceiptCartItemDetailsScreen.tsx +++ b/ts/features/payments/receipts/screens/ReceiptCartItemDetailsScreen.tsx @@ -6,7 +6,6 @@ import { ListItemInfoCopy } from "@pagopa/io-app-design-system"; import { RouteProp, useRoute } from "@react-navigation/native"; -import * as React from "react"; import { ScrollView } from "react-native"; import { CartItem } from "../../../../../definitions/pagopa/biz-events/CartItem"; import { UserDetail } from "../../../../../definitions/pagopa/biz-events/UserDetail"; diff --git a/ts/features/payments/receipts/screens/ReceiptDetailsScreen.tsx b/ts/features/payments/receipts/screens/ReceiptDetailsScreen.tsx index 1412ba39196..2455d24c2f5 100644 --- a/ts/features/payments/receipts/screens/ReceiptDetailsScreen.tsx +++ b/ts/features/payments/receipts/screens/ReceiptDetailsScreen.tsx @@ -1,7 +1,6 @@ import { IOColors, useIOTheme, useIOToast } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; import { RouteProp, useRoute } from "@react-navigation/native"; -import * as React from "react"; import { Dimensions, StyleSheet, View } from "react-native"; import Animated, { useAnimatedRef } from "react-native-reanimated"; import { OriginEnum } from "../../../../../definitions/pagopa/biz-events/InfoNotice"; diff --git a/ts/features/payments/receipts/screens/ReceiptListScreen.tsx b/ts/features/payments/receipts/screens/ReceiptListScreen.tsx index 95d1f2d51f8..11327473b6e 100644 --- a/ts/features/payments/receipts/screens/ReceiptListScreen.tsx +++ b/ts/features/payments/receipts/screens/ReceiptListScreen.tsx @@ -5,7 +5,7 @@ import { } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; import { RouteProp } from "@react-navigation/native"; -import * as React from "react"; +import { useState, useCallback, useEffect } from "react"; import { LayoutChangeEvent, SectionList, SectionListData } from "react-native"; import Animated, { useAnimatedScrollHandler, @@ -46,15 +46,15 @@ const ReceiptListScreen = () => { const navigation = useIONavigation(); const scrollTranslationY = useSharedValue(0); - const [titleHeight, setTitleHeight] = React.useState(0); - const [isRefreshing, setIsRefreshing] = React.useState(false); - const [continuationToken, setContinuationToken] = React.useState< + const [titleHeight, setTitleHeight] = useState(0); + const [isRefreshing, setIsRefreshing] = useState(false); + const [continuationToken, setContinuationToken] = useState< string | undefined >(); const [noticeCategory, setNoticeCategory] = - React.useState("all"); + useState("all"); const [groupedTransactions, setGroupedTransactions] = - React.useState>>(); + useState>>(); const insets = useSafeAreaInsets(); const transactionsPot = useIOSelector(walletReceiptListPotSelector); @@ -114,7 +114,7 @@ const ReceiptListScreen = () => { ); }; - const handleCategorySelected = React.useCallback( + const handleCategorySelected = useCallback( (category: ReceiptsCategoryFilter) => { setNoticeCategory(category); dispatch( @@ -129,7 +129,7 @@ const ReceiptListScreen = () => { ); useOnFirstRender( - React.useCallback(() => { + useCallback(() => { analytics.trackPaymentsReceiptListing(); dispatch( getPaymentsReceiptAction.request({ @@ -149,7 +149,7 @@ const ReceiptListScreen = () => { } }); - React.useEffect(() => { + useEffect(() => { if (pot.isSome(transactionsPot)) { setGroupedTransactions(groupTransactionsByMonth(transactionsPot.value)); } diff --git a/ts/features/payments/receipts/screens/ReceiptPreviewScreen.tsx b/ts/features/payments/receipts/screens/ReceiptPreviewScreen.tsx index 451d2c6e8b5..2c64db31b07 100644 --- a/ts/features/payments/receipts/screens/ReceiptPreviewScreen.tsx +++ b/ts/features/payments/receipts/screens/ReceiptPreviewScreen.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { useState } from "react"; import * as pot from "@pagopa/ts-commons/lib/pot"; import { Platform, View } from "react-native"; import Share from "react-native-share"; @@ -26,7 +26,7 @@ export type ReceiptPreviewScreenProps = RouteProp< const ReceiptPreviewScreen = () => { const [footerActionsMeasurements, setfooterActionsMeasurements] = - React.useState({ + useState({ actionBlockHeight: 0, safeBottomAreaHeight: 0 }); diff --git a/ts/features/payments/wallet/components/PaymentWalletCard.tsx b/ts/features/payments/wallet/components/PaymentWalletCard.tsx index 628cf93f797..1a4eb2041e8 100644 --- a/ts/features/payments/wallet/components/PaymentWalletCard.tsx +++ b/ts/features/payments/wallet/components/PaymentWalletCard.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; import { withWalletCardBaseComponent } from "../../../wallet/components/WalletCardBaseComponent"; import { diff --git a/ts/features/pn/components/F24ListBottomSheetLink.tsx b/ts/features/pn/components/F24ListBottomSheetLink.tsx index 79eede4e27a..039c1015ae9 100644 --- a/ts/features/pn/components/F24ListBottomSheetLink.tsx +++ b/ts/features/pn/components/F24ListBottomSheetLink.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { StyleSheet, View } from "react-native"; import { ButtonLink } from "@pagopa/io-app-design-system"; import { ThirdPartyAttachment } from "../../../../definitions/backend/ThirdPartyAttachment"; diff --git a/ts/features/pn/components/F24Section.tsx b/ts/features/pn/components/F24Section.tsx index 27327d7accf..35b9a2ad642 100644 --- a/ts/features/pn/components/F24Section.tsx +++ b/ts/features/pn/components/F24Section.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { Body, ListItemHeader, VSpacer } from "@pagopa/io-app-design-system"; import I18n from "../../../i18n"; import { UIMessageId } from "../../messages/types"; diff --git a/ts/features/pn/components/MessageBottomMenu.tsx b/ts/features/pn/components/MessageBottomMenu.tsx index 9f2d62ce7d4..42f93d27ce4 100644 --- a/ts/features/pn/components/MessageBottomMenu.tsx +++ b/ts/features/pn/components/MessageBottomMenu.tsx @@ -1,5 +1,5 @@ import { IOColors, IOStyles } from "@pagopa/io-app-design-system"; -import React, { useMemo } from "react"; +import { useMemo } from "react"; import { StyleSheet, View } from "react-native"; import { ContactsListItem } from "../../messages/components/MessageDetail/ContactsListItem"; import { useIOSelector } from "../../../store/hooks"; diff --git a/ts/features/pn/components/MessageCancelledContent.tsx b/ts/features/pn/components/MessageCancelledContent.tsx index e18a2503747..491d31fd43c 100644 --- a/ts/features/pn/components/MessageCancelledContent.tsx +++ b/ts/features/pn/components/MessageCancelledContent.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { Alert, VSpacer } from "@pagopa/io-app-design-system"; import I18n from "../../../i18n"; import { NotificationPaymentInfo } from "../../../../definitions/pn/NotificationPaymentInfo"; diff --git a/ts/features/pn/components/MessageDetails.tsx b/ts/features/pn/components/MessageDetails.tsx index 197e3613423..6106c46f8d1 100644 --- a/ts/features/pn/components/MessageDetails.tsx +++ b/ts/features/pn/components/MessageDetails.tsx @@ -1,4 +1,4 @@ -import React, { useRef } from "react"; +import { useRef } from "react"; import { ScrollView } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import { pipe } from "fp-ts/lib/function"; diff --git a/ts/features/pn/components/MessageDetailsContent.tsx b/ts/features/pn/components/MessageDetailsContent.tsx index 0237cc013b8..2fb7bd9b2e1 100644 --- a/ts/features/pn/components/MessageDetailsContent.tsx +++ b/ts/features/pn/components/MessageDetailsContent.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { Body, VSpacer } from "@pagopa/io-app-design-system"; type MessageDetailsContentProps = { diff --git a/ts/features/pn/components/MessageFooter.tsx b/ts/features/pn/components/MessageFooter.tsx index 977db5f378c..70e97f102b3 100644 --- a/ts/features/pn/components/MessageFooter.tsx +++ b/ts/features/pn/components/MessageFooter.tsx @@ -1,4 +1,4 @@ -import React, { MutableRefObject, useCallback } from "react"; +import { MutableRefObject, useCallback } from "react"; import { View } from "react-native"; import { ButtonSolid, diff --git a/ts/features/pn/components/MessagePaymentBottomSheet.tsx b/ts/features/pn/components/MessagePaymentBottomSheet.tsx index ce12e2794e7..c7960d7a753 100644 --- a/ts/features/pn/components/MessagePaymentBottomSheet.tsx +++ b/ts/features/pn/components/MessagePaymentBottomSheet.tsx @@ -1,4 +1,4 @@ -import React, { MutableRefObject } from "react"; +import { MutableRefObject } from "react"; import { Dimensions, View } from "react-native"; import I18n from "../../../i18n"; import { NotificationPaymentInfo } from "../../../../definitions/pn/NotificationPaymentInfo"; diff --git a/ts/features/pn/components/MessagePayments.tsx b/ts/features/pn/components/MessagePayments.tsx index 5add59858b7..7a8b6eb0ce1 100644 --- a/ts/features/pn/components/MessagePayments.tsx +++ b/ts/features/pn/components/MessagePayments.tsx @@ -1,7 +1,7 @@ import { pipe } from "fp-ts/lib/function"; import * as RA from "fp-ts/lib/ReadonlyArray"; import * as O from "fp-ts/lib/Option"; -import React, { MutableRefObject } from "react"; +import { MutableRefObject } from "react"; import { StyleSheet, View } from "react-native"; import { ButtonLink, diff --git a/ts/features/pn/components/ServiceCTA.tsx b/ts/features/pn/components/ServiceCTA.tsx index 93b06943bd1..f763b99e6a2 100644 --- a/ts/features/pn/components/ServiceCTA.tsx +++ b/ts/features/pn/components/ServiceCTA.tsx @@ -1,4 +1,4 @@ -import React, { useCallback } from "react"; +import { useCallback } from "react"; import { ButtonSolid, IOToast } from "@pagopa/io-app-design-system"; import { constNull, identity, pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; diff --git a/ts/features/pn/components/Timeline.tsx b/ts/features/pn/components/Timeline.tsx index 409e75fbb7f..332afe7ef2b 100644 --- a/ts/features/pn/components/Timeline.tsx +++ b/ts/features/pn/components/Timeline.tsx @@ -1,4 +1,4 @@ -import React, { PropsWithChildren } from "react"; +import { PropsWithChildren } from "react"; import { StyleSheet, View } from "react-native"; import { Caption, H6, IOColors, VSpacer } from "@pagopa/io-app-design-system"; diff --git a/ts/features/pn/components/TimelineListItem.tsx b/ts/features/pn/components/TimelineListItem.tsx index a8d45a182fd..47116f595c2 100644 --- a/ts/features/pn/components/TimelineListItem.tsx +++ b/ts/features/pn/components/TimelineListItem.tsx @@ -1,4 +1,4 @@ -import React, { useMemo } from "react"; +import { useMemo } from "react"; import { Dimensions, View } from "react-native"; import { Alert, diff --git a/ts/features/pn/components/__test__/F24ListBottomSheetLink.test.tsx b/ts/features/pn/components/__test__/F24ListBottomSheetLink.test.tsx index a022d99d125..082db462a9e 100644 --- a/ts/features/pn/components/__test__/F24ListBottomSheetLink.test.tsx +++ b/ts/features/pn/components/__test__/F24ListBottomSheetLink.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../store/actions/application"; import { preferencesDesignSystemSetEnabled } from "../../../../store/actions/persistedPreferences"; diff --git a/ts/features/pn/components/__test__/F24Section.test.tsx b/ts/features/pn/components/__test__/F24Section.test.tsx index 48b79a01c9b..10d1fead32c 100644 --- a/ts/features/pn/components/__test__/F24Section.test.tsx +++ b/ts/features/pn/components/__test__/F24Section.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { createStore } from "redux"; import { F24Section } from "../F24Section"; import { appReducer } from "../../../../store/reducers"; diff --git a/ts/features/pn/components/__test__/MessageBottomMenu.test.tsx b/ts/features/pn/components/__test__/MessageBottomMenu.test.tsx index 4b262a4b1ed..266bac631f0 100644 --- a/ts/features/pn/components/__test__/MessageBottomMenu.test.tsx +++ b/ts/features/pn/components/__test__/MessageBottomMenu.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../store/actions/application"; import { preferencesDesignSystemSetEnabled } from "../../../../store/actions/persistedPreferences"; diff --git a/ts/features/pn/components/__test__/MessageCancelledContent.test.tsx b/ts/features/pn/components/__test__/MessageCancelledContent.test.tsx index 6e5621b5b12..ed6892055ce 100644 --- a/ts/features/pn/components/__test__/MessageCancelledContent.test.tsx +++ b/ts/features/pn/components/__test__/MessageCancelledContent.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { NotificationPaymentInfo } from "../../../../../definitions/pn/NotificationPaymentInfo"; import { applicationChangeState } from "../../../../store/actions/application"; diff --git a/ts/features/pn/components/__test__/MessageDetails.test.tsx b/ts/features/pn/components/__test__/MessageDetails.test.tsx index 89d21deef44..665bfa5ab54 100644 --- a/ts/features/pn/components/__test__/MessageDetails.test.tsx +++ b/ts/features/pn/components/__test__/MessageDetails.test.tsx @@ -1,18 +1,18 @@ -import React from "react"; -import configureMockStore from "redux-mock-store"; import { pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; +import { ComponentProps } from "react"; +import configureMockStore from "redux-mock-store"; +import I18n from "../../../../i18n"; import { applicationChangeState } from "../../../../store/actions/application"; import { appReducer } from "../../../../store/reducers"; -import { MessageDetails } from "../MessageDetails"; import { GlobalState } from "../../../../store/reducers/types"; import { renderScreenWithNavigationStoreContext } from "../../../../utils/testWrapper"; -import { PNMessage } from "../../store/types/types"; -import { thirdPartyMessage } from "../../__mocks__/message"; -import { toPNMessage } from "../../store/types/transformers"; -import I18n from "../../../../i18n"; import { serviceId_1 } from "../../../messages/__mocks__/messages"; import { UIMessageId } from "../../../messages/types"; +import { thirdPartyMessage } from "../../__mocks__/message"; +import { toPNMessage } from "../../store/types/transformers"; +import { PNMessage } from "../../store/types/types"; +import { MessageDetails } from "../MessageDetails"; const pnMessage = pipe(thirdPartyMessage, toPNMessage, O.toUndefined)!; @@ -58,9 +58,7 @@ const generateComponentProperties = (message: PNMessage) => ({ serviceId: serviceId_1 }); -const renderComponent = ( - props: React.ComponentProps -) => { +const renderComponent = (props: ComponentProps) => { const globalState = appReducer(undefined, applicationChangeState("active")); const mockStore = configureMockStore(); const store: ReturnType = mockStore(globalState); diff --git a/ts/features/pn/components/__test__/MessageDetailsContent.test.tsx b/ts/features/pn/components/__test__/MessageDetailsContent.test.tsx index 31e5a7c3603..1f57dab3b58 100644 --- a/ts/features/pn/components/__test__/MessageDetailsContent.test.tsx +++ b/ts/features/pn/components/__test__/MessageDetailsContent.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { render } from "@testing-library/react-native"; import { MessageDetailsContent } from "../MessageDetailsContent"; diff --git a/ts/features/pn/components/__test__/MessageFooter.test.tsx b/ts/features/pn/components/__test__/MessageFooter.test.tsx index bb2f9329a38..d0fe2e879b0 100644 --- a/ts/features/pn/components/__test__/MessageFooter.test.tsx +++ b/ts/features/pn/components/__test__/MessageFooter.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../store/actions/application"; import { preferencesDesignSystemSetEnabled } from "../../../../store/actions/persistedPreferences"; diff --git a/ts/features/pn/components/__test__/MessagePaymentBottomSheet.test.tsx b/ts/features/pn/components/__test__/MessagePaymentBottomSheet.test.tsx index b842b9c44d1..7609c1f768c 100644 --- a/ts/features/pn/components/__test__/MessagePaymentBottomSheet.test.tsx +++ b/ts/features/pn/components/__test__/MessagePaymentBottomSheet.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { NotificationPaymentInfo } from "../../../../../definitions/pn/NotificationPaymentInfo"; import { appReducer } from "../../../../store/reducers"; diff --git a/ts/features/pn/components/__test__/MessagePayments.test.tsx b/ts/features/pn/components/__test__/MessagePayments.test.tsx index ac2f2e7fb93..d6fc9c3ce71 100644 --- a/ts/features/pn/components/__test__/MessagePayments.test.tsx +++ b/ts/features/pn/components/__test__/MessagePayments.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { appReducer } from "../../../../store/reducers"; import { applicationChangeState } from "../../../../store/actions/application"; diff --git a/ts/features/pn/components/__test__/Timeline.test.tsx b/ts/features/pn/components/__test__/Timeline.test.tsx index cc45a744d7d..1011cc12f15 100644 --- a/ts/features/pn/components/__test__/Timeline.test.tsx +++ b/ts/features/pn/components/__test__/Timeline.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { Timeline, TimelineItemProps, TimelineProps } from "../Timeline"; import { appReducer } from "../../../../store/reducers"; diff --git a/ts/features/pn/components/__test__/TimelineListItem.test.tsx b/ts/features/pn/components/__test__/TimelineListItem.test.tsx index 0e07ac14478..a705da99288 100644 --- a/ts/features/pn/components/__test__/TimelineListItem.test.tsx +++ b/ts/features/pn/components/__test__/TimelineListItem.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import * as O from "fp-ts/lib/Option"; import { createStore } from "redux"; import { appReducer } from "../../../../store/reducers"; diff --git a/ts/features/pn/navigation/navigator.tsx b/ts/features/pn/navigation/navigator.tsx index f35014bffec..b156553568b 100644 --- a/ts/features/pn/navigation/navigator.tsx +++ b/ts/features/pn/navigation/navigator.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStackNavigator } from "@react-navigation/stack"; import { MessageDetailsScreen } from "../screens/MessageDetailsScreen"; import { MessageAttachmentScreen } from "../screens/MessageAttachmentScreen"; diff --git a/ts/features/pn/screens/MessageAttachmentScreen.tsx b/ts/features/pn/screens/MessageAttachmentScreen.tsx index 7e1e4ce10b1..3e8619e1944 100644 --- a/ts/features/pn/screens/MessageAttachmentScreen.tsx +++ b/ts/features/pn/screens/MessageAttachmentScreen.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { UIMessageId } from "../../messages/types"; import { IOStackNavigationRouteProps } from "../../../navigation/params/AppParamsList"; import { PnParamsList } from "../navigation/params"; diff --git a/ts/features/pn/screens/MessageDetailsScreen.tsx b/ts/features/pn/screens/MessageDetailsScreen.tsx index d78c928ac7f..10a620a1894 100644 --- a/ts/features/pn/screens/MessageDetailsScreen.tsx +++ b/ts/features/pn/screens/MessageDetailsScreen.tsx @@ -7,7 +7,7 @@ import { } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React, { useCallback } from "react"; +import { useCallback } from "react"; import { ServiceId } from "../../../../definitions/backend/ServiceId"; import { OperationResultScreenContent } from "../../../components/screens/OperationResultScreenContent"; import { useHeaderSecondLevel } from "../../../hooks/useHeaderSecondLevel"; diff --git a/ts/features/pn/screens/PaidPaymentScreen.tsx b/ts/features/pn/screens/PaidPaymentScreen.tsx index a23e5ae4d6f..9c17ec23b50 100644 --- a/ts/features/pn/screens/PaidPaymentScreen.tsx +++ b/ts/features/pn/screens/PaidPaymentScreen.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { PnParamsList } from "../navigation/params"; import { IOStackNavigationRouteProps, diff --git a/ts/features/pushNotifications/components/NotificationPreviewSample.tsx b/ts/features/pushNotifications/components/NotificationPreviewSample.tsx index cf4caa4a52c..c8ac35e4ac7 100644 --- a/ts/features/pushNotifications/components/NotificationPreviewSample.tsx +++ b/ts/features/pushNotifications/components/NotificationPreviewSample.tsx @@ -8,7 +8,6 @@ import { BodySmall, useIOTheme } from "@pagopa/io-app-design-system"; -import React from "react"; import { StyleSheet, View } from "react-native"; import { TranslationKeys } from "../../../../locales/locales"; import I18n from "../../../i18n"; diff --git a/ts/features/pushNotifications/components/NotificationsPreferencesPreview.tsx b/ts/features/pushNotifications/components/NotificationsPreferencesPreview.tsx index a4c97827aff..48f326dcd07 100644 --- a/ts/features/pushNotifications/components/NotificationsPreferencesPreview.tsx +++ b/ts/features/pushNotifications/components/NotificationsPreferencesPreview.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { StyleSheet, ImageBackground } from "react-native"; import NotificationWhiteBg from "../../../../img/onboarding/notification_white.png"; import { NotificationPreviewSample } from "./NotificationPreviewSample"; diff --git a/ts/features/pushNotifications/components/ProfileNotificationsSettings.tsx b/ts/features/pushNotifications/components/ProfileNotificationsSettings.tsx index 20c7fae7de0..6cf81c8760d 100644 --- a/ts/features/pushNotifications/components/ProfileNotificationsSettings.tsx +++ b/ts/features/pushNotifications/components/ProfileNotificationsSettings.tsx @@ -4,7 +4,6 @@ import { ListItemSwitch, VSpacer } from "@pagopa/io-app-design-system"; -import React from "react"; import I18n from "../../../i18n"; import { usePreviewMoreInfo } from "../hooks/usePreviewMoreInfo"; import { NotificationsPreferencesPreview } from "./NotificationsPreferencesPreview"; diff --git a/ts/features/pushNotifications/components/PushNotificationsBanner.tsx b/ts/features/pushNotifications/components/PushNotificationsBanner.tsx index 410bb0d02d1..d8787bfd562 100644 --- a/ts/features/pushNotifications/components/PushNotificationsBanner.tsx +++ b/ts/features/pushNotifications/components/PushNotificationsBanner.tsx @@ -4,7 +4,7 @@ import { FooterActions, IOVisualCostants } from "@pagopa/io-app-design-system"; -import * as React from "react"; +import { useEffect } from "react"; import { StyleSheet, View } from "react-native"; import I18n from "../../../i18n"; import { useIODispatch, useIOSelector } from "../../../store/hooks"; @@ -29,7 +29,7 @@ export const PushNotificationsBanner = ({ closeHandler }: Props) => { shouldResetNotificationBannerDismissStateSelector ); - React.useEffect(() => { + useEffect(() => { if (shouldResetDismissState) { dispatch(resetNotificationBannerDismissState()); } diff --git a/ts/features/pushNotifications/components/__tests__/NotificationPreviewSample.test.tsx b/ts/features/pushNotifications/components/__tests__/NotificationPreviewSample.test.tsx index 949611858de..0f1c0321a8f 100644 --- a/ts/features/pushNotifications/components/__tests__/NotificationPreviewSample.test.tsx +++ b/ts/features/pushNotifications/components/__tests__/NotificationPreviewSample.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { createStore } from "redux"; import { render } from "@testing-library/react-native"; import I18n from "../../../../i18n"; diff --git a/ts/features/pushNotifications/components/__tests__/NotificationsPreferencesPreview.test.tsx b/ts/features/pushNotifications/components/__tests__/NotificationsPreferencesPreview.test.tsx index cdef0455bad..94065944664 100644 --- a/ts/features/pushNotifications/components/__tests__/NotificationsPreferencesPreview.test.tsx +++ b/ts/features/pushNotifications/components/__tests__/NotificationsPreferencesPreview.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../store/actions/application"; import { preferencesDesignSystemSetEnabled } from "../../../../store/actions/persistedPreferences"; diff --git a/ts/features/pushNotifications/components/__tests__/ProfileNotificationsSettings.test.tsx b/ts/features/pushNotifications/components/__tests__/ProfileNotificationsSettings.test.tsx index d3455c06f4e..395e4ece6cf 100644 --- a/ts/features/pushNotifications/components/__tests__/ProfileNotificationsSettings.test.tsx +++ b/ts/features/pushNotifications/components/__tests__/ProfileNotificationsSettings.test.tsx @@ -1,5 +1,4 @@ /* eslint-disable no-bitwise */ -import React from "react"; import { createStore } from "redux"; import { ProfileNotificationSettings } from "../ProfileNotificationsSettings"; import { appReducer } from "../../../../store/reducers"; diff --git a/ts/features/pushNotifications/components/__tests__/PushNotificationsBanner.test.tsx b/ts/features/pushNotifications/components/__tests__/PushNotificationsBanner.test.tsx index 3c3c66684cc..c44324b39bb 100644 --- a/ts/features/pushNotifications/components/__tests__/PushNotificationsBanner.test.tsx +++ b/ts/features/pushNotifications/components/__tests__/PushNotificationsBanner.test.tsx @@ -1,5 +1,6 @@ import { fireEvent } from "@testing-library/react-native"; -import * as React from "react"; + +import { ReactElement } from "react"; import { createStore } from "redux"; import I18n from "../../../../i18n"; import { applicationChangeState } from "../../../../store/actions/application"; @@ -100,7 +101,7 @@ describe("PushNotificationsBanner", () => { }); }); -const renderTestingComponent = (component: React.ReactElement) => { +const renderTestingComponent = (component: ReactElement) => { const globalState = appReducer(undefined, applicationChangeState("active")); const store = createStore(appReducer, globalState as any); return renderScreenWithNavigationStoreContext( diff --git a/ts/features/pushNotifications/hooks/usePreviewMoreInfo.tsx b/ts/features/pushNotifications/hooks/usePreviewMoreInfo.tsx index 0b4118f0771..8d0af014e5e 100644 --- a/ts/features/pushNotifications/hooks/usePreviewMoreInfo.tsx +++ b/ts/features/pushNotifications/hooks/usePreviewMoreInfo.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { Body } from "@pagopa/io-app-design-system"; import I18n from "../../../i18n"; import { diff --git a/ts/features/pushNotifications/screens/OnboardingNotificationsInfoScreenConsent.tsx b/ts/features/pushNotifications/screens/OnboardingNotificationsInfoScreenConsent.tsx index 46b04c809ad..b7e09426274 100644 --- a/ts/features/pushNotifications/screens/OnboardingNotificationsInfoScreenConsent.tsx +++ b/ts/features/pushNotifications/screens/OnboardingNotificationsInfoScreenConsent.tsx @@ -9,7 +9,7 @@ import { ListItemInfo, VSpacer } from "@pagopa/io-app-design-system"; -import React, { useCallback, useEffect, useMemo } from "react"; +import { useCallback, useEffect, useMemo } from "react"; import { AppState, FlatList, Platform, StyleSheet, View } from "react-native"; import I18n from "../../../i18n"; import { useIODispatch, useIOSelector } from "../../../store/hooks"; diff --git a/ts/features/pushNotifications/screens/OnboardingNotificationsPreferencesScreen.tsx b/ts/features/pushNotifications/screens/OnboardingNotificationsPreferencesScreen.tsx index 692ab9a00c6..357762a36f1 100644 --- a/ts/features/pushNotifications/screens/OnboardingNotificationsPreferencesScreen.tsx +++ b/ts/features/pushNotifications/screens/OnboardingNotificationsPreferencesScreen.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { ScrollView, StyleSheet, View } from "react-native"; import { VSpacer, diff --git a/ts/features/pushNotifications/screens/SystemNotificationPermissionsScreen.tsx b/ts/features/pushNotifications/screens/SystemNotificationPermissionsScreen.tsx index 80f56f2a509..296b9dac90a 100644 --- a/ts/features/pushNotifications/screens/SystemNotificationPermissionsScreen.tsx +++ b/ts/features/pushNotifications/screens/SystemNotificationPermissionsScreen.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect } from "react"; +import { useCallback, useEffect } from "react"; import { HeaderSecondLevel } from "@pagopa/io-app-design-system"; import { useIONavigation } from "../../../navigation/params/AppParamsList"; import { openSystemNotificationSettingsScreen } from "../utils"; diff --git a/ts/features/pushNotifications/screens/__tests__/SystemNotificationPermissionsScreen.test.tsx b/ts/features/pushNotifications/screens/__tests__/SystemNotificationPermissionsScreen.test.tsx index d6f1d415e53..37c39d6de37 100644 --- a/ts/features/pushNotifications/screens/__tests__/SystemNotificationPermissionsScreen.test.tsx +++ b/ts/features/pushNotifications/screens/__tests__/SystemNotificationPermissionsScreen.test.tsx @@ -1,6 +1,5 @@ import { fireEvent } from "@testing-library/react-native"; import { constUndefined } from "fp-ts/lib/function"; -import React from "react"; import { createStore } from "redux"; import I18n from "../../../../i18n"; diff --git a/ts/features/services/common/components/CardPressableBase.tsx b/ts/features/services/common/components/CardPressableBase.tsx index 3709de0a467..fca1a46d740 100644 --- a/ts/features/services/common/components/CardPressableBase.tsx +++ b/ts/features/services/common/components/CardPressableBase.tsx @@ -3,7 +3,8 @@ import { useScaleAnimation, WithTestID } from "@pagopa/io-app-design-system"; -import React from "react"; +import { PropsWithChildren } from "react"; + import { Pressable } from "react-native"; import Animated from "react-native-reanimated"; @@ -14,7 +15,7 @@ export const CardPressableBase = ({ testID, accessibilityLabel, children -}: React.PropsWithChildren) => { +}: PropsWithChildren) => { const { onPressIn, onPressOut, scaleAnimatedStyle } = useScaleAnimation(); if (onPress === undefined) { diff --git a/ts/features/services/common/components/EmptyState.tsx b/ts/features/services/common/components/EmptyState.tsx index eb47c72822d..7f64f0c19a4 100644 --- a/ts/features/services/common/components/EmptyState.tsx +++ b/ts/features/services/common/components/EmptyState.tsx @@ -7,7 +7,6 @@ import { VSpacer, WithTestID } from "@pagopa/io-app-design-system"; -import React from "react"; import { StyleSheet, View } from "react-native"; const styles = StyleSheet.create({ diff --git a/ts/features/services/common/components/InstitutionListSkeleton.tsx b/ts/features/services/common/components/InstitutionListSkeleton.tsx index ca9c46203a6..378e09aacfa 100644 --- a/ts/features/services/common/components/InstitutionListSkeleton.tsx +++ b/ts/features/services/common/components/InstitutionListSkeleton.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { Fragment } from "react"; import { View } from "react-native"; import { Divider, @@ -36,10 +36,10 @@ export const InstitutionListSkeleton = ({ }: InstitutionListSkeletonProps) => ( {Array.from({ length: size }).map((_, index) => ( - + {index < size - 1 ? : undefined} - + ))} ); diff --git a/ts/features/services/common/components/ListItemSearchInstitution.tsx b/ts/features/services/common/components/ListItemSearchInstitution.tsx index a1e3adafbba..21c654169ec 100644 --- a/ts/features/services/common/components/ListItemSearchInstitution.tsx +++ b/ts/features/services/common/components/ListItemSearchInstitution.tsx @@ -12,19 +12,20 @@ import { useIOTheme, useListItemAnimation } from "@pagopa/io-app-design-system"; -import React, { ComponentProps, memo, useCallback } from "react"; +import { ComponentProps, ReactNode, memo, useCallback } from "react"; + import { GestureResponderEvent, Pressable, View } from "react-native"; import Animated from "react-native-reanimated"; export type ListItemSearchInstitution = WithTestID< { - value: string | React.ReactNode; + value: string | ReactNode; avatarProps: AvatarSearchProps; /** * The maximum number of lines to display for the value. */ numberOfLines?: number; - description?: string | React.ReactNode; + description?: string | ReactNode; onPress: (event: GestureResponderEvent) => void; } & Pick< ComponentProps, diff --git a/ts/features/services/common/components/ServicesHeader.tsx b/ts/features/services/common/components/ServicesHeader.tsx index 7df6bc1903d..bc265c437ba 100644 --- a/ts/features/services/common/components/ServicesHeader.tsx +++ b/ts/features/services/common/components/ServicesHeader.tsx @@ -9,7 +9,6 @@ import { useIOTheme, VSpacer } from "@pagopa/io-app-design-system"; -import React from "react"; import { ImageURISource, StyleSheet, View } from "react-native"; import Placeholder from "rn-placeholder"; diff --git a/ts/features/services/common/components/ServicesHeaderSection.tsx b/ts/features/services/common/components/ServicesHeaderSection.tsx index c9d8b3b9ad6..f9eb6d2b917 100644 --- a/ts/features/services/common/components/ServicesHeaderSection.tsx +++ b/ts/features/services/common/components/ServicesHeaderSection.tsx @@ -1,4 +1,4 @@ -import React, { ComponentProps } from "react"; +import { ComponentProps } from "react"; import { Dimensions, View } from "react-native"; import { useHeaderHeight } from "@react-navigation/elements"; import { diff --git a/ts/features/services/common/components/__tests__/ServicesHeader.test.tsx b/ts/features/services/common/components/__tests__/ServicesHeader.test.tsx index 293d5fe221b..593430499f1 100644 --- a/ts/features/services/common/components/__tests__/ServicesHeader.test.tsx +++ b/ts/features/services/common/components/__tests__/ServicesHeader.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { render } from "@testing-library/react-native"; import { ServicesHeader } from "../ServicesHeader"; diff --git a/ts/features/services/common/components/__tests__/ServicesHeaderSection.test.tsx b/ts/features/services/common/components/__tests__/ServicesHeaderSection.test.tsx index 4cbd884f694..95126dc28f3 100644 --- a/ts/features/services/common/components/__tests__/ServicesHeaderSection.test.tsx +++ b/ts/features/services/common/components/__tests__/ServicesHeaderSection.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { render } from "@testing-library/react-native"; import { ServicesHeaderSection } from "../ServicesHeaderSection"; diff --git a/ts/features/services/common/navigation/navigator.tsx b/ts/features/services/common/navigation/navigator.tsx index c16da3803dd..06ae5647c5f 100644 --- a/ts/features/services/common/navigation/navigator.tsx +++ b/ts/features/services/common/navigation/navigator.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStackNavigator } from "@react-navigation/stack"; import { isGestureEnabled } from "../../../../utils/navigation"; import { ServiceDetailsScreen } from "../../details/screens/ServiceDetailsScreen"; diff --git a/ts/features/services/details/components/CardWithMarkdownContent.tsx b/ts/features/services/details/components/CardWithMarkdownContent.tsx index 34890fa6eb4..c949e257bde 100644 --- a/ts/features/services/details/components/CardWithMarkdownContent.tsx +++ b/ts/features/services/details/components/CardWithMarkdownContent.tsx @@ -1,4 +1,4 @@ -import React, { memo, ReactNode } from "react"; +import { memo, ReactNode } from "react"; import { StyleSheet, View } from "react-native"; import { IOColors, useIOTheme } from "@pagopa/io-app-design-system"; import { Markdown } from "../../../../components/ui/Markdown/Markdown"; diff --git a/ts/features/services/details/components/ServiceDetailsFailure.tsx b/ts/features/services/details/components/ServiceDetailsFailure.tsx index eed0d636261..2c884937396 100644 --- a/ts/features/services/details/components/ServiceDetailsFailure.tsx +++ b/ts/features/services/details/components/ServiceDetailsFailure.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useLayoutEffect } from "react"; +import { useCallback, useLayoutEffect } from "react"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; import { useIODispatch } from "../../../../store/hooks"; diff --git a/ts/features/services/details/components/ServiceDetailsMetadata.tsx b/ts/features/services/details/components/ServiceDetailsMetadata.tsx index 864c2e968c6..0c9059209d4 100644 --- a/ts/features/services/details/components/ServiceDetailsMetadata.tsx +++ b/ts/features/services/details/components/ServiceDetailsMetadata.tsx @@ -1,4 +1,4 @@ -import React, { useCallback } from "react"; +import { useCallback } from "react"; import { FlatList, ListRenderItemInfo, Platform } from "react-native"; import { Divider, diff --git a/ts/features/services/details/components/ServiceDetailsPreferences.tsx b/ts/features/services/details/components/ServiceDetailsPreferences.tsx index bf0536439b0..58a7fc9b809 100644 --- a/ts/features/services/details/components/ServiceDetailsPreferences.tsx +++ b/ts/features/services/details/components/ServiceDetailsPreferences.tsx @@ -1,4 +1,4 @@ -import React, { ComponentProps, useCallback, useEffect } from "react"; +import { ComponentProps, useCallback, useEffect } from "react"; import { FlatList, ListRenderItemInfo } from "react-native"; import { Divider, diff --git a/ts/features/services/details/components/ServiceDetailsScreenComponent.tsx b/ts/features/services/details/components/ServiceDetailsScreenComponent.tsx index 584f8806ddb..6db1b7b1911 100644 --- a/ts/features/services/details/components/ServiceDetailsScreenComponent.tsx +++ b/ts/features/services/details/components/ServiceDetailsScreenComponent.tsx @@ -10,7 +10,14 @@ import { VSpacer, hexToRgba } from "@pagopa/io-app-design-system"; -import React, { ComponentProps, useCallback, useMemo, useState } from "react"; +import { + ComponentProps, + ReactNode, + useCallback, + useMemo, + useState +} from "react"; + import { LayoutChangeEvent, LayoutRectangle, @@ -108,7 +115,7 @@ export type ServiceActionsProps = }; type ServiceDetailsScreenComponentProps = { - children: React.ReactNode; + children: ReactNode; actionsProps?: ServiceActionsProps; debugMode?: boolean; title?: string; diff --git a/ts/features/services/details/components/ServiceDetailsTosAndPrivacy.tsx b/ts/features/services/details/components/ServiceDetailsTosAndPrivacy.tsx index 3c92dc62fef..8bd78c12cbe 100644 --- a/ts/features/services/details/components/ServiceDetailsTosAndPrivacy.tsx +++ b/ts/features/services/details/components/ServiceDetailsTosAndPrivacy.tsx @@ -1,4 +1,4 @@ -import React, { useCallback } from "react"; +import { useCallback } from "react"; import { FlatList, ListRenderItemInfo } from "react-native"; import { Divider, diff --git a/ts/features/services/details/components/ServiceSpecialAction.tsx b/ts/features/services/details/components/ServiceSpecialAction.tsx index 0ccb3b7461c..a1b00a86fc1 100644 --- a/ts/features/services/details/components/ServiceSpecialAction.tsx +++ b/ts/features/services/details/components/ServiceSpecialAction.tsx @@ -1,4 +1,4 @@ -import React, { useCallback } from "react"; +import { useCallback } from "react"; import { ButtonSolid } from "@pagopa/io-app-design-system"; import * as O from "fp-ts/lib/Option"; import * as B from "fp-ts/lib/boolean"; diff --git a/ts/features/services/details/screens/ServiceDetailsScreen.tsx b/ts/features/services/details/screens/ServiceDetailsScreen.tsx index 31c3e816423..41b8232550b 100644 --- a/ts/features/services/details/screens/ServiceDetailsScreen.tsx +++ b/ts/features/services/details/screens/ServiceDetailsScreen.tsx @@ -2,7 +2,7 @@ import { IOVisualCostants, VSpacer } from "@pagopa/io-app-design-system"; import { useFocusEffect, useLinkTo } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React, { useCallback, useEffect, useMemo } from "react"; +import { useCallback, useEffect, useMemo } from "react"; import { StyleSheet, View } from "react-native"; import { ServiceId } from "../../../../../definitions/backend/ServiceId"; import { IOStackNavigationRouteProps } from "../../../../navigation/params/AppParamsList"; diff --git a/ts/features/services/home/components/FeaturedInstitutionCard.tsx b/ts/features/services/home/components/FeaturedInstitutionCard.tsx index 21a9be6dc21..ccf34fbfc38 100644 --- a/ts/features/services/home/components/FeaturedInstitutionCard.tsx +++ b/ts/features/services/home/components/FeaturedInstitutionCard.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { Dimensions, StyleSheet, View } from "react-native"; import Placeholder from "rn-placeholder"; import { diff --git a/ts/features/services/home/components/FeaturedInstitutionList.tsx b/ts/features/services/home/components/FeaturedInstitutionList.tsx index f500ab01778..59533466d8a 100644 --- a/ts/features/services/home/components/FeaturedInstitutionList.tsx +++ b/ts/features/services/home/components/FeaturedInstitutionList.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useMemo } from "react"; +import { useCallback, useMemo } from "react"; import { ListItemHeader, VSpacer } from "@pagopa/io-app-design-system"; import { Institution } from "../../../../../definitions/services/Institution"; import I18n from "../../../../i18n"; diff --git a/ts/features/services/home/components/FeaturedInstitutionsCarousel.tsx b/ts/features/services/home/components/FeaturedInstitutionsCarousel.tsx index d62818d3b2f..9fb63b6f610 100644 --- a/ts/features/services/home/components/FeaturedInstitutionsCarousel.tsx +++ b/ts/features/services/home/components/FeaturedInstitutionsCarousel.tsx @@ -3,7 +3,6 @@ import { IOSpacingScale, IOVisualCostants } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { FlatListProps, StyleSheet } from "react-native"; import { FlatList } from "react-native-gesture-handler"; import { TestID, WithTestID } from "../../../../types/WithTestID"; diff --git a/ts/features/services/home/components/FeaturedServiceCard.tsx b/ts/features/services/home/components/FeaturedServiceCard.tsx index 1009d135bf8..b27d2f21d30 100644 --- a/ts/features/services/home/components/FeaturedServiceCard.tsx +++ b/ts/features/services/home/components/FeaturedServiceCard.tsx @@ -9,7 +9,6 @@ import { TestID, VSpacer } from "@pagopa/io-app-design-system"; -import React from "react"; import { StyleSheet, View } from "react-native"; import Placeholder from "rn-placeholder"; import I18n from "../../../../i18n"; diff --git a/ts/features/services/home/components/FeaturedServiceList.tsx b/ts/features/services/home/components/FeaturedServiceList.tsx index 4508c9ab8bb..8ad611ae09e 100644 --- a/ts/features/services/home/components/FeaturedServiceList.tsx +++ b/ts/features/services/home/components/FeaturedServiceList.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useMemo } from "react"; +import { useCallback, useMemo } from "react"; import { ListItemHeader, VSpacer } from "@pagopa/io-app-design-system"; import { NonEmptyString } from "@pagopa/ts-commons/lib/strings"; import { FeaturedService } from "../../../../../definitions/services/FeaturedService"; diff --git a/ts/features/services/home/components/FeaturedServicesCarousel.tsx b/ts/features/services/home/components/FeaturedServicesCarousel.tsx index 765c6255f25..aebc41b80b7 100644 --- a/ts/features/services/home/components/FeaturedServicesCarousel.tsx +++ b/ts/features/services/home/components/FeaturedServicesCarousel.tsx @@ -3,7 +3,6 @@ import { IOSpacingScale, IOVisualCostants } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { FlatListProps, StyleSheet } from "react-native"; import { FlatList } from "react-native-gesture-handler"; import { TestID, WithTestID } from "../../../../types/WithTestID"; diff --git a/ts/features/services/home/components/__tests__/FeaturedInstitutionCard.test.tsx b/ts/features/services/home/components/__tests__/FeaturedInstitutionCard.test.tsx index a8b25fe8012..568ab79861f 100644 --- a/ts/features/services/home/components/__tests__/FeaturedInstitutionCard.test.tsx +++ b/ts/features/services/home/components/__tests__/FeaturedInstitutionCard.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../../store/actions/application"; import { appReducer } from "../../../../../store/reducers"; diff --git a/ts/features/services/home/components/__tests__/FeaturedServiceCard.test.tsx b/ts/features/services/home/components/__tests__/FeaturedServiceCard.test.tsx index 800bb8b080f..4dd3d22072a 100644 --- a/ts/features/services/home/components/__tests__/FeaturedServiceCard.test.tsx +++ b/ts/features/services/home/components/__tests__/FeaturedServiceCard.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createStore } from "redux"; import { applicationChangeState } from "../../../../../store/actions/application"; import { appReducer } from "../../../../../store/reducers"; diff --git a/ts/features/services/home/hooks/useServicesHomeBottomSheet.tsx b/ts/features/services/home/hooks/useServicesHomeBottomSheet.tsx index b28e753290a..23483d8c3b7 100644 --- a/ts/features/services/home/hooks/useServicesHomeBottomSheet.tsx +++ b/ts/features/services/home/hooks/useServicesHomeBottomSheet.tsx @@ -1,4 +1,4 @@ -import React, { ComponentProps, useCallback } from "react"; +import { ComponentProps, useCallback } from "react"; import { FlatList, StyleSheet } from "react-native"; import { Divider, diff --git a/ts/features/services/home/screens/ServicesHomeScreen.tsx b/ts/features/services/home/screens/ServicesHomeScreen.tsx index 2799d59fe27..56c22f13b3d 100644 --- a/ts/features/services/home/screens/ServicesHomeScreen.tsx +++ b/ts/features/services/home/screens/ServicesHomeScreen.tsx @@ -10,7 +10,7 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import { useFocusEffect } from "@react-navigation/native"; -import React, { useCallback, useEffect, useMemo } from "react"; +import { useCallback, useEffect, useMemo } from "react"; import { ListRenderItemInfo, StyleSheet, View } from "react-native"; import Animated, { useAnimatedRef } from "react-native-reanimated"; import { Institution } from "../../../../../definitions/services/Institution"; diff --git a/ts/features/services/institution/components/InstitutionServicesFailure.tsx b/ts/features/services/institution/components/InstitutionServicesFailure.tsx index ac4f491eeb5..0f9b256b99b 100644 --- a/ts/features/services/institution/components/InstitutionServicesFailure.tsx +++ b/ts/features/services/institution/components/InstitutionServicesFailure.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; import I18n from "../../../../i18n"; diff --git a/ts/features/services/institution/components/ServiceListSkeleton.tsx b/ts/features/services/institution/components/ServiceListSkeleton.tsx index 17f4a709af3..0e68021ec96 100644 --- a/ts/features/services/institution/components/ServiceListSkeleton.tsx +++ b/ts/features/services/institution/components/ServiceListSkeleton.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { Fragment } from "react"; import { View } from "react-native"; import { Divider, @@ -24,10 +24,10 @@ type ServiceListSkeletonProps = { export const ServiceListSkeleton = ({ size = 3 }: ServiceListSkeletonProps) => ( {Array.from({ length: size }).map((_, index) => ( - + {index < size - 1 ? : undefined} - + ))} ); diff --git a/ts/features/services/institution/screens/InstitutionServicesScreen.tsx b/ts/features/services/institution/screens/InstitutionServicesScreen.tsx index b6aab83b51c..96c67270a4e 100644 --- a/ts/features/services/institution/screens/InstitutionServicesScreen.tsx +++ b/ts/features/services/institution/screens/InstitutionServicesScreen.tsx @@ -8,7 +8,7 @@ import { } from "@pagopa/io-app-design-system"; import { useHeaderHeight } from "@react-navigation/elements"; import { useFocusEffect } from "@react-navigation/native"; -import React, { useCallback, useEffect } from "react"; +import { useCallback, useEffect } from "react"; import { ListRenderItemInfo, RefreshControl, StyleSheet } from "react-native"; import Animated, { useAnimatedScrollHandler, diff --git a/ts/features/services/search/screens/SearchScreen.tsx b/ts/features/services/search/screens/SearchScreen.tsx index 326ce331d52..71e227daee7 100644 --- a/ts/features/services/search/screens/SearchScreen.tsx +++ b/ts/features/services/search/screens/SearchScreen.tsx @@ -1,10 +1,4 @@ -import React, { - useCallback, - useEffect, - useMemo, - useRef, - useState -} from "react"; +import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { Platform, View, ViewStyle } from "react-native"; import { useFocusEffect } from "@react-navigation/native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; diff --git a/ts/features/startup/screens/errors/GetProfileEndpointTransientError.tsx b/ts/features/startup/screens/errors/GetProfileEndpointTransientError.tsx index 5a72414c24f..21261c80b40 100644 --- a/ts/features/startup/screens/errors/GetProfileEndpointTransientError.tsx +++ b/ts/features/startup/screens/errors/GetProfileEndpointTransientError.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { Modal } from "react-native"; import I18n from "../../../../i18n"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; diff --git a/ts/features/startup/screens/errors/GetSessionEndpointTransientError.tsx b/ts/features/startup/screens/errors/GetSessionEndpointTransientError.tsx index 713cac2a579..41d803033e3 100644 --- a/ts/features/startup/screens/errors/GetSessionEndpointTransientError.tsx +++ b/ts/features/startup/screens/errors/GetSessionEndpointTransientError.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { Modal } from "react-native"; import I18n from "../../../../i18n"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; diff --git a/ts/features/wallet/components/WalletCardBaseComponent.tsx b/ts/features/wallet/components/WalletCardBaseComponent.tsx index fb582c46085..39e7b92eb16 100644 --- a/ts/features/wallet/components/WalletCardBaseComponent.tsx +++ b/ts/features/wallet/components/WalletCardBaseComponent.tsx @@ -1,5 +1,6 @@ import { WithTestID } from "@pagopa/io-app-design-system"; -import React from "react"; +import { ComponentType } from "react"; + import { StyleSheet } from "react-native"; import Animated, { FadeIn, @@ -18,7 +19,7 @@ export const withWalletCardBaseComponent = CardProps extends object, ContentProps extends WalletCardComponentBaseProps >( - CardContent: React.ComponentType + CardContent: ComponentType ) => ({ cardProps, isStacked = true, testID }: ContentProps) => ( diff --git a/ts/features/wallet/components/WalletCardPressableBase.tsx b/ts/features/wallet/components/WalletCardPressableBase.tsx index b40b95bcfb6..305d18f9c4e 100644 --- a/ts/features/wallet/components/WalletCardPressableBase.tsx +++ b/ts/features/wallet/components/WalletCardPressableBase.tsx @@ -3,7 +3,8 @@ import { useScaleAnimation, WithTestID } from "@pagopa/io-app-design-system"; -import * as React from "react"; +import { PropsWithChildren } from "react"; + import { Pressable } from "react-native"; import Animated from "react-native-reanimated"; @@ -14,7 +15,7 @@ export const WalletCardPressableBase = ({ testID, accessibilityLabel, children -}: React.PropsWithChildren) => { +}: PropsWithChildren) => { const { onPressIn, onPressOut, scaleAnimatedStyle } = useScaleAnimation(); if (onPress === undefined) { diff --git a/ts/features/wallet/components/WalletCardSkeleton.tsx b/ts/features/wallet/components/WalletCardSkeleton.tsx index c8329e09ecc..eaa868e0524 100644 --- a/ts/features/wallet/components/WalletCardSkeleton.tsx +++ b/ts/features/wallet/components/WalletCardSkeleton.tsx @@ -1,5 +1,4 @@ import { IOColors, VSpacer } from "@pagopa/io-app-design-system"; -import React from "react"; import { StyleSheet, View } from "react-native"; import Placeholder, { BoxProps } from "rn-placeholder"; import { withWalletCardBaseComponent } from "./WalletCardBaseComponent"; diff --git a/ts/features/wallet/components/WalletCardsCategoryContainer.tsx b/ts/features/wallet/components/WalletCardsCategoryContainer.tsx index d05ecc5de66..32684465c87 100644 --- a/ts/features/wallet/components/WalletCardsCategoryContainer.tsx +++ b/ts/features/wallet/components/WalletCardsCategoryContainer.tsx @@ -1,5 +1,4 @@ import { ListItemHeader, WithTestID } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { Platform, StyleSheet } from "react-native"; import Animated, { FadeInDown, diff --git a/ts/features/wallet/components/WalletCardsCategoryRetryErrorBanner.tsx b/ts/features/wallet/components/WalletCardsCategoryRetryErrorBanner.tsx index d4f7a9c0f2e..1d10f39e799 100644 --- a/ts/features/wallet/components/WalletCardsCategoryRetryErrorBanner.tsx +++ b/ts/features/wallet/components/WalletCardsCategoryRetryErrorBanner.tsx @@ -1,5 +1,4 @@ import * as pot from "@pagopa/ts-commons/lib/pot"; -import * as React from "react"; import { View } from "react-native"; import { BannerErrorState } from "../../../components/ui/BannerErrorState"; import I18n from "../../../i18n"; diff --git a/ts/features/wallet/components/WalletCardsContainer.tsx b/ts/features/wallet/components/WalletCardsContainer.tsx index 9d08e1c2a8b..8b45cb2b996 100644 --- a/ts/features/wallet/components/WalletCardsContainer.tsx +++ b/ts/features/wallet/components/WalletCardsContainer.tsx @@ -1,6 +1,6 @@ import { IOStyles, ListItemHeader } from "@pagopa/io-app-design-system"; import { useFocusEffect } from "@react-navigation/native"; -import * as React from "react"; +import { useCallback, useMemo } from "react"; import { View } from "react-native"; import Animated, { LinearTransition } from "react-native-reanimated"; import I18n from "../../../i18n"; @@ -56,14 +56,14 @@ const WalletCardsContainer = () => { const shouldRenderLoadingState = isLoading && isWalletEmpty; // Returns true if no category filter is selected or if the filter matches the given category - const shouldRenderCategory = React.useCallback( + const shouldRenderCategory = useCallback( (filter: WalletCardCategoryFilter): boolean => selectedCategory === undefined || selectedCategory === filter, [selectedCategory] ); // Content to render in the wallet screen, based on the current state - const walletContent = React.useMemo(() => { + const walletContent = useMemo(() => { if (shouldRenderLoadingState) { return ; } @@ -116,14 +116,14 @@ const ItwWalletCardsContainer = () => { ); useFocusEffect( - React.useCallback( + useCallback( // Automatically dismiss the bottom sheet when focus is lost () => eidInfoBottomSheet.dismiss, [eidInfoBottomSheet.dismiss] ) ); - const sectionHeader = React.useMemo((): ListItemHeader | undefined => { + const sectionHeader = useMemo((): ListItemHeader | undefined => { if (!isItwValid) { return undefined; } @@ -178,7 +178,7 @@ const OtherWalletCardsContainer = () => { const cards = useIOSelector(selectWalletOtherCards); const categories = useIOSelector(selectWalletCategories); - const sectionHeader = React.useMemo((): ListItemHeader | undefined => { + const sectionHeader = useMemo((): ListItemHeader | undefined => { // The section header must be displayed only if there are more categories if (categories.size <= 1) { return undefined; diff --git a/ts/features/wallet/components/WalletCategoryFilterTabs.tsx b/ts/features/wallet/components/WalletCategoryFilterTabs.tsx index 9cec1e0534e..5632db064bc 100644 --- a/ts/features/wallet/components/WalletCategoryFilterTabs.tsx +++ b/ts/features/wallet/components/WalletCategoryFilterTabs.tsx @@ -3,7 +3,7 @@ import { TabItem, TabNavigation } from "@pagopa/io-app-design-system"; -import React from "react"; +import { useMemo } from "react"; import { StyleSheet, View } from "react-native"; import I18n from "../../../i18n"; import { useIODispatch, useIOSelector } from "../../../store/hooks"; @@ -26,7 +26,7 @@ const WalletCategoryFilterTabs = () => { const selectedCategory = useIOSelector(selectWalletCategoryFilter); const categories = useIOSelector(selectWalletCategories); - const selectedIndex = React.useMemo( + const selectedIndex = useMemo( () => selectedCategory ? walletCardCategoryFilters.indexOf(selectedCategory) + 1 diff --git a/ts/features/wallet/components/WalletEmptyScreenContent.tsx b/ts/features/wallet/components/WalletEmptyScreenContent.tsx index 41c89403a22..d601e402e3a 100644 --- a/ts/features/wallet/components/WalletEmptyScreenContent.tsx +++ b/ts/features/wallet/components/WalletEmptyScreenContent.tsx @@ -5,7 +5,6 @@ import { Pictogram, VSpacer } from "@pagopa/io-app-design-system"; -import React from "react"; import { StyleSheet, View } from "react-native"; import I18n from "../../../i18n"; import { useIONavigation } from "../../../navigation/params/AppParamsList"; diff --git a/ts/features/wallet/components/__tests__/WalletCardBaseComponent.test.tsx b/ts/features/wallet/components/__tests__/WalletCardBaseComponent.test.tsx index c6a581b0dc1..12b618d23c3 100644 --- a/ts/features/wallet/components/__tests__/WalletCardBaseComponent.test.tsx +++ b/ts/features/wallet/components/__tests__/WalletCardBaseComponent.test.tsx @@ -1,6 +1,5 @@ import { H3 } from "@pagopa/io-app-design-system"; import { render } from "@testing-library/react-native"; -import React from "react"; import { withWalletCardBaseComponent } from "../WalletCardBaseComponent"; jest.mock("react-native-reanimated", () => ({ diff --git a/ts/features/wallet/components/__tests__/WalletCardsCategoryContainer.test.tsx b/ts/features/wallet/components/__tests__/WalletCardsCategoryContainer.test.tsx index 27e3c46c55f..a3e82c0893e 100644 --- a/ts/features/wallet/components/__tests__/WalletCardsCategoryContainer.test.tsx +++ b/ts/features/wallet/components/__tests__/WalletCardsCategoryContainer.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import configureMockStore from "redux-mock-store"; import ROUTES from "../../../../navigation/routes"; import { applicationChangeState } from "../../../../store/actions/application"; diff --git a/ts/features/wallet/components/__tests__/WalletCardsContainer.test.tsx b/ts/features/wallet/components/__tests__/WalletCardsContainer.test.tsx index c364c9f9a4f..c78c5bc00e9 100644 --- a/ts/features/wallet/components/__tests__/WalletCardsContainer.test.tsx +++ b/ts/features/wallet/components/__tests__/WalletCardsContainer.test.tsx @@ -1,6 +1,7 @@ import * as O from "fp-ts/lib/Option"; import _ from "lodash"; -import * as React from "react"; + +import { ComponentType } from "react"; import configureMockStore from "redux-mock-store"; import { Alert } from "react-native"; import ROUTES from "../../../../navigation/routes"; @@ -469,7 +470,7 @@ describe("OtherWalletCardsContainer", () => { }); }); -const renderComponent = (component: React.ComponentType) => { +const renderComponent = (component: ComponentType) => { const globalState = appReducer(undefined, applicationChangeState("active")); const mockStore = configureMockStore(); diff --git a/ts/features/wallet/components/__tests__/WalletEmptyScreenContent.test.tsx b/ts/features/wallet/components/__tests__/WalletEmptyScreenContent.test.tsx index d67bb76cdf6..e38406066bb 100644 --- a/ts/features/wallet/components/__tests__/WalletEmptyScreenContent.test.tsx +++ b/ts/features/wallet/components/__tests__/WalletEmptyScreenContent.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import configureMockStore from "redux-mock-store"; import ROUTES from "../../../../navigation/routes"; import { applicationChangeState } from "../../../../store/actions/application"; diff --git a/ts/features/wallet/screens/WalletHomeScreen.tsx b/ts/features/wallet/screens/WalletHomeScreen.tsx index d9015f74d90..495f5d579fc 100644 --- a/ts/features/wallet/screens/WalletHomeScreen.tsx +++ b/ts/features/wallet/screens/WalletHomeScreen.tsx @@ -1,13 +1,6 @@ import { IOToast } from "@pagopa/io-app-design-system"; import { useFocusEffect } from "@react-navigation/native"; -import { - default as React, - useCallback, - useEffect, - useMemo, - useRef, - useState -} from "react"; +import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import Animated, { useAnimatedRef } from "react-native-reanimated"; import { IOScrollView, diff --git a/ts/features/wallet/utils/index.tsx b/ts/features/wallet/utils/index.tsx index e2dad27dfdd..a59408a14c1 100644 --- a/ts/features/wallet/utils/index.tsx +++ b/ts/features/wallet/utils/index.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { WalletCard, WalletCardType } from "../types"; import { WalletCardBaseComponent } from "../components/WalletCardBaseComponent"; import { CgnWalletCard } from "../../bonus/cgn/components/CgnWalletCard"; diff --git a/ts/features/zendesk/navigation/navigator.tsx b/ts/features/zendesk/navigation/navigator.tsx index 67d5c68bac7..3c498f6b90e 100644 --- a/ts/features/zendesk/navigation/navigator.tsx +++ b/ts/features/zendesk/navigation/navigator.tsx @@ -1,5 +1,4 @@ import { createStackNavigator } from "@react-navigation/stack"; -import * as React from "react"; import { isGestureEnabled } from "../../../utils/navigation"; import ZendeskAskPermissions from "../screens/ZendeskAskPermissions"; import ZendeskAskSeeReportsPermissions from "../screens/ZendeskAskSeeReportsPermissions"; diff --git a/ts/features/zendesk/screens/RequestZandeskTokenErrorScreen.tsx b/ts/features/zendesk/screens/RequestZandeskTokenErrorScreen.tsx index 465ec60b302..eb39cd70f67 100644 --- a/ts/features/zendesk/screens/RequestZandeskTokenErrorScreen.tsx +++ b/ts/features/zendesk/screens/RequestZandeskTokenErrorScreen.tsx @@ -1,4 +1,4 @@ -import React, { useCallback } from "react"; +import { useCallback } from "react"; import { OperationResultScreenContent } from "../../../components/screens/OperationResultScreenContent"; import I18n from "../../../i18n"; import { useIODispatch } from "../../../store/hooks"; diff --git a/ts/features/zendesk/screens/ZendeskAskPermissions.tsx b/ts/features/zendesk/screens/ZendeskAskPermissions.tsx index b21331a7d07..2ee136205bc 100644 --- a/ts/features/zendesk/screens/ZendeskAskPermissions.tsx +++ b/ts/features/zendesk/screens/ZendeskAskPermissions.tsx @@ -12,17 +12,15 @@ import { RouteProp, useRoute } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; import { constNull, pipe } from "fp-ts/lib/function"; import _ from "lodash"; -import { - ComponentProps, - default as React, - useCallback, - useEffect -} from "react"; +import { ComponentProps, useCallback, useEffect } from "react"; import { FlatList, ListRenderItemInfo, Platform } from "react-native"; +import LoadingSpinnerOverlay from "../../../components/LoadingSpinnerOverlay"; import { IOScrollViewWithLargeHeader } from "../../../components/ui/IOScrollViewWithLargeHeader"; import { zendeskPrivacyUrl } from "../../../config"; +import { useHeaderSecondLevel } from "../../../hooks/useHeaderSecondLevel"; import I18n from "../../../i18n"; import { mixpanelTrack } from "../../../mixpanel"; +import { useIONavigation } from "../../../navigation/params/AppParamsList"; import { useIODispatch, useIOSelector } from "../../../store/hooks"; import { idpSelector, @@ -56,11 +54,12 @@ import { setUserIdentity, zendeskCurrentAppVersionId, zendeskDeviceAndOSId, - zendeskVersionsHistoryId, - zendeskidentityProviderId + zendeskidentityProviderId, + zendeskVersionsHistoryId } from "../../../utils/supportAssistance"; import { handleItemOnPress, openWebUrl } from "../../../utils/url"; import { ZendeskParamsList } from "../navigation/params"; +import ZENDESK_ROUTES from "../navigation/routes"; import { zendeskStopPolling, zendeskSupportCompleted, @@ -72,10 +71,6 @@ import { zendeskSelectedSubcategorySelector, ZendeskTokenStatusEnum } from "../store/reducers"; -import { useHeaderSecondLevel } from "../../../hooks/useHeaderSecondLevel"; -import LoadingSpinnerOverlay from "../../../components/LoadingSpinnerOverlay"; -import ZENDESK_ROUTES from "../navigation/routes"; -import { useIONavigation } from "../../../navigation/params/AppParamsList"; /** * Transform an array of string into a Zendesk diff --git a/ts/features/zendesk/screens/ZendeskAskSeeReportsPermissions.tsx b/ts/features/zendesk/screens/ZendeskAskSeeReportsPermissions.tsx index 600004189a0..5e8d27279f1 100644 --- a/ts/features/zendesk/screens/ZendeskAskSeeReportsPermissions.tsx +++ b/ts/features/zendesk/screens/ZendeskAskSeeReportsPermissions.tsx @@ -11,7 +11,7 @@ import { import { useNavigation } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React, { ComponentProps } from "react"; +import { ComponentProps } from "react"; import { FlatList, ListRenderItemInfo } from "react-native"; import { IOScrollViewWithLargeHeader } from "../../../components/ui/IOScrollViewWithLargeHeader"; import { zendeskPrivacyUrl } from "../../../config"; diff --git a/ts/features/zendesk/screens/ZendeskChooseCategory.tsx b/ts/features/zendesk/screens/ZendeskChooseCategory.tsx index 355f2addbcc..23e8bae8401 100644 --- a/ts/features/zendesk/screens/ZendeskChooseCategory.tsx +++ b/ts/features/zendesk/screens/ZendeskChooseCategory.tsx @@ -3,7 +3,6 @@ import { IOVisualCostants, ListItemNav } from "@pagopa/io-app-design-system"; -import React from "react"; import { FlatList, ListRenderItemInfo } from "react-native"; import { ZendeskCategory } from "../../../../definitions/content/ZendeskCategory"; import { isReady } from "../../../common/model/RemoteValue"; diff --git a/ts/features/zendesk/screens/ZendeskChooseSubCategory.tsx b/ts/features/zendesk/screens/ZendeskChooseSubCategory.tsx index 5120841f141..0d3b94a21fa 100644 --- a/ts/features/zendesk/screens/ZendeskChooseSubCategory.tsx +++ b/ts/features/zendesk/screens/ZendeskChooseSubCategory.tsx @@ -3,7 +3,6 @@ import { IOVisualCostants, ListItemNav } from "@pagopa/io-app-design-system"; -import React from "react"; import { FlatList, ListRenderItemInfo } from "react-native"; import { ZendeskSubCategory } from "../../../../definitions/content/ZendeskSubCategory"; import { IOScrollViewWithLargeHeader } from "../../../components/ui/IOScrollViewWithLargeHeader"; diff --git a/ts/features/zendesk/screens/ZendeskPanicMode.tsx b/ts/features/zendesk/screens/ZendeskPanicMode.tsx index 832a84a4892..c2b5bdb6662 100644 --- a/ts/features/zendesk/screens/ZendeskPanicMode.tsx +++ b/ts/features/zendesk/screens/ZendeskPanicMode.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { OperationResultScreenContent } from "../../../components/screens/OperationResultScreenContent"; import I18n from "../../../i18n"; import { useIODispatch } from "../../../store/hooks"; diff --git a/ts/features/zendesk/screens/ZendeskSeeReportsRouters.tsx b/ts/features/zendesk/screens/ZendeskSeeReportsRouters.tsx index 0ac1e63852b..41a4dbb9a25 100644 --- a/ts/features/zendesk/screens/ZendeskSeeReportsRouters.tsx +++ b/ts/features/zendesk/screens/ZendeskSeeReportsRouters.tsx @@ -1,6 +1,7 @@ import * as pot from "@pagopa/ts-commons/lib/pot"; import { useNavigation } from "@react-navigation/native"; -import React, { useCallback, useEffect } from "react"; +import { useCallback, useEffect } from "react"; + import LoadingScreenContent from "../../../components/screens/LoadingScreenContent"; import { OperationResultScreenContent } from "../../../components/screens/OperationResultScreenContent"; import I18n from "../../../i18n"; @@ -77,7 +78,7 @@ const ZendeskSeeReportsRouters = (props: Props) => { dispatch(zendeskRequestTicketNumber.request()); }, [dispatch, zendeskToken]); - const handleContactSupportPress = React.useCallback( + const handleContactSupportPress = useCallback( () => handleContactSupport( navigation, diff --git a/ts/features/zendesk/screens/ZendeskSupportHelpCenter.tsx b/ts/features/zendesk/screens/ZendeskSupportHelpCenter.tsx index 0e80ff4eb33..1f0f95be021 100644 --- a/ts/features/zendesk/screens/ZendeskSupportHelpCenter.tsx +++ b/ts/features/zendesk/screens/ZendeskSupportHelpCenter.tsx @@ -16,13 +16,14 @@ import * as pot from "@pagopa/ts-commons/lib/pot"; import { RouteProp, useNavigation, useRoute } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React, { +import { useCallback, useEffect, useLayoutEffect, useMemo, useState } from "react"; + import { FlatList, ListRenderItemInfo } from "react-native"; import Animated, { useAnimatedRef } from "react-native-reanimated"; import _ from "lodash"; @@ -289,7 +290,7 @@ const ZendeskSupportHelpCenter = () => { ] ); - const handleButtonPress = React.useCallback( + const handleButtonPress = useCallback( (value: ButtonPressedEnum) => { setPressedButton(value); if (isUserLoggedIn) { diff --git a/ts/hooks/__tests__/useConfirmationChecks.test.tsx b/ts/hooks/__tests__/useConfirmationChecks.test.tsx index 67eaf0e5c65..7bf6cfea69f 100644 --- a/ts/hooks/__tests__/useConfirmationChecks.test.tsx +++ b/ts/hooks/__tests__/useConfirmationChecks.test.tsx @@ -1,5 +1,4 @@ import { fireEvent, render } from "@testing-library/react-native"; -import React from "react"; import { Text, TouchableOpacity, View } from "react-native"; import { useConfirmationChecks } from "../useConfirmationChecks"; diff --git a/ts/hooks/__tests__/useNavigateToLoginMethod.test.tsx b/ts/hooks/__tests__/useNavigateToLoginMethod.test.tsx index 72a2d808bb7..be2aa69b2c3 100644 --- a/ts/hooks/__tests__/useNavigateToLoginMethod.test.tsx +++ b/ts/hooks/__tests__/useNavigateToLoginMethod.test.tsx @@ -1,5 +1,4 @@ import { fireEvent, render } from "@testing-library/react-native"; -import React from "react"; import { View } from "react-native"; import { ButtonSolid } from "@pagopa/io-app-design-system"; import * as rnCieId from "@pagopa/io-react-native-cieid"; diff --git a/ts/hooks/useConfirmationChecks.ts b/ts/hooks/useConfirmationChecks.ts index 44b6e9d402e..c614071b814 100644 --- a/ts/hooks/useConfirmationChecks.ts +++ b/ts/hooks/useConfirmationChecks.ts @@ -1,4 +1,4 @@ -import React from "react"; +import { useState } from "react"; type ConfirmationChecks = { values: ReadonlyArray; @@ -14,7 +14,7 @@ export const useConfirmationChecks = (length: number): ConfirmationChecks => { /** * State that holds an array of booleans, indicating whether the corresponding index contains a confirmed check. */ - const [values, setValues] = React.useState>( + const [values, setValues] = useState>( Array.from({ length }, () => false) ); diff --git a/ts/hooks/useCreatePin.tsx b/ts/hooks/useCreatePin.tsx index d56cfc4451f..aba6b895844 100644 --- a/ts/hooks/useCreatePin.tsx +++ b/ts/hooks/useCreatePin.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { useMemo, useCallback } from "react"; import { useIOToast } from "@pagopa/io-app-design-system"; import { AccessibilityInfo, Platform } from "react-native"; import I18n from "../i18n"; @@ -29,14 +29,14 @@ export const useCreatePin = (props = { isOnboarding: false }) => { const assistanceToolConfig = useIOSelector(assistanceToolConfigSelector); const dispatch = useIODispatch(); - const assistanceTool = React.useMemo( + const assistanceTool = useMemo( () => assistanceToolRemoteConfig(assistanceToolConfig), [assistanceToolConfig] ); const isFirstOnBoarding = useIOSelector(isProfileFirstOnBoardingSelector); - const handleSubmit = React.useCallback( + const handleSubmit = useCallback( (pin: PinString) => { setPin(pin) .then(() => { diff --git a/ts/hooks/useDebugInfo.ts b/ts/hooks/useDebugInfo.ts index b524e6b63fb..13f444abe8b 100644 --- a/ts/hooks/useDebugInfo.ts +++ b/ts/hooks/useDebugInfo.ts @@ -1,5 +1,5 @@ import { useFocusEffect } from "@react-navigation/native"; -import React from "react"; +import { useCallback } from "react"; import { resetDebugData, setDebugData } from "../store/actions/debug"; import { useIODispatch, useIOSelector } from "../store/hooks"; import { isDebugModeEnabledSelector } from "../store/reducers/debug"; @@ -13,7 +13,7 @@ export const useDebugInfo = (data: Record) => { const isDebug = useIOSelector(isDebugModeEnabledSelector); useFocusEffect( - React.useCallback(() => { + useCallback(() => { // Avoids storing debug data if debug is disabled if (!isDebug) { return undefined; diff --git a/ts/hooks/useHeaderFirstLevel.tsx b/ts/hooks/useHeaderFirstLevel.tsx index c423c0f5c0d..03265568a76 100644 --- a/ts/hooks/useHeaderFirstLevel.tsx +++ b/ts/hooks/useHeaderFirstLevel.tsx @@ -1,5 +1,4 @@ import { HeaderActionProps } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { useLayoutEffect } from "react"; import HeaderFirstLevel from "../components/ui/HeaderFirstLevel"; import { useIONavigation } from "../navigation/params/AppParamsList"; diff --git a/ts/hooks/useHeaderSecondLevel.tsx b/ts/hooks/useHeaderSecondLevel.tsx index e916aa751c6..3c57a0ef63a 100644 --- a/ts/hooks/useHeaderSecondLevel.tsx +++ b/ts/hooks/useHeaderSecondLevel.tsx @@ -3,7 +3,7 @@ import { HeaderSecondLevel } from "@pagopa/io-app-design-system"; import { useNavigation } from "@react-navigation/native"; -import * as React from "react"; + import { ComponentProps, useLayoutEffect, useMemo } from "react"; import { ContextualHelpProps, @@ -40,7 +40,7 @@ type HeaderHookManagedProps = Pick< >; type HeaderActionConfigProps = Pick< - React.ComponentProps, + ComponentProps, "type" | "firstAction" | "secondAction" | "thirdAction" >; diff --git a/ts/hooks/useNavigationSwipeBackListener.tsx b/ts/hooks/useNavigationSwipeBackListener.tsx index 5dadf4f2879..61e5e432262 100644 --- a/ts/hooks/useNavigationSwipeBackListener.tsx +++ b/ts/hooks/useNavigationSwipeBackListener.tsx @@ -1,6 +1,6 @@ import { EventListenerCallback } from "@react-navigation/native"; import { StackNavigationEventMap } from "@react-navigation/stack/lib/typescript/src/types"; -import React from "react"; +import { useState, useCallback, useEffect } from "react"; import { useIONavigation } from "../navigation/params/AppParamsList"; /** @@ -23,9 +23,9 @@ import { useIONavigation } from "../navigation/params/AppParamsList"; */ export const useNavigationSwipeBackListener = (handler: () => void) => { const navigation = useIONavigation(); - const [withGesture, setWithGesture] = React.useState(false); + const [withGesture, setWithGesture] = useState(false); - const handleTransitionEnd = React.useCallback< + const handleTransitionEnd = useCallback< EventListenerCallback >( ({ data }) => { @@ -43,7 +43,7 @@ export const useNavigationSwipeBackListener = (handler: () => void) => { [handler] ); - React.useEffect(() => { + useEffect(() => { // `transitionEnd` event is triggered everytime there is a screen transition, even if not triggered by a gesture. // We need to listen the `transitionEnd` event only after a gesture is started if (withGesture) { @@ -54,14 +54,14 @@ export const useNavigationSwipeBackListener = (handler: () => void) => { return undefined; }, [navigation, withGesture, handleTransitionEnd]); - const handleGestureEnd = React.useCallback< + const handleGestureEnd = useCallback< EventListenerCallback >(() => { // Everytime the user ands a swipe gesture (any direction), we save it to the state by mutating `setWithGesture` to true setWithGesture(true); }, [setWithGesture]); - React.useEffect( + useEffect( () => navigation.addListener("gestureEnd", handleGestureEnd), [navigation, handleGestureEnd] ); diff --git a/ts/hooks/useSecuritySuggestionBottomSheet.tsx b/ts/hooks/useSecuritySuggestionBottomSheet.tsx index 1e1ffe70ecf..6ad1630eabd 100644 --- a/ts/hooks/useSecuritySuggestionBottomSheet.tsx +++ b/ts/hooks/useSecuritySuggestionBottomSheet.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect } from "react"; +import { useCallback, useEffect } from "react"; import { isFastLoginFFEnabledSelector, isSecurityAdviceAcknowledgedEnabled, diff --git a/ts/navigation/AppStackNavigator.tsx b/ts/navigation/AppStackNavigator.tsx index 18198d9a396..330463a8ec1 100644 --- a/ts/navigation/AppStackNavigator.tsx +++ b/ts/navigation/AppStackNavigator.tsx @@ -5,7 +5,8 @@ import { NavigationContainer, NavigationContainerProps } from "@react-navigation/native"; -import React, { useRef } from "react"; +import { PropsWithChildren, ReactElement, useEffect, useRef } from "react"; + import { View } from "react-native"; import { useStoredExperimentalDesign } from "../common/context/DSExperimentalContext"; import LoadingSpinnerOverlay from "../components/LoadingSpinnerOverlay"; @@ -51,7 +52,7 @@ const isMainNavigatorReady = (state: OnStateChangeStateType) => state.routes.length > 0 && state.routes[0].name === ROUTES.MAIN; -export const AppStackNavigator = (): React.ReactElement => { +export const AppStackNavigator = (): ReactElement => { // This hook is used since we are in a child of the Context Provider // to setup the experimental design system value from AsyncStorage // remove this once the experimental design system is stable @@ -61,7 +62,7 @@ export const AppStackNavigator = (): React.ReactElement => { const startupStatus = useIOSelector(isStartupLoaded); - React.useEffect(() => { + useEffect(() => { dispatch(startApplicationInitialization()); }, [dispatch]); @@ -76,7 +77,7 @@ export const AppStackNavigator = (): React.ReactElement => { return ; }; -type InnerNavigationContainerProps = React.PropsWithChildren<{ +type InnerNavigationContainerProps = PropsWithChildren<{ routingInstrumentation?: ReactNavigationInstrumentation; }>; diff --git a/ts/navigation/AuthenticatedStackNavigator.tsx b/ts/navigation/AuthenticatedStackNavigator.tsx index 7191ba8ac12..adc41a62d0a 100644 --- a/ts/navigation/AuthenticatedStackNavigator.tsx +++ b/ts/navigation/AuthenticatedStackNavigator.tsx @@ -2,7 +2,6 @@ import { createStackNavigator, TransitionPresets } from "@react-navigation/stack"; -import React from "react"; import { Platform } from "react-native"; import WorkunitGenericFailure from "../components/error/WorkunitGenericFailure"; import { BarcodeScanScreen } from "../features/barcode/screens/BarcodeScanScreen"; diff --git a/ts/navigation/AuthenticationNavigator.tsx b/ts/navigation/AuthenticationNavigator.tsx index 245eef80bf3..add39492cc9 100644 --- a/ts/navigation/AuthenticationNavigator.tsx +++ b/ts/navigation/AuthenticationNavigator.tsx @@ -2,7 +2,6 @@ import { TransitionPresets, createStackNavigator } from "@react-navigation/stack"; -import * as React from "react"; import { IOVisualCostants } from "@pagopa/io-app-design-system"; import { Platform } from "react-native"; import CieLoginConfigScreen from "../features/cieLogin/components/screens/CieLoginConfigScreen"; diff --git a/ts/navigation/CheckEmailNavigator.tsx b/ts/navigation/CheckEmailNavigator.tsx index 2a3e0866b92..8ffe54ac8d3 100644 --- a/ts/navigation/CheckEmailNavigator.tsx +++ b/ts/navigation/CheckEmailNavigator.tsx @@ -1,5 +1,4 @@ import { createStackNavigator } from "@react-navigation/stack"; -import * as React from "react"; import { isGestureEnabled } from "../utils/navigation"; import ValidateEmailScreen from "../screens/profile/mailCheck/ValidateEmailScreen"; import EmailAlreadyTakenScreen from "../screens/profile/mailCheck/EmailAlreadyTakenScreen"; diff --git a/ts/navigation/NavigationService.ts b/ts/navigation/NavigationService.ts index d843814a878..bb42aae7b33 100644 --- a/ts/navigation/NavigationService.ts +++ b/ts/navigation/NavigationService.ts @@ -3,12 +3,12 @@ import { NavigationContainerRef } from "@react-navigation/native"; import { Route } from "@react-navigation/routers"; -import React from "react"; + +import { createRef, RefObject } from "react"; import { mixpanelTrack } from "../mixpanel"; import { AppParamsList } from "./params/AppParamsList"; -export const navigationRef = - React.createRef>(); +export const navigationRef = createRef>(); // eslint-disable-next-line functional/no-let let isNavigationReady: boolean = false; @@ -38,9 +38,8 @@ const withLogging = }; // NavigationContainerComponent -const getNavigator = (): React.RefObject< - NavigationContainerRef -> => navigationRef; +const getNavigator = (): RefObject> => + navigationRef; // NavigationParams // This definition comes from react-navigation navigate definition. diff --git a/ts/navigation/NotAuthenticatedStackNavigator.tsx b/ts/navigation/NotAuthenticatedStackNavigator.tsx index 1fe8c5ac874..74037f9659a 100644 --- a/ts/navigation/NotAuthenticatedStackNavigator.tsx +++ b/ts/navigation/NotAuthenticatedStackNavigator.tsx @@ -1,5 +1,4 @@ import { createStackNavigator } from "@react-navigation/stack"; -import * as React from "react"; import { ZendeskStackNavigator } from "../features/zendesk/navigation/navigator"; import ZENDESK_ROUTES from "../features/zendesk/navigation/routes"; import AuthenticationNavigator from "./AuthenticationNavigator"; diff --git a/ts/navigation/OnboardingNavigator.tsx b/ts/navigation/OnboardingNavigator.tsx index fbba8e030cf..85c7dd24520 100644 --- a/ts/navigation/OnboardingNavigator.tsx +++ b/ts/navigation/OnboardingNavigator.tsx @@ -1,5 +1,4 @@ import { createStackNavigator } from "@react-navigation/stack"; -import * as React from "react"; import OnboardingCompletedScreen from "../screens/onboarding/OnboardingCompletedScreen"; import { OnboardingNotificationsInfoScreenConsent } from "../features/pushNotifications/screens/OnboardingNotificationsInfoScreenConsent"; import { OnboardingNotificationsPreferencesScreen } from "../features/pushNotifications/screens/OnboardingNotificationsPreferencesScreen"; diff --git a/ts/navigation/ProfileNavigator.tsx b/ts/navigation/ProfileNavigator.tsx index 1b5909d20c4..1456c497ada 100644 --- a/ts/navigation/ProfileNavigator.tsx +++ b/ts/navigation/ProfileNavigator.tsx @@ -1,5 +1,4 @@ import { createStackNavigator } from "@react-navigation/stack"; -import * as React from "react"; import LogoutScreen from "../components/screens/LogoutScreen"; import { DesignSystemNavigator } from "../features/design-system/navigation/navigator"; import LollipopPlayground from "../features/lollipop/playgrounds/LollipopPlayground"; diff --git a/ts/navigation/TabNavigator.tsx b/ts/navigation/TabNavigator.tsx index 42f081e5d19..9d49c321bf3 100644 --- a/ts/navigation/TabNavigator.tsx +++ b/ts/navigation/TabNavigator.tsx @@ -4,7 +4,6 @@ import { useIOTheme } from "@pagopa/io-app-design-system"; import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; -import React from "react"; import LoadingSpinnerOverlay from "../components/LoadingSpinnerOverlay"; import { TabIconComponent } from "../components/ui/TabIconComponent"; import { MESSAGES_ROUTES } from "../features/messages/navigation/routes"; diff --git a/ts/navigation/components/CloseButton.tsx b/ts/navigation/components/CloseButton.tsx index f81a3f4fa35..c2c4c42aa10 100644 --- a/ts/navigation/components/CloseButton.tsx +++ b/ts/navigation/components/CloseButton.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { IOVisualCostants, IconButton } from "@pagopa/io-app-design-system"; import { useNavigation } from "@react-navigation/native"; import { View } from "react-native"; diff --git a/ts/screens/authentication/AuthErrorScreen.tsx b/ts/screens/authentication/AuthErrorScreen.tsx index a8cca27fde7..86787ba198a 100644 --- a/ts/screens/authentication/AuthErrorScreen.tsx +++ b/ts/screens/authentication/AuthErrorScreen.tsx @@ -3,7 +3,7 @@ import { Route, useRoute } from "@react-navigation/native"; -import React, { useCallback } from "react"; +import { useCallback } from "react"; import { useIONavigation } from "../../navigation/params/AppParamsList"; import ROUTES from "../../navigation/routes"; import { CieIdLoginProps } from "../../features/cieLogin/components/CieIdLoginWebView"; diff --git a/ts/screens/authentication/IdpLoginScreen.tsx b/ts/screens/authentication/IdpLoginScreen.tsx index 8f0b31a3d2b..d4d9f1ce792 100644 --- a/ts/screens/authentication/IdpLoginScreen.tsx +++ b/ts/screens/authentication/IdpLoginScreen.tsx @@ -1,7 +1,7 @@ import * as pot from "@pagopa/ts-commons/lib/pot"; import { pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; -import React, { memo, useCallback, useEffect, useMemo, useState } from "react"; +import { memo, useCallback, useEffect, useMemo, useState } from "react"; import { Linking, StyleSheet, View } from "react-native"; import { WebView } from "react-native-webview"; import { diff --git a/ts/screens/authentication/IdpSelectionScreen.tsx b/ts/screens/authentication/IdpSelectionScreen.tsx index cf44b6c6e5e..1c07c1b889e 100644 --- a/ts/screens/authentication/IdpSelectionScreen.tsx +++ b/ts/screens/authentication/IdpSelectionScreen.tsx @@ -1,4 +1,4 @@ -import React, { +import { ReactElement, createRef, useCallback, diff --git a/ts/screens/authentication/LandingScreen.tsx b/ts/screens/authentication/LandingScreen.tsx index 138df25e5fb..0d83c29f6d0 100644 --- a/ts/screens/authentication/LandingScreen.tsx +++ b/ts/screens/authentication/LandingScreen.tsx @@ -13,7 +13,7 @@ import { } from "@pagopa/io-app-design-system"; import * as O from "fp-ts/lib/Option"; import JailMonkey from "jail-monkey"; -import React, { +import { useState, useEffect, useMemo, diff --git a/ts/screens/authentication/OptInScreen.tsx b/ts/screens/authentication/OptInScreen.tsx index d62ec10c87a..9452cee293c 100644 --- a/ts/screens/authentication/OptInScreen.tsx +++ b/ts/screens/authentication/OptInScreen.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { useRef } from "react"; import { Dimensions, View } from "react-native"; import { Badge, @@ -69,7 +69,7 @@ const OptInScreen = () => { contextualHelpMarkdown }); - const accessibilityFirstFocuseViewRef = React.useRef(null); + const accessibilityFirstFocuseViewRef = useRef(null); const dispatch = useIODispatch(); const { securitySuggestionBottomSheet, diff --git a/ts/screens/authentication/TestAuthenticationScreen.tsx b/ts/screens/authentication/TestAuthenticationScreen.tsx index 5d91a8433b0..4d1ef25df2b 100644 --- a/ts/screens/authentication/TestAuthenticationScreen.tsx +++ b/ts/screens/authentication/TestAuthenticationScreen.tsx @@ -13,7 +13,7 @@ import * as T from "fp-ts/lib/Task"; import * as O from "fp-ts/lib/Option"; import * as TE from "fp-ts/lib/TaskEither"; import { pipe } from "fp-ts/lib/function"; -import React, { useCallback, useState } from "react"; +import { useCallback, useState } from "react"; import { StyleSheet, View } from "react-native"; import { PasswordLogin } from "../../../definitions/session_manager/PasswordLogin"; import { IOStyles } from "../../components/core/variables/IOStyles"; diff --git a/ts/screens/authentication/UnlockAccessComponent.tsx b/ts/screens/authentication/UnlockAccessComponent.tsx index f8da36ae720..10f70c50dee 100644 --- a/ts/screens/authentication/UnlockAccessComponent.tsx +++ b/ts/screens/authentication/UnlockAccessComponent.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { Body, FeatureInfo, diff --git a/ts/screens/authentication/UnlockAccessScreen.tsx b/ts/screens/authentication/UnlockAccessScreen.tsx index 3c5dd983f85..833738ef28c 100644 --- a/ts/screens/authentication/UnlockAccessScreen.tsx +++ b/ts/screens/authentication/UnlockAccessScreen.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { Route, useRoute } from "@react-navigation/native"; import ROUTES from "../../navigation/routes"; import UnlockAccessComponent, { diff --git a/ts/screens/authentication/__tests__/AuthErrorComponent.test.tsx b/ts/screens/authentication/__tests__/AuthErrorComponent.test.tsx index 4f41a805840..7032ae8426f 100644 --- a/ts/screens/authentication/__tests__/AuthErrorComponent.test.tsx +++ b/ts/screens/authentication/__tests__/AuthErrorComponent.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { fireEvent, render } from "@testing-library/react-native"; import I18n from "../../../i18n"; import AuthErrorComponent from "../components/AuthErrorComponent"; diff --git a/ts/screens/authentication/__tests__/UnlockAccessComponent.test.tsx b/ts/screens/authentication/__tests__/UnlockAccessComponent.test.tsx index 5f3ff318cb3..fd916a3648b 100644 --- a/ts/screens/authentication/__tests__/UnlockAccessComponent.test.tsx +++ b/ts/screens/authentication/__tests__/UnlockAccessComponent.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { render, fireEvent } from "@testing-library/react-native"; import { View } from "react-native"; import { createStore } from "redux"; diff --git a/ts/screens/authentication/carousel/Carousel.tsx b/ts/screens/authentication/carousel/Carousel.tsx index e2a55b41a15..56df8393506 100644 --- a/ts/screens/authentication/carousel/Carousel.tsx +++ b/ts/screens/authentication/carousel/Carousel.tsx @@ -1,16 +1,17 @@ import { IOColors, VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; + +import { ComponentProps, forwardRef, useCallback, useRef } from "react"; import { Animated, + GestureResponderEvent, ScrollView, - View, StyleSheet, - GestureResponderEvent, - useWindowDimensions + useWindowDimensions, + View } from "react-native"; -import { trackCarousel } from "../analytics/carouselAnalytics"; import { LandingCardComponent } from "../../../components/LandingCardComponent"; import { useInteractiveElementDefaultColorName } from "../../../utils/hooks/theme"; +import { trackCarousel } from "../analytics/carouselAnalytics"; const styles = StyleSheet.create({ normalDot: { @@ -30,9 +31,7 @@ const styles = StyleSheet.create({ const newDsGrey = IOColors["grey-200"]; type CarouselProps = { - carouselCards: ReadonlyArray< - React.ComponentProps - >; + carouselCards: ReadonlyArray>; dotEasterEggCallback?: () => void; }; @@ -40,7 +39,7 @@ type CarouselDotsProps = CarouselProps & { scrollX: Animated.Value }; const CarouselDots = (props: CarouselDotsProps) => { const { carouselCards, dotEasterEggCallback, scrollX } = props; - const dotTouchCount = React.useRef(0); + const dotTouchCount = useRef(0); const blueColor = useInteractiveElementDefaultColorName(); @@ -92,13 +91,13 @@ const CarouselDots = (props: CarouselDotsProps) => { ); }; -export const Carousel = React.forwardRef((props, ref) => { +export const Carousel = forwardRef((props, ref) => { const { carouselCards, dotEasterEggCallback } = props; const screenDimension = useWindowDimensions(); const windowWidth = screenDimension.width; - const scrollX = React.useRef(new Animated.Value(0)).current; + const scrollX = useRef(new Animated.Value(0)).current; - const renderCardComponents = React.useCallback( + const renderCardComponents = useCallback( () => carouselCards.map(p => ( { +class CieAuthorizeDataUsageScreen extends PureComponent { constructor(props: Props) { super(props); this.state = { isLoadingCompleted: false }; @@ -36,7 +37,7 @@ class CieAuthorizeDataUsageScreen extends React.PureComponent { this.setState({ isLoadingCompleted: true }); }; - public render(): React.ReactNode { + public render(): ReactNode { return ( diff --git a/ts/screens/authentication/cie/CieCardReaderScreen.tsx b/ts/screens/authentication/cie/CieCardReaderScreen.tsx index f2ddde265d6..ab28ca65324 100644 --- a/ts/screens/authentication/cie/CieCardReaderScreen.tsx +++ b/ts/screens/authentication/cie/CieCardReaderScreen.tsx @@ -18,19 +18,26 @@ import cieManager, { Event as CEvent } from "@pagopa/react-native-cie"; import { Millisecond } from "@pagopa/ts-commons/lib/units"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import * as React from "react"; + +import { useFocusEffect } from "@react-navigation/native"; +import { + PureComponent, + ReactNode, + createRef, + useCallback, + useRef +} from "react"; import { AccessibilityInfo, Platform, ScrollView, + StyleSheet, Text, Vibration, - View, - StyleSheet + View } from "react-native"; -import { connect } from "react-redux"; import { SafeAreaView } from "react-native-safe-area-context"; -import { useFocusEffect } from "@react-navigation/native"; +import { connect } from "react-redux"; import CieCardReadingAnimation, { ReadingState } from "../../../components/cie/CieCardReadingAnimation"; @@ -219,8 +226,8 @@ const getTextForState = ( /** * This screen shown while reading the card */ -class CieCardReaderScreen extends React.PureComponent { - private subTitleRef = React.createRef(); +class CieCardReaderScreen extends PureComponent { + private subTitleRef = createRef(); private choosenTool = assistanceToolRemoteConfig( this.props.assistanceToolConfig ); @@ -556,7 +563,7 @@ class CieCardReaderScreen extends React.PureComponent { ) }); - public render(): React.ReactNode { + public render(): ReactNode { return ( ( ); const Title = (props: { text: string; accessibilityLabel: string }) => { - const titleRef = React.useRef(null); + const titleRef = useRef(null); useFocusEffect( - React.useCallback(() => { + useCallback(() => { if (!titleRef.current && Platform.OS === "android") { setAccessibilityFocus(titleRef, accessibityTimeout); } diff --git a/ts/screens/authentication/cie/CieCardReaderScreenWrapper.tsx b/ts/screens/authentication/cie/CieCardReaderScreenWrapper.tsx index 2e30dc24d84..2f452ef9bbb 100644 --- a/ts/screens/authentication/cie/CieCardReaderScreenWrapper.tsx +++ b/ts/screens/authentication/cie/CieCardReaderScreenWrapper.tsx @@ -5,8 +5,6 @@ * TODO: remove this screen and refactor the CieCardReaderScreen to a functional component. * https://pagopa.atlassian.net/browse/IOPID-1857 */ -import React from "react"; - import { RouteProp, useNavigation, useRoute } from "@react-navigation/native"; import { IOStackNavigationProp } from "../../../navigation/params/AppParamsList"; import { AuthenticationParamsList } from "../../../navigation/params/AuthenticationParamsList"; diff --git a/ts/screens/authentication/cie/CieConsentDataUsageScreen.tsx b/ts/screens/authentication/cie/CieConsentDataUsageScreen.tsx index 337c8e60a5e..1e43864a494 100644 --- a/ts/screens/authentication/cie/CieConsentDataUsageScreen.tsx +++ b/ts/screens/authentication/cie/CieConsentDataUsageScreen.tsx @@ -2,7 +2,7 @@ * A screen to display, by a webview, the consent to send user sensitive data * to backend and proceed with the onboarding process */ -import React, { useCallback, useEffect, useState } from "react"; +import { useCallback, useEffect, useState } from "react"; import { WebViewHttpErrorEvent, WebViewNavigation diff --git a/ts/screens/authentication/cie/CieExpiredOrInvalidScreen.tsx b/ts/screens/authentication/cie/CieExpiredOrInvalidScreen.tsx index 2881b528280..8263a9e8475 100644 --- a/ts/screens/authentication/cie/CieExpiredOrInvalidScreen.tsx +++ b/ts/screens/authentication/cie/CieExpiredOrInvalidScreen.tsx @@ -1,4 +1,4 @@ -import React, { useCallback } from "react"; +import { useCallback } from "react"; import I18n from "../../../i18n"; import { OperationResultScreenContent } from "../../../components/screens/OperationResultScreenContent"; import { useIONavigation } from "../../../navigation/params/AppParamsList"; diff --git a/ts/screens/authentication/cie/CieExtendedApduNotSupportedScreen.tsx b/ts/screens/authentication/cie/CieExtendedApduNotSupportedScreen.tsx index bde0d1c49d1..8389df79cb4 100644 --- a/ts/screens/authentication/cie/CieExtendedApduNotSupportedScreen.tsx +++ b/ts/screens/authentication/cie/CieExtendedApduNotSupportedScreen.tsx @@ -1,7 +1,7 @@ /** * A screen to alert the user about the number of attempts remains */ -import * as React from "react"; +import { useCallback } from "react"; import I18n from "../../../i18n"; import { useIONavigation } from "../../../navigation/params/AppParamsList"; import ROUTES from "../../../navigation/routes"; @@ -10,7 +10,7 @@ import { OperationResultScreenContent } from "../../../components/screens/Operat const CieExtendedApduNotSupportedScreen = () => { const navigation = useIONavigation(); - const navigateToAuthenticationScreen = React.useCallback(() => { + const navigateToAuthenticationScreen = useCallback(() => { navigation.reset({ index: 0, routes: [{ name: ROUTES.AUTHENTICATION }] diff --git a/ts/screens/authentication/cie/CiePinScreen.tsx b/ts/screens/authentication/cie/CiePinScreen.tsx index b6a69a58373..10bd8999354 100644 --- a/ts/screens/authentication/cie/CiePinScreen.tsx +++ b/ts/screens/authentication/cie/CiePinScreen.tsx @@ -15,13 +15,8 @@ import { useIsFocused, useNavigation } from "@react-navigation/native"; -import React, { - useCallback, - useContext, - useEffect, - useRef, - useState -} from "react"; +import { useCallback, useContext, useEffect, useRef, useState } from "react"; + import { Keyboard, KeyboardAvoidingView, @@ -184,7 +179,7 @@ const CiePinScreen = () => { }, [pin, showModal]); useFocusEffect( - React.useCallback(() => { + useCallback(() => { setAccessibilityFocus(pinPadViewRef, 300 as Millisecond); }, []) ); diff --git a/ts/screens/authentication/cie/CieUnexpectedErrorScreen.tsx b/ts/screens/authentication/cie/CieUnexpectedErrorScreen.tsx index d70d7d8aaf0..e4f41daf5ca 100644 --- a/ts/screens/authentication/cie/CieUnexpectedErrorScreen.tsx +++ b/ts/screens/authentication/cie/CieUnexpectedErrorScreen.tsx @@ -1,7 +1,7 @@ /** * A screen to alert the user about the number of attempts remains */ -import * as React from "react"; +import { useCallback } from "react"; import I18n from "../../../i18n"; import { useIONavigation } from "../../../navigation/params/AppParamsList"; import ROUTES from "../../../navigation/routes"; @@ -10,13 +10,13 @@ import { OperationResultScreenContent } from "../../../components/screens/Operat const CieUnexpectedErrorScreen = () => { const navigation = useIONavigation(); - const navigateToCiePinScreen = React.useCallback(() => { + const navigateToCiePinScreen = useCallback(() => { navigation.navigate(ROUTES.AUTHENTICATION, { screen: ROUTES.CIE_PIN_SCREEN }); }, [navigation]); - const navigateToAuthenticationScreen = React.useCallback(() => { + const navigateToAuthenticationScreen = useCallback(() => { navigation.reset({ index: 0, routes: [{ name: ROUTES.AUTHENTICATION }] diff --git a/ts/screens/authentication/cie/CieWrongCardScreen.tsx b/ts/screens/authentication/cie/CieWrongCardScreen.tsx index b926b2bb197..445a98e1a28 100644 --- a/ts/screens/authentication/cie/CieWrongCardScreen.tsx +++ b/ts/screens/authentication/cie/CieWrongCardScreen.tsx @@ -1,7 +1,7 @@ /** * A screen to alert the user about the number of attempts remains */ -import * as React from "react"; +import { useCallback } from "react"; import I18n from "../../../i18n"; import { useIONavigation } from "../../../navigation/params/AppParamsList"; import ROUTES from "../../../navigation/routes"; @@ -10,13 +10,13 @@ import { OperationResultScreenContent } from "../../../components/screens/Operat const CieWrongCardScreen = () => { const navigation = useIONavigation(); - const navigateToCiePinScreen = React.useCallback(() => { + const navigateToCiePinScreen = useCallback(() => { navigation.navigate(ROUTES.AUTHENTICATION, { screen: ROUTES.CIE_PIN_SCREEN }); }, [navigation]); - const navigateToAuthenticationScreen = React.useCallback(() => { + const navigateToAuthenticationScreen = useCallback(() => { navigation.reset({ index: 0, routes: [{ name: ROUTES.AUTHENTICATION }] diff --git a/ts/screens/authentication/cie/CieWrongCiePinScreen.tsx b/ts/screens/authentication/cie/CieWrongCiePinScreen.tsx index 5d41236fac0..f34a741c040 100644 --- a/ts/screens/authentication/cie/CieWrongCiePinScreen.tsx +++ b/ts/screens/authentication/cie/CieWrongCiePinScreen.tsx @@ -1,7 +1,7 @@ /** * A screen to alert the user about the number of attempts remains */ -import * as React from "react"; +import { useCallback, useMemo } from "react"; import { Route, useRoute } from "@react-navigation/native"; import { IOPictograms } from "@pagopa/io-app-design-system"; import { Linking } from "react-native"; @@ -27,26 +27,26 @@ const CieWrongCiePinScreen = () => { >(); const { remainingCount } = route.params; - const navigateToCiePinScreen = React.useCallback(() => { + const navigateToCiePinScreen = useCallback(() => { navigation.navigate(ROUTES.AUTHENTICATION, { screen: ROUTES.CIE_PIN_SCREEN }); }, [navigation]); - const navigateToAuthenticationScreen = React.useCallback(() => { + const navigateToAuthenticationScreen = useCallback(() => { navigation.reset({ index: 0, routes: [{ name: ROUTES.AUTHENTICATION }] }); }, [navigation]); - const didYouForgetPin = React.useCallback(() => { + const didYouForgetPin = useCallback(() => { Linking.openURL( "https://www.cartaidentita.interno.gov.it/info-utili/codici-di-sicurezza-pin-e-puk/" ).catch(constNull); }, []); - const didYouForgetPuk = React.useCallback(() => { + const didYouForgetPuk = useCallback(() => { Linking.openURL( "https://www.cartaidentita.interno.gov.it/info-utili/recupero-puk/" ).catch(constNull); @@ -70,7 +70,7 @@ const CieWrongCiePinScreen = () => { [key: number]: Message; }; - const createMessageAction = React.useCallback( + const createMessageAction = useCallback( ({ label, onPress @@ -86,7 +86,7 @@ const CieWrongCiePinScreen = () => { [] ); - const messages: Messages = React.useMemo( + const messages: Messages = useMemo( () => ({ 2: { pictogram: "attention", @@ -142,7 +142,7 @@ const CieWrongCiePinScreen = () => { // This should never happen, // but it's a good practice to have a default message // in case of unexpected values of `remainingCount`. - const defaultMessageThatShouldNeverHappen: Message = React.useMemo( + const defaultMessageThatShouldNeverHappen: Message = useMemo( () => ({ pictogram: "attention", title: I18n.t("global.genericError"), @@ -164,7 +164,7 @@ const CieWrongCiePinScreen = () => { ] ); - const getMessage = React.useCallback( + const getMessage = useCallback( (key: number) => key in messages ? messages[key] : defaultMessageThatShouldNeverHappen, [defaultMessageThatShouldNeverHappen, messages] diff --git a/ts/screens/authentication/components/AuthErrorComponent.tsx b/ts/screens/authentication/components/AuthErrorComponent.tsx index 58d82291363..926c9712e90 100644 --- a/ts/screens/authentication/components/AuthErrorComponent.tsx +++ b/ts/screens/authentication/components/AuthErrorComponent.tsx @@ -1,4 +1,4 @@ -import React, { useMemo } from "react"; +import { useMemo } from "react"; import { OperationResultScreenContent, OperationResultScreenContentProps diff --git a/ts/screens/authentication/idpAuthSessionHandler.tsx b/ts/screens/authentication/idpAuthSessionHandler.tsx index 62902134f9d..d08b9b4b21c 100644 --- a/ts/screens/authentication/idpAuthSessionHandler.tsx +++ b/ts/screens/authentication/idpAuthSessionHandler.tsx @@ -10,7 +10,7 @@ import { pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; import * as T from "fp-ts/lib/Task"; import * as TE from "fp-ts/lib/TaskEither"; -import * as React from "react"; + import { useCallback, useEffect, useMemo, useState } from "react"; import { AppState, SafeAreaView, StyleSheet, View } from "react-native"; import I18n from "../../i18n"; @@ -349,7 +349,7 @@ export const AuthSessionPage = () => { const navigation = useIONavigation(); useFocusEffect( - React.useCallback(() => { + useCallback(() => { navigation.setOptions({ gestureEnabled: isBackButtonEnabled(requestInfo) }); diff --git a/ts/screens/misc/GalleryPermissionInstructionsScreen.tsx b/ts/screens/misc/GalleryPermissionInstructionsScreen.tsx index 6772b8789d3..86ea8712473 100644 --- a/ts/screens/misc/GalleryPermissionInstructionsScreen.tsx +++ b/ts/screens/misc/GalleryPermissionInstructionsScreen.tsx @@ -8,7 +8,6 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import { useNavigation } from "@react-navigation/native"; -import * as React from "react"; import { Linking, Platform } from "react-native"; import { useHeaderSecondLevel } from "../../hooks/useHeaderSecondLevel"; import I18n from "../../i18n"; diff --git a/ts/screens/modal/IdentificationLockModal.tsx b/ts/screens/modal/IdentificationLockModal.tsx index fc22e8423a9..68ca3c5ddf6 100644 --- a/ts/screens/modal/IdentificationLockModal.tsx +++ b/ts/screens/modal/IdentificationLockModal.tsx @@ -1,6 +1,5 @@ import { Millisecond } from "@pagopa/ts-commons/lib/units"; -import * as React from "react"; -import { useEffect } from "react"; +import { useCallback, useEffect } from "react"; import { View, Modal, StyleSheet, SafeAreaView } from "react-native"; import { ContentWrapper, @@ -76,7 +75,7 @@ export const IdentificationLockModal = (props: Props) => { const timerTiming = Math.round((countdownInMs as number) / 1000); const dispatch = useIODispatch(); - const hideModal = React.useCallback(() => { + const hideModal = useCallback(() => { dispatch(identificationHideLockModal()); }, [dispatch]); diff --git a/ts/screens/modal/IdentificationModal.tsx b/ts/screens/modal/IdentificationModal.tsx index 3ee3f0fc112..e6e7fd0e49e 100644 --- a/ts/screens/modal/IdentificationModal.tsx +++ b/ts/screens/modal/IdentificationModal.tsx @@ -13,7 +13,6 @@ import { Millisecond } from "@pagopa/ts-commons/lib/units"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; import _ from "lodash"; -import * as React from "react"; import { memo, useCallback, useMemo, useRef, useState } from "react"; import { Alert, diff --git a/ts/screens/modal/RootModal.tsx b/ts/screens/modal/RootModal.tsx index c3279418f44..a2005cb240e 100644 --- a/ts/screens/modal/RootModal.tsx +++ b/ts/screens/modal/RootModal.tsx @@ -1,26 +1,26 @@ -import * as React from "react"; +import { FunctionComponent } from "react"; import { connect } from "react-redux"; import { isAppSupportedSelector, versionInfoDataSelector } from "../../common/versionInfo/store/reducers/versionInfo"; -import UnsupportedDeviceScreen from "../../features/lollipop/screens/UnsupportedDeviceScreen"; -import { isDeviceSupportedSelector } from "../../features/lollipop/store/reducers/lollipop"; -import { mixpanelTrack } from "../../mixpanel"; -import { isBackendServicesStatusOffSelector } from "../../store/reducers/backendStatus/backendInfo"; -import { - isFastLoginUserInteractionNeededForSessionExpiredSelector, - tokenRefreshSelector -} from "../../features/fastLogin/store/selectors"; -import { GlobalState } from "../../store/reducers/types"; -import FastLoginModals from "../../features/fastLogin/screens/FastLoginModals"; import { trackLoginSessionTimeoutPostPin, trackLoginSessionTimeoutPrePin } from "../../features/fastLogin/analytics"; -import { startupTransientErrorSelector } from "../../store/reducers/startup"; +import FastLoginModals from "../../features/fastLogin/screens/FastLoginModals"; +import { + isFastLoginUserInteractionNeededForSessionExpiredSelector, + tokenRefreshSelector +} from "../../features/fastLogin/store/selectors"; +import UnsupportedDeviceScreen from "../../features/lollipop/screens/UnsupportedDeviceScreen"; +import { isDeviceSupportedSelector } from "../../features/lollipop/store/reducers/lollipop"; import { GetProfileEndpointTransientError } from "../../features/startup/screens/errors/GetProfileEndpointTransientError"; import { GetSessionEndpointTransientError } from "../../features/startup/screens/errors/GetSessionEndpointTransientError"; +import { mixpanelTrack } from "../../mixpanel"; +import { isBackendServicesStatusOffSelector } from "../../store/reducers/backendStatus/backendInfo"; +import { startupTransientErrorSelector } from "../../store/reducers/startup"; +import { GlobalState } from "../../store/reducers/types"; import IdentificationModal from "./IdentificationModal"; import SystemOffModal from "./SystemOffModal"; import UpdateAppModal from "./UpdateAppModal"; @@ -33,7 +33,7 @@ type Props = ReturnType; * - UpdateAppModal -> when the backend is not compliant anymore with the app, this modal is shown to force an update * - IdentificationModal -> the default case. It renders itself only if an identification action is required */ -const RootModal: React.FunctionComponent = (props: Props) => { +const RootModal: FunctionComponent = (props: Props) => { if (!props.isDeviceSupported) { return ; } diff --git a/ts/screens/modal/RootedDeviceModal.tsx b/ts/screens/modal/RootedDeviceModal.tsx index 7d625ce2783..4791cc8f326 100644 --- a/ts/screens/modal/RootedDeviceModal.tsx +++ b/ts/screens/modal/RootedDeviceModal.tsx @@ -7,7 +7,7 @@ import { Pictogram, VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; +import { useCallback } from "react"; import { Platform, StyleSheet, View } from "react-native"; import { ScrollView } from "react-native-gesture-handler"; import { SafeAreaView } from "react-native-safe-area-context"; @@ -26,7 +26,7 @@ const RootedDeviceModal = () => { const dispatch = useDispatch(); const navigation = useIONavigation(); - const handleContinueWithRootOrJailbreak = React.useCallback(() => { + const handleContinueWithRootOrJailbreak = useCallback(() => { dispatch(continueWithRootOrJailbreak(true)); navigation.goBack(); }, [dispatch, navigation]); diff --git a/ts/screens/modal/SystemOffModal.tsx b/ts/screens/modal/SystemOffModal.tsx index ce632503abf..44f55c67999 100644 --- a/ts/screens/modal/SystemOffModal.tsx +++ b/ts/screens/modal/SystemOffModal.tsx @@ -3,7 +3,7 @@ * not work properly. This is due to avoid user tries to access features or services potentially can't work * as expected */ -import * as React from "react"; +import { useMemo, memo } from "react"; import { Modal } from "react-native"; import { useSelector } from "react-redux"; import _ from "lodash"; @@ -15,7 +15,7 @@ const SystemOffModal = () => { const backendInfoMessage = useSelector(backendInfoMessageSelector, _.isEqual); const locale = getFullLocale(); - const subtitle = React.useMemo(() => { + const subtitle = useMemo(() => { const message = backendInfoMessage && backendInfoMessage[locale]; return `${message ? message + "\n" : ""}${I18n.t("systemsOff.closeApp")}`; @@ -32,4 +32,4 @@ const SystemOffModal = () => { ); }; -export default React.memo(SystemOffModal); +export default memo(SystemOffModal); diff --git a/ts/screens/modal/UpdateAppModal.tsx b/ts/screens/modal/UpdateAppModal.tsx index a2faa973d28..c274ab2b634 100644 --- a/ts/screens/modal/UpdateAppModal.tsx +++ b/ts/screens/modal/UpdateAppModal.tsx @@ -3,7 +3,8 @@ * */ -import React, { useCallback, useEffect, useRef, useState } from "react"; +import { FC, useCallback, useEffect, useRef, useState } from "react"; + import { AccessibilityInfo, Linking, @@ -30,7 +31,7 @@ import { OperationResultScreenContent } from "../../components/screens/Operation import { Dismissable } from "../../components/ui/Dismissable"; import { trackForcedUpdateScreen, trackUpdateAppButton } from "./analytics"; -const UpdateAppModal: React.FC = () => { +const UpdateAppModal: FC = () => { // Disable Android back button useHardwareBackButton(() => true); trackForcedUpdateScreen(); diff --git a/ts/screens/modal/components/IdentificationNumberPad.tsx b/ts/screens/modal/components/IdentificationNumberPad.tsx index c583f52bf63..4f6577f8acb 100644 --- a/ts/screens/modal/components/IdentificationNumberPad.tsx +++ b/ts/screens/modal/components/IdentificationNumberPad.tsx @@ -6,7 +6,6 @@ import { NumberPad, VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { useCallback, useState } from "react"; import { View } from "react-native"; import I18n from "../../../i18n"; diff --git a/ts/screens/onboarding/OnboardingCompletedScreen.tsx b/ts/screens/onboarding/OnboardingCompletedScreen.tsx index 603c363f761..72c42db8716 100644 --- a/ts/screens/onboarding/OnboardingCompletedScreen.tsx +++ b/ts/screens/onboarding/OnboardingCompletedScreen.tsx @@ -1,6 +1,5 @@ import { useRoute } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; -import React from "react"; import { isFastLoginEnabledSelector } from "../../features/fastLogin/store/selectors"; import I18n from "../../i18n"; import { completeOnboarding } from "../../store/actions/onboarding"; diff --git a/ts/screens/onboarding/OnboardingPinScreen.tsx b/ts/screens/onboarding/OnboardingPinScreen.tsx index 9d14b6582e1..7b2d0870a17 100644 --- a/ts/screens/onboarding/OnboardingPinScreen.tsx +++ b/ts/screens/onboarding/OnboardingPinScreen.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import { SafeAreaView } from "react-native-safe-area-context"; import { IOStyles } from "@pagopa/io-app-design-system"; import { PinCreation } from "../../components/screens/PinCreation/PinCreation"; diff --git a/ts/screens/onboarding/OnboardingServicesPreferenceScreen.tsx b/ts/screens/onboarding/OnboardingServicesPreferenceScreen.tsx index 2ac801e11f8..b4bb897b34f 100644 --- a/ts/screens/onboarding/OnboardingServicesPreferenceScreen.tsx +++ b/ts/screens/onboarding/OnboardingServicesPreferenceScreen.tsx @@ -6,7 +6,7 @@ import { useIOToast } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; -import React, { ReactElement, useCallback, useEffect, useState } from "react"; +import { ReactElement, useCallback, useEffect, useState } from "react"; import { SafeAreaView } from "react-native"; import { ServicesPreferencesModeEnum } from "../../../definitions/backend/ServicesPreferencesMode"; import LoadingSpinnerOverlay from "../../components/LoadingSpinnerOverlay"; diff --git a/ts/screens/onboarding/OnboardingShareDataScreen.tsx b/ts/screens/onboarding/OnboardingShareDataScreen.tsx index 4f3c63dc48e..b991a77b0dd 100644 --- a/ts/screens/onboarding/OnboardingShareDataScreen.tsx +++ b/ts/screens/onboarding/OnboardingShareDataScreen.tsx @@ -1,5 +1,5 @@ import { Banner, VSpacer } from "@pagopa/io-app-design-system"; -import React, { ReactElement, useCallback, useMemo } from "react"; +import { ReactElement, useCallback, useMemo } from "react"; import { SafeAreaView, View } from "react-native"; import { IOStyles } from "../../components/core/variables/IOStyles"; import I18n from "../../i18n"; diff --git a/ts/screens/onboarding/OnboardingTosScreen.tsx b/ts/screens/onboarding/OnboardingTosScreen.tsx index ebca1b72c2f..46479a91c05 100644 --- a/ts/screens/onboarding/OnboardingTosScreen.tsx +++ b/ts/screens/onboarding/OnboardingTosScreen.tsx @@ -12,7 +12,7 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; -import React, { useCallback, useEffect, useState } from "react"; +import { useCallback, useEffect, useState } from "react"; import { Alert, View } from "react-native"; import LoadingSpinnerOverlay from "../../components/LoadingSpinnerOverlay"; import TosWebviewComponent from "../../components/TosWebviewComponent"; diff --git a/ts/screens/onboarding/ServicePreferenceCompleteScreen.tsx b/ts/screens/onboarding/ServicePreferenceCompleteScreen.tsx index 2a47c4226a2..97abac9332e 100644 --- a/ts/screens/onboarding/ServicePreferenceCompleteScreen.tsx +++ b/ts/screens/onboarding/ServicePreferenceCompleteScreen.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { ReactElement } from "react"; import { connect } from "react-redux"; import { OperationResultScreenContent } from "../../components/screens/OperationResultScreenContent"; import I18n from "../../i18n"; @@ -13,7 +13,7 @@ type Props = ReturnType & * Screen which is displayed when a user requested a service preference change * and it has been correctly activated */ -const ServicePreferenceCompleteScreen = (props: Props): React.ReactElement => ( +const ServicePreferenceCompleteScreen = (props: Props): ReactElement => ( { - const [navigationURI, setNavigationUri] = React.useState("https://"); - const [refererValue, setRefererValue] = React.useState(""); - const [loadUri, setLoadUri] = React.useState("https://google.com"); - const [reloadKey, setReloadKey] = React.useState(0); + const [navigationURI, setNavigationUri] = useState("https://"); + const [refererValue, setRefererValue] = useState(""); + const [loadUri, setLoadUri] = useState("https://google.com"); + const [reloadKey, setReloadKey] = useState(0); useHeaderSecondLevel({ title: "CGN Landing Playground" diff --git a/ts/screens/profile/DeveloperModeSection.tsx b/ts/screens/profile/DeveloperModeSection.tsx index 1ec9f90fd72..d1c9cae6dfd 100644 --- a/ts/screens/profile/DeveloperModeSection.tsx +++ b/ts/screens/profile/DeveloperModeSection.tsx @@ -15,8 +15,7 @@ import { } from "@pagopa/io-app-design-system"; import * as Sentry from "@sentry/react-native"; import AsyncStorage from "@react-native-async-storage/async-storage"; -import * as React from "react"; -import { ComponentProps } from "react"; +import { useContext, ComponentProps } from "react"; import { Alert, FlatList, ListRenderItemInfo } from "react-native"; import I18n from "../../i18n"; import { AlertModal } from "../../components/ui/AlertModal"; @@ -551,7 +550,7 @@ const DeveloperTestEnvironmentSection = ({ }; const DeveloperModeSection = () => { - const { showModal } = React.useContext(LightModalContext); + const { showModal } = useContext(LightModalContext); const dispatch = useIODispatch(); const isDebugModeEnabled = useIOSelector(isDebugModeEnabledSelector); diff --git a/ts/screens/profile/DownloadProfileDataScreen.tsx b/ts/screens/profile/DownloadProfileDataScreen.tsx index 95d3cb5d59b..af3b190b26d 100644 --- a/ts/screens/profile/DownloadProfileDataScreen.tsx +++ b/ts/screens/profile/DownloadProfileDataScreen.tsx @@ -7,7 +7,7 @@ import { useIOToast } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; -import React, { ComponentProps, useCallback, useEffect, useMemo } from "react"; +import { ComponentProps, useCallback, useEffect, useMemo } from "react"; import { UserDataProcessingChoiceEnum } from "../../../definitions/backend/UserDataProcessingChoice"; import { BulletList, BulletListItem } from "../../components/BulletList"; import { IOScrollViewActions } from "../../components/ui/IOScrollView"; diff --git a/ts/screens/profile/EmailForwardingScreen.tsx b/ts/screens/profile/EmailForwardingScreen.tsx index 6a5f9608ccf..fa55acecd5c 100644 --- a/ts/screens/profile/EmailForwardingScreen.tsx +++ b/ts/screens/profile/EmailForwardingScreen.tsx @@ -10,7 +10,7 @@ import * as pot from "@pagopa/ts-commons/lib/pot"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; import _ from "lodash"; -import React, { useCallback, useEffect, useRef, useState } from "react"; +import { useCallback, useEffect, useRef, useState } from "react"; import { ContextualHelpPropsMarkdown } from "../../components/screens/BaseScreenComponent"; import { IOScrollViewWithLargeHeader } from "../../components/ui/IOScrollViewWithLargeHeader"; import I18n from "../../i18n"; diff --git a/ts/screens/profile/EmailInsertScreen.tsx b/ts/screens/profile/EmailInsertScreen.tsx index 78b39a604a1..d1e1e1bd47d 100644 --- a/ts/screens/profile/EmailInsertScreen.tsx +++ b/ts/screens/profile/EmailInsertScreen.tsx @@ -16,13 +16,7 @@ import { EmailString } from "@pagopa/ts-commons/lib/strings"; import { Route, useFocusEffect, useRoute } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React, { - useCallback, - useEffect, - useMemo, - useRef, - useState -} from "react"; +import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { Alert, Keyboard, diff --git a/ts/screens/profile/EmailValidationSendEmailScreen.tsx b/ts/screens/profile/EmailValidationSendEmailScreen.tsx index 6bce6203933..34a297ef9de 100644 --- a/ts/screens/profile/EmailValidationSendEmailScreen.tsx +++ b/ts/screens/profile/EmailValidationSendEmailScreen.tsx @@ -5,7 +5,7 @@ import { Millisecond } from "@pagopa/ts-commons/lib/units"; import { pipe } from "fp-ts/lib/function"; import * as pot from "@pagopa/ts-commons/lib/pot"; import * as O from "fp-ts/lib/Option"; -import React, { useRef, useCallback, useEffect, useState } from "react"; +import { useRef, useCallback, useEffect, useState } from "react"; import { ScrollView, StyleSheet, View } from "react-native"; import { IOPictogramSizeScale, diff --git a/ts/screens/profile/FiscalCodeScreen.tsx b/ts/screens/profile/FiscalCodeScreen.tsx index 48adabdd2ee..2db5cd55a8b 100644 --- a/ts/screens/profile/FiscalCodeScreen.tsx +++ b/ts/screens/profile/FiscalCodeScreen.tsx @@ -7,7 +7,7 @@ import { } from "@pagopa/io-app-design-system"; import { Millisecond } from "@pagopa/ts-commons/lib/units"; import { useFocusEffect } from "@react-navigation/native"; -import React, { useCallback, useRef, useState } from "react"; +import { useCallback, useRef, useState } from "react"; import { StyleSheet, View } from "react-native"; import Barcode from "react-native-barcode-builder"; import { withLightModalContext } from "../../components/helpers/withLightModalContext"; diff --git a/ts/screens/profile/LanguagesPreferencesScreen.tsx b/ts/screens/profile/LanguagesPreferencesScreen.tsx index e4ee9eb72bc..190fac217f3 100644 --- a/ts/screens/profile/LanguagesPreferencesScreen.tsx +++ b/ts/screens/profile/LanguagesPreferencesScreen.tsx @@ -5,7 +5,8 @@ import { useIOToast, VSpacer } from "@pagopa/io-app-design-system"; -import React, { +import { + useContext, createRef, useCallback, useEffect, @@ -53,7 +54,7 @@ const LanguagesPreferencesScreen = () => { const toast = useIOToast(); const selectedLanguage = useRef(); const [isLoading, setIsLoading] = useState(false); - const { showModal } = React.useContext(LightModalContext); + const { showModal } = useContext(LightModalContext); const profile = useIOSelector(profileSelector, _.isEqual); const prevProfile = usePrevious(profile); const bannerInfoSelector = useIOSelector( diff --git a/ts/screens/profile/NotificationsPreferencesScreen.tsx b/ts/screens/profile/NotificationsPreferencesScreen.tsx index a907ff1fa9e..e4353d685c2 100644 --- a/ts/screens/profile/NotificationsPreferencesScreen.tsx +++ b/ts/screens/profile/NotificationsPreferencesScreen.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect, useState } from "react"; +import { useCallback, useEffect, useState } from "react"; import { ContentWrapper, useIOToast } from "@pagopa/io-app-design-system"; import { PushNotificationsContentTypeEnum } from "../../../definitions/backend/PushNotificationsContentType"; import { ReminderStatusEnum } from "../../../definitions/backend/ReminderStatus"; diff --git a/ts/screens/profile/PinScreen.tsx b/ts/screens/profile/PinScreen.tsx index 05d4273854f..432869bb2dc 100644 --- a/ts/screens/profile/PinScreen.tsx +++ b/ts/screens/profile/PinScreen.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { SafeAreaView } from "react-native-safe-area-context"; import { IOStyles } from "@pagopa/io-app-design-system"; import { PinCreation } from "../../components/screens/PinCreation/PinCreation"; diff --git a/ts/screens/profile/PreferencesScreen.tsx b/ts/screens/profile/PreferencesScreen.tsx index 9e6f734f80c..b543c9e0f34 100644 --- a/ts/screens/profile/PreferencesScreen.tsx +++ b/ts/screens/profile/PreferencesScreen.tsx @@ -2,7 +2,7 @@ * Implements the preferences screen where the user can see and update his * preferences about notifications, calendar, services, messages and languages */ -import React, { ComponentProps, useCallback } from "react"; +import { ComponentProps, useCallback } from "react"; import { Alert, FlatList, ListRenderItemInfo } from "react-native"; import { Divider, diff --git a/ts/screens/profile/PrivacyMainScreen.tsx b/ts/screens/profile/PrivacyMainScreen.tsx index 0ce2b3eb73c..4e9c2e4def3 100644 --- a/ts/screens/profile/PrivacyMainScreen.tsx +++ b/ts/screens/profile/PrivacyMainScreen.tsx @@ -5,7 +5,7 @@ import { ListItemNav } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; -import React, { +import { ComponentProps, useCallback, useEffect, diff --git a/ts/screens/profile/ProfileAboutApp.tsx b/ts/screens/profile/ProfileAboutApp.tsx index 80e1a9977f6..2d7254af5a1 100644 --- a/ts/screens/profile/ProfileAboutApp.tsx +++ b/ts/screens/profile/ProfileAboutApp.tsx @@ -6,7 +6,7 @@ import { H4, VSpacer } from "@pagopa/io-app-design-system"; -import React, { createRef, useCallback, useMemo } from "react"; +import { createRef, useCallback, useMemo } from "react"; import { View } from "react-native"; import { IOScrollViewWithLargeHeader } from "../../components/ui/IOScrollViewWithLargeHeader"; import I18n from "../../i18n"; diff --git a/ts/screens/profile/ProfileDataScreen.tsx b/ts/screens/profile/ProfileDataScreen.tsx index b3536b078a1..137524fdb84 100644 --- a/ts/screens/profile/ProfileDataScreen.tsx +++ b/ts/screens/profile/ProfileDataScreen.tsx @@ -5,7 +5,7 @@ import { } from "@pagopa/io-app-design-system"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import React, { ComponentProps, useCallback, useMemo } from "react"; +import { ComponentProps, useCallback, useMemo } from "react"; import { ContextualHelpPropsMarkdown } from "../../components/screens/BaseScreenComponent"; import { IOScrollViewWithLargeHeader } from "../../components/ui/IOScrollViewWithLargeHeader"; import I18n from "../../i18n"; diff --git a/ts/screens/profile/ProfileMainScreen.tsx b/ts/screens/profile/ProfileMainScreen.tsx index c9afab99665..d5f0c2ad7f7 100644 --- a/ts/screens/profile/ProfileMainScreen.tsx +++ b/ts/screens/profile/ProfileMainScreen.tsx @@ -8,7 +8,8 @@ import { useIOToast } from "@pagopa/io-app-design-system"; import { Millisecond } from "@pagopa/ts-commons/lib/units"; -import React, { +import { + useContext, ComponentProps, memo, useCallback, @@ -48,7 +49,7 @@ const ListItem = memo(ListItemNav); * A screen to show all the options related to the user profile */ const ProfileMainScreenFC = () => { - const { hideModal } = React.useContext(LightModalContext); + const { hideModal } = useContext(LightModalContext); const dispatch = useIODispatch(); const navigation = useIONavigation(); const { show } = useIOToast(); diff --git a/ts/screens/profile/ProfileMainScreenTopBanner.tsx b/ts/screens/profile/ProfileMainScreenTopBanner.tsx index 907397b5ff0..6e6e704ac7b 100644 --- a/ts/screens/profile/ProfileMainScreenTopBanner.tsx +++ b/ts/screens/profile/ProfileMainScreenTopBanner.tsx @@ -4,7 +4,7 @@ import { ContentWrapper, VSpacer } from "@pagopa/io-app-design-system"; -import React, { useCallback } from "react"; +import { useCallback } from "react"; import { setShowProfileBanner } from "../../features/profileSettings/store/actions"; import { profileBannerToShowSelector } from "../../features/profileSettings/store/selectors"; import { openSystemNotificationSettingsScreen } from "../../features/pushNotifications/utils"; diff --git a/ts/screens/profile/RemoveAccountDetailsScreen.tsx b/ts/screens/profile/RemoveAccountDetailsScreen.tsx index 2f189c0bbb8..d29ef81fe61 100644 --- a/ts/screens/profile/RemoveAccountDetailsScreen.tsx +++ b/ts/screens/profile/RemoveAccountDetailsScreen.tsx @@ -11,14 +11,7 @@ import { useIOToast } from "@pagopa/io-app-design-system"; import { StackActions } from "@react-navigation/native"; -import React, { - memo, - useCallback, - useEffect, - useMemo, - useRef, - useState -} from "react"; +import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react"; import { AccessibilityInfo, Alert, diff --git a/ts/screens/profile/RemoveAccountInfoScreen.tsx b/ts/screens/profile/RemoveAccountInfoScreen.tsx index 167ecf6f7f6..f238f745e40 100644 --- a/ts/screens/profile/RemoveAccountInfoScreen.tsx +++ b/ts/screens/profile/RemoveAccountInfoScreen.tsx @@ -4,7 +4,7 @@ import { ContentWrapper, VSpacer } from "@pagopa/io-app-design-system"; -import React, { useMemo } from "react"; +import { useMemo } from "react"; import I18n from "../../i18n"; import { loadBonusBeforeRemoveAccount } from "../../store/actions/profile"; import { useIODispatch } from "../../store/hooks"; diff --git a/ts/screens/profile/RemoveAccountSuccessScreen.tsx b/ts/screens/profile/RemoveAccountSuccessScreen.tsx index ef766f51890..b11b7fd43fb 100644 --- a/ts/screens/profile/RemoveAccountSuccessScreen.tsx +++ b/ts/screens/profile/RemoveAccountSuccessScreen.tsx @@ -1,4 +1,4 @@ -import React, { useMemo } from "react"; +import { useMemo } from "react"; import { useHardwareBackButton } from "../../hooks/useHardwareBackButton"; import I18n from "../../i18n"; import { logoutRequest } from "../../store/actions/authentication"; diff --git a/ts/screens/profile/SecurityScreen.tsx b/ts/screens/profile/SecurityScreen.tsx index 0069cfeefb3..a9b9fabd7a3 100644 --- a/ts/screens/profile/SecurityScreen.tsx +++ b/ts/screens/profile/SecurityScreen.tsx @@ -5,7 +5,8 @@ import { ListItemNav, ListItemSwitch } from "@pagopa/io-app-design-system"; -import React, { useCallback, useEffect, useState } from "react"; +import { ReactElement, useCallback, useEffect, useState } from "react"; + import { ContextualHelpPropsMarkdown } from "../../components/screens/BaseScreenComponent"; import { shufflePinPadOnPayment } from "../../config"; import { IdPayCodeRoutes } from "../../features/idpay/code/navigation/routes"; @@ -46,7 +47,7 @@ const FAQ_CATEGORIES: ReadonlyArray = [ "authentication_SPID" ]; -const SecurityScreen = (): React.ReactElement => { +const SecurityScreen = (): ReactElement => { const dispatch = useIODispatch(); const isFingerprintEnabled = useIOSelector(isFingerprintEnabledSelector); const isIdPayCodeOnboarded = useIOSelector(isIdPayCodeOnboardedSelector); diff --git a/ts/screens/profile/ServicesPreferenceScreen.tsx b/ts/screens/profile/ServicesPreferenceScreen.tsx index 23993adaf09..e11126b01fc 100644 --- a/ts/screens/profile/ServicesPreferenceScreen.tsx +++ b/ts/screens/profile/ServicesPreferenceScreen.tsx @@ -1,6 +1,6 @@ import { useIOToast } from "@pagopa/io-app-design-system"; import * as pot from "@pagopa/ts-commons/lib/pot"; -import React, { ReactElement, useCallback, useEffect } from "react"; +import { ReactElement, useCallback, useEffect } from "react"; import { ServicesPreferencesModeEnum } from "../../../definitions/backend/ServicesPreferencesMode"; import I18n from "../../i18n"; import { profileUpsert } from "../../store/actions/profile"; diff --git a/ts/screens/profile/ShareDataScreen.tsx b/ts/screens/profile/ShareDataScreen.tsx index 6cc143ee1da..fc5c6368b01 100644 --- a/ts/screens/profile/ShareDataScreen.tsx +++ b/ts/screens/profile/ShareDataScreen.tsx @@ -1,5 +1,5 @@ import { useIOToast } from "@pagopa/io-app-design-system"; -import React, { useCallback, useEffect, useMemo, useRef } from "react"; +import { useCallback, useEffect, useMemo, useRef } from "react"; import { AccessibilityInfo, SafeAreaView, View } from "react-native"; import { IOStyles } from "../../components/core/variables/IOStyles"; import I18n from "../../i18n"; diff --git a/ts/screens/profile/TosScreen.tsx b/ts/screens/profile/TosScreen.tsx index 9c567986c87..3fc0e0a05c1 100644 --- a/ts/screens/profile/TosScreen.tsx +++ b/ts/screens/profile/TosScreen.tsx @@ -2,7 +2,7 @@ * A screen to show the app Terms of Service. * This screen is used as Privacy screen From Profile section. */ -import React, { useState } from "react"; +import { useState } from "react"; import { H2, IOStyles } from "@pagopa/io-app-design-system"; import { View } from "react-native"; import LoadingSpinnerOverlay from "../../components/LoadingSpinnerOverlay"; diff --git a/ts/screens/profile/TrialSystemPlayground.tsx b/ts/screens/profile/TrialSystemPlayground.tsx index 18a6ede5201..3bdc3879eab 100644 --- a/ts/screens/profile/TrialSystemPlayground.tsx +++ b/ts/screens/profile/TrialSystemPlayground.tsx @@ -5,7 +5,6 @@ import { H3, VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { SafeAreaView, StyleSheet, View } from "react-native"; import { useEffect } from "react"; import { constNull } from "fp-ts/lib/function"; diff --git a/ts/screens/profile/__test__/ProfileDataScreen.test.tsx b/ts/screens/profile/__test__/ProfileDataScreen.test.tsx index 84f35f21c3e..46805a3c96f 100644 --- a/ts/screens/profile/__test__/ProfileDataScreen.test.tsx +++ b/ts/screens/profile/__test__/ProfileDataScreen.test.tsx @@ -1,6 +1,5 @@ import { pipe } from "fp-ts/lib/function"; import * as O from "fp-ts/lib/Option"; -import React from "react"; import { fireEvent } from "@testing-library/react-native"; import { FiscalCode } from "@pagopa/ts-commons/lib/strings"; import { PreloadedState, createStore } from "redux"; diff --git a/ts/screens/profile/__test__/ProfileMainScreenTopBanner.test.tsx b/ts/screens/profile/__test__/ProfileMainScreenTopBanner.test.tsx index 2cdb678210e..8cc95f00f9b 100644 --- a/ts/screens/profile/__test__/ProfileMainScreenTopBanner.test.tsx +++ b/ts/screens/profile/__test__/ProfileMainScreenTopBanner.test.tsx @@ -1,5 +1,4 @@ import { fireEvent } from "@testing-library/react-native"; -import React from "react"; import { renderComponent } from "../../../components/__tests__/ForceScrollDownView.test"; import * as profileBannerImport from "../../../features/profileSettings/store/selectors"; import { GlobalState } from "../../../store/reducers/types"; diff --git a/ts/screens/profile/__test__/TosScreen.test.tsx b/ts/screens/profile/__test__/TosScreen.test.tsx index 0e3e91343b5..5f79aa19035 100644 --- a/ts/screens/profile/__test__/TosScreen.test.tsx +++ b/ts/screens/profile/__test__/TosScreen.test.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import * as pot from "@pagopa/ts-commons/lib/pot"; import * as O from "fp-ts/lib/Option"; import configureMockStore from "redux-mock-store"; diff --git a/ts/screens/profile/components/CountdownComponent.tsx b/ts/screens/profile/components/CountdownComponent.tsx index 0accc5561e7..8fcfad2fda9 100644 --- a/ts/screens/profile/components/CountdownComponent.tsx +++ b/ts/screens/profile/components/CountdownComponent.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { View } from "react-native"; import { Body, IOStyles, VSpacer } from "@pagopa/io-app-design-system"; import { useCountdown } from "../../../components/countdown/CountdownProvider"; diff --git a/ts/screens/profile/components/DSEnableSwitch.tsx b/ts/screens/profile/components/DSEnableSwitch.tsx index 5dd6d359d89..bf8678f2318 100644 --- a/ts/screens/profile/components/DSEnableSwitch.tsx +++ b/ts/screens/profile/components/DSEnableSwitch.tsx @@ -1,4 +1,3 @@ -import * as React from "react"; import AsyncStorage from "@react-native-async-storage/async-storage"; import { ListItemSwitch, diff --git a/ts/screens/profile/components/OptOutBottomSheet.tsx b/ts/screens/profile/components/OptOutBottomSheet.tsx index 2b432bb2c6a..d6330d2fb36 100644 --- a/ts/screens/profile/components/OptOutBottomSheet.tsx +++ b/ts/screens/profile/components/OptOutBottomSheet.tsx @@ -1,5 +1,4 @@ import { View } from "react-native"; -import * as React from "react"; import { Body, ButtonSolid, VSpacer } from "@pagopa/io-app-design-system"; import { IOStyles } from "../../../components/core/variables/IOStyles"; import I18n from "../../../i18n"; diff --git a/ts/screens/profile/components/SettingsDiscoveryBanner.tsx b/ts/screens/profile/components/SettingsDiscoveryBanner.tsx index 03df0540852..dfea546ba1e 100644 --- a/ts/screens/profile/components/SettingsDiscoveryBanner.tsx +++ b/ts/screens/profile/components/SettingsDiscoveryBanner.tsx @@ -1,5 +1,5 @@ import { Banner, IOVisualCostants } from "@pagopa/io-app-design-system"; -import React, { createRef } from "react"; +import { useCallback, createRef } from "react"; import { StyleSheet, View } from "react-native"; import I18n from "../../../i18n"; import { useIONavigation } from "../../../navigation/params/AppParamsList"; @@ -26,7 +26,7 @@ export const SettingsDiscoveryBanner = ({ screen: ROUTES.SETTINGS_MAIN }); }; - const closeHandler = React.useCallback(() => { + const closeHandler = useCallback(() => { dispatch(setHasUserAcknowledgedSettingsBanner(true)); handleOnClose(); }, [dispatch, handleOnClose]); diff --git a/ts/screens/profile/components/ShareDataComponent/ShareDataFeatureInfos.tsx b/ts/screens/profile/components/ShareDataComponent/ShareDataFeatureInfos.tsx index a30a3bc6bc8..0d29468a726 100644 --- a/ts/screens/profile/components/ShareDataComponent/ShareDataFeatureInfos.tsx +++ b/ts/screens/profile/components/ShareDataComponent/ShareDataFeatureInfos.tsx @@ -1,6 +1,6 @@ import { Body, FeatureInfo, VSpacer } from "@pagopa/io-app-design-system"; import { Millisecond } from "@pagopa/ts-commons/lib/units"; -import React, { useCallback, useMemo, useRef } from "react"; +import { useCallback, useMemo, useRef } from "react"; import { View } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import LegacyMarkdown from "../../../../components/ui/Markdown/LegacyMarkdown"; diff --git a/ts/screens/profile/components/ShareDataComponent/index.tsx b/ts/screens/profile/components/ShareDataComponent/index.tsx index 7eac0ba175a..9b1eda5e0c1 100644 --- a/ts/screens/profile/components/ShareDataComponent/index.tsx +++ b/ts/screens/profile/components/ShareDataComponent/index.tsx @@ -1,5 +1,5 @@ import { Body, VSpacer } from "@pagopa/io-app-design-system"; -import React, { memo } from "react"; +import { memo } from "react"; import { tosConfigSelector } from "../../../../features/tos/store/selectors"; import I18n from "../../../../i18n"; import { useIOSelector } from "../../../../store/hooks"; diff --git a/ts/screens/profile/components/__test__/SettingsDiscoveryBanner.test.tsx b/ts/screens/profile/components/__test__/SettingsDiscoveryBanner.test.tsx index d51615fa64d..7d06bfbdf5e 100644 --- a/ts/screens/profile/components/__test__/SettingsDiscoveryBanner.test.tsx +++ b/ts/screens/profile/components/__test__/SettingsDiscoveryBanner.test.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { ReactElement } from "react"; import { createStore } from "redux"; import ROUTES from "../../../../navigation/routes"; import { applicationChangeState } from "../../../../store/actions/application"; @@ -16,7 +16,7 @@ describe("settingsDiscoveryBanner", () => { }); }); -const renderComponent = (component: React.ReactElement) => { +const renderComponent = (component: ReactElement) => { const globalState = appReducer(undefined, applicationChangeState("active")); return renderScreenWithNavigationStoreContext( () => component, diff --git a/ts/screens/profile/components/__test__/ShareDataComponent.test.tsx b/ts/screens/profile/components/__test__/ShareDataComponent.test.tsx index 07eab2f7838..5c7a8225ce2 100644 --- a/ts/screens/profile/components/__test__/ShareDataComponent.test.tsx +++ b/ts/screens/profile/components/__test__/ShareDataComponent.test.tsx @@ -1,5 +1,4 @@ import { fireEvent } from "@testing-library/react-native"; -import React from "react"; import { createStore } from "redux"; import { openWebUrl } from "../../../../utils/url"; import { ShareDataComponent } from "../ShareDataComponent"; diff --git a/ts/screens/profile/components/services/ManualConfigBottomSheet.tsx b/ts/screens/profile/components/services/ManualConfigBottomSheet.tsx index a85ad56900c..c9b106f1e94 100644 --- a/ts/screens/profile/components/services/ManualConfigBottomSheet.tsx +++ b/ts/screens/profile/components/services/ManualConfigBottomSheet.tsx @@ -1,12 +1,13 @@ import { FooterActionsInline, VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; + +import { ReactElement } from "react"; import LegacyMarkdown from "../../../../components/ui/Markdown/LegacyMarkdown"; import I18n from "../../../../i18n"; import { useIOBottomSheetAutoresizableModal } from "../../../../utils/hooks/bottomSheet"; const SNAP_POINT_VALUE = 250; -const ManualConfigConfirm = (): React.ReactElement => ( +const ManualConfigConfirm = (): ReactElement => ( <> diff --git a/ts/screens/profile/components/services/ServicesContactComponent.tsx b/ts/screens/profile/components/services/ServicesContactComponent.tsx index fc9d48c7092..ee1664af231 100644 --- a/ts/screens/profile/components/services/ServicesContactComponent.tsx +++ b/ts/screens/profile/components/services/ServicesContactComponent.tsx @@ -1,5 +1,5 @@ import { BodySmall, RadioGroup } from "@pagopa/io-app-design-system"; -import React, { ReactElement, useCallback, useEffect, useState } from "react"; +import { ReactElement, useCallback, useEffect, useState } from "react"; import { ServicesPreferencesModeEnum } from "../../../../../definitions/backend/ServicesPreferencesMode"; import I18n from "../../../../i18n"; import { usePrevious } from "../../../../utils/hooks/usePrevious"; diff --git a/ts/screens/profile/mailCheck/EmailAlreadyTakenScreen.tsx b/ts/screens/profile/mailCheck/EmailAlreadyTakenScreen.tsx index aac6b5e5965..3ba79a3c254 100644 --- a/ts/screens/profile/mailCheck/EmailAlreadyTakenScreen.tsx +++ b/ts/screens/profile/mailCheck/EmailAlreadyTakenScreen.tsx @@ -1,6 +1,6 @@ import { Route, useRoute } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; -import React, { useCallback, useMemo } from "react"; +import { useCallback, useMemo } from "react"; import { BodyProps } from "@pagopa/io-app-design-system"; import { ContextualHelpPropsMarkdown } from "../../../components/screens/BaseScreenComponent"; import I18n from "../../../i18n"; diff --git a/ts/screens/profile/mailCheck/ValidateEmailScreen.tsx b/ts/screens/profile/mailCheck/ValidateEmailScreen.tsx index 869444361c3..e42a70b708a 100644 --- a/ts/screens/profile/mailCheck/ValidateEmailScreen.tsx +++ b/ts/screens/profile/mailCheck/ValidateEmailScreen.tsx @@ -1,4 +1,4 @@ -import React, { useMemo, useCallback } from "react"; +import { useMemo, useCallback } from "react"; import * as O from "fp-ts/lib/Option"; import { Route, useRoute } from "@react-navigation/native"; import { BodyProps } from "@pagopa/io-app-design-system"; diff --git a/ts/screens/profile/playgrounds/IOMarkdownPlayground.tsx b/ts/screens/profile/playgrounds/IOMarkdownPlayground.tsx index 67f25ebf470..87ff4129e06 100644 --- a/ts/screens/profile/playgrounds/IOMarkdownPlayground.tsx +++ b/ts/screens/profile/playgrounds/IOMarkdownPlayground.tsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import { useState } from "react"; import { Keyboard, KeyboardAvoidingView, diff --git a/ts/screens/profile/playgrounds/IOMarkdownSuggestions.tsx b/ts/screens/profile/playgrounds/IOMarkdownSuggestions.tsx index bc6320520ab..c710ebde4a5 100644 --- a/ts/screens/profile/playgrounds/IOMarkdownSuggestions.tsx +++ b/ts/screens/profile/playgrounds/IOMarkdownSuggestions.tsx @@ -1,5 +1,5 @@ import { View } from "react-native"; -import React, { Fragment } from "react"; +import { Fragment } from "react"; import { ButtonOutline, ButtonSolid, diff --git a/ts/screens/profile/playgrounds/IdPayCodePlayground.tsx b/ts/screens/profile/playgrounds/IdPayCodePlayground.tsx index 3dc828ec7d8..4cece5ca347 100644 --- a/ts/screens/profile/playgrounds/IdPayCodePlayground.tsx +++ b/ts/screens/profile/playgrounds/IdPayCodePlayground.tsx @@ -8,7 +8,7 @@ import { NonEmptyString } from "@pagopa/ts-commons/lib/strings"; import { useNavigation } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; -import * as React from "react"; +import { useState } from "react"; import { ScrollView, View } from "react-native"; import { LabelledItem } from "../../../components/LabelledItem"; import { IdPayCodeRoutes } from "../../../features/idpay/code/navigation/routes"; @@ -20,7 +20,7 @@ import TopScreenComponent from "../../../components/screens/TopScreenComponent"; export const IdPayCodePlayGround = () => { const navigation = useNavigation>(); - const [initiativeId, setInitiativeId] = React.useState(); + const [initiativeId, setInitiativeId] = useState(); const navigateToOnboarding = () => { navigation.navigate(IdPayCodeRoutes.IDPAY_CODE_MAIN, { diff --git a/ts/screens/profile/playgrounds/IdPayOnboardingPlayground.tsx b/ts/screens/profile/playgrounds/IdPayOnboardingPlayground.tsx index b5c97421a27..e3516f1656f 100644 --- a/ts/screens/profile/playgrounds/IdPayOnboardingPlayground.tsx +++ b/ts/screens/profile/playgrounds/IdPayOnboardingPlayground.tsx @@ -8,7 +8,7 @@ import { VSpacer } from "@pagopa/io-app-design-system"; import { useNavigation } from "@react-navigation/native"; -import React from "react"; +import { useState } from "react"; import { Button, ScrollView, View } from "react-native"; import { LabelledItem } from "../../../components/LabelledItem"; import { IOStyles } from "../../../components/core/variables/IOStyles"; @@ -22,7 +22,7 @@ import { isDevEnv } from "../../../utils/environment"; const IdPayOnboardingPlayground = () => { const navigation = useNavigation>(); - const [serviceId, setServiceId] = React.useState(); + const [serviceId, setServiceId] = useState(); const navigateToIDPayOnboarding = (serviceId: string) => { navigation.navigate(IdPayOnboardingRoutes.IDPAY_ONBOARDING_MAIN, { diff --git a/ts/screens/profile/playgrounds/MarkdownPlayground.tsx b/ts/screens/profile/playgrounds/MarkdownPlayground.tsx index 6303db9ca70..d55a6eafb05 100644 --- a/ts/screens/profile/playgrounds/MarkdownPlayground.tsx +++ b/ts/screens/profile/playgrounds/MarkdownPlayground.tsx @@ -10,7 +10,7 @@ import { } from "@pagopa/io-app-design-system"; import { useLinkTo } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; -import React, { useCallback } from "react"; +import { useState, useCallback } from "react"; import { ScrollView, StyleSheet, TextInput, View } from "react-native"; import I18n from "../../../i18n"; import { MessageBodyMarkdown } from "../../../../definitions/backend/MessageBodyMarkdown"; @@ -88,8 +88,8 @@ Ordered list: `; const MarkdownPlayground = () => { - const [markdownText, setMarkdownText] = React.useState(""); - const [inputText, setInputText] = React.useState(""); + const [markdownText, setMarkdownText] = useState(""); + const [inputText, setInputText] = useState(""); const setMarkdown = (markdownString: string) => { setMarkdownText(markdownString); diff --git a/ts/utils/accessibility.ts b/ts/utils/accessibility.ts index 2b4e6cbd002..f4011c6cb0b 100644 --- a/ts/utils/accessibility.ts +++ b/ts/utils/accessibility.ts @@ -1,11 +1,10 @@ +import { Millisecond } from "@pagopa/ts-commons/lib/units"; import * as O from "fp-ts/lib/Option"; import * as T from "fp-ts/lib/Task"; import * as TE from "fp-ts/lib/TaskEither"; -import { Millisecond } from "@pagopa/ts-commons/lib/units"; -import * as React from "react"; -import { useEffect, useState } from "react"; -import { AccessibilityInfo, findNodeHandle } from "react-native"; import { pipe } from "fp-ts/lib/function"; +import { Component, RefObject, useEffect, useState } from "react"; +import { AccessibilityInfo, findNodeHandle } from "react-native"; import I18n from "../i18n"; import { format } from "./dates"; @@ -17,8 +16,8 @@ import { format } from "./dates"; * @param executionDelay * @param callback */ -export const setAccessibilityFocus = ( - nodeReference: React.RefObject, +export const setAccessibilityFocus = ( + nodeReference: RefObject, executionDelay: Millisecond = 0 as Millisecond, // default: execute immediately, callback?: () => void ) => { diff --git a/ts/utils/hooks/__tests__/useOnFirstRender.test.tsx b/ts/utils/hooks/__tests__/useOnFirstRender.test.tsx index 95010b80f12..9c944ef314e 100644 --- a/ts/utils/hooks/__tests__/useOnFirstRender.test.tsx +++ b/ts/utils/hooks/__tests__/useOnFirstRender.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { render } from "@testing-library/react-native"; import { useOnFirstRender } from "../useOnFirstRender"; diff --git a/ts/utils/hooks/bottomSheet.tsx b/ts/utils/hooks/bottomSheet.tsx index 0024b96e113..c60bd17c884 100644 --- a/ts/utils/hooks/bottomSheet.tsx +++ b/ts/utils/hooks/bottomSheet.tsx @@ -12,8 +12,16 @@ import { IOVisualCostants } from "@pagopa/io-app-design-system"; import { NonEmptyArray } from "fp-ts/lib/NonEmptyArray"; -import * as React from "react"; -import { useCallback, useEffect, useState } from "react"; + +import { + FunctionComponent, + ReactElement, + ReactNode, + useCallback, + useEffect, + useRef, + useState +} from "react"; import { AccessibilityInfo, Dimensions, @@ -34,8 +42,8 @@ import { isIos } from "../platform"; const screenHeight = Dimensions.get("window").height; type Props = { - children: React.ReactNode; - footer?: React.ReactNode; + children: ReactNode; + footer?: ReactNode; } & TestID; const styles = StyleSheet.create({ @@ -51,7 +59,7 @@ const styles = StyleSheet.create({ /** * Build the base content of a BottomSheet including content padding and a ScrollView */ -const BottomSheetContent: React.FunctionComponent = ({ +const BottomSheetContent: FunctionComponent = ({ children, testID }: Props) => ( @@ -67,9 +75,9 @@ const BottomSheetContent: React.FunctionComponent = ({ ); export type BottomSheetModalProps = { - content: React.ReactNode; + content: ReactNode; config: { - handleComponent: React.ReactElement; + handleComponent: ReactElement; }; }; @@ -88,13 +96,13 @@ export type IOBottomSheetModal = { * @param onClose */ export const bottomSheetContent = ( - content: React.ReactNode, - title: string | React.ReactNode, + content: ReactNode, + title: string | ReactNode, onClose: () => void ): BottomSheetModalProps => { const header = ; - const bottomSheetBody: React.ReactNode = ( + const bottomSheetBody: ReactNode = ( {content} ); @@ -109,17 +117,17 @@ export const bottomSheetContent = ( /** * @typedef BottomSheetOptions * @type {BottomSheetOptions} - * @property {component} component The React.Element to be rendered inside the bottom sheet body - * @property {title} title String or React.Element to be rendered as bottom-sheet header title - * @property {footer} footer React.Element or undefined to be rendered as sticky footer of our bottom sheet + * @property {component} component The Element to be rendered inside the bottom sheet body + * @property {title} title String or Element to be rendered as bottom-sheet header title + * @property {footer} footer Element or undefined to be rendered as sticky footer of our bottom sheet * @property {snapPoint} snapPoint The array of points used to pin the height of the bottom sheet * @property {onDismiss} onDismiss The possible function to be used as an effect of the dismissal of the bottom sheet */ type BottomSheetOptions = { - component: React.ReactNode; - title: string | React.ReactNode; + component: ReactNode; + title: string | ReactNode; snapPoint: NonEmptyArray; - footer?: React.ReactElement; + footer?: ReactElement; fullScreen?: boolean; onDismiss?: () => void; }; @@ -138,7 +146,7 @@ export const useIOBottomSheetModal = ({ }: Omit): IOBottomSheetModal => { const insets = useSafeAreaInsets(); const { dismissAll } = useBottomSheetModal(); - const bottomSheetModalRef = React.useRef(null); + const bottomSheetModalRef = useRef(null); const { onOpen, onClose } = useHardwareBackButtonToDismiss(dismissAll); const [screenReaderEnabled, setIsScreenReaderEnabled] = useState(false); @@ -246,12 +254,12 @@ export const useIOBottomSheetAutoresizableModal = ( // We should find a way to make the autoresizable bottom sheet work with the footer! bottomPadding: number = DEFAULT_BOTTOM_PADDING ) => { - const [snapPoint, setSnapPoint] = React.useState( + const [snapPoint, setSnapPoint] = useState( DEFAULT_AUTORESIZABLE_SNAP_POINT ); const insets = useSafeAreaInsets(); - const handleContentOnLayout = React.useCallback( + const handleContentOnLayout = useCallback( (event: LayoutChangeEvent) => { const { height } = event.nativeEvent.layout; const snapPoint = insets.bottom + bottomPadding + height; @@ -288,10 +296,10 @@ export const useIOBottomSheetAutoresizableModal = ( * TODO remove once all the occurencies of `useLegacyIOBottomSheetModal` will be replaced by `useIOBottomSheetModal` */ export const useLegacyIOBottomSheetModal = ( - component: React.ReactNode, - title: string | React.ReactNode, + component: ReactNode, + title: string | ReactNode, snapPoint: number, - footer?: React.ReactElement, + footer?: ReactElement, onDismiss?: () => void ): IOBottomSheetModal => { const insets = useSafeAreaInsets(); diff --git a/ts/utils/hooks/useBiometricType.ts b/ts/utils/hooks/useBiometricType.ts index 764a49f599f..b4d68eeb6db 100644 --- a/ts/utils/hooks/useBiometricType.ts +++ b/ts/utils/hooks/useBiometricType.ts @@ -1,4 +1,4 @@ -import * as React from "react"; +import { useState, useEffect } from "react"; import { BiometricsValidType } from "@pagopa/io-app-design-system"; import { useIOSelector } from "../../store/hooks"; import { isFingerprintEnabledSelector } from "../../store/reducers/persistedPreferences"; @@ -7,10 +7,10 @@ import { getBiometricsType, isBiometricsValidType } from "../biometrics"; export const useBiometricType = () => { const isFingerprintEnabled = useIOSelector(isFingerprintEnabledSelector); - const [biometricType, setBiometricType] = React.useState< + const [biometricType, setBiometricType] = useState< BiometricsValidType | undefined >(undefined); - React.useEffect(() => { + useEffect(() => { if (isFingerprintEnabled) { getBiometricsType().then( biometricsType => diff --git a/ts/utils/identification/index.tsx b/ts/utils/identification/index.tsx index d8c7b6d4489..c077d100e6c 100644 --- a/ts/utils/identification/index.tsx +++ b/ts/utils/identification/index.tsx @@ -3,7 +3,6 @@ import { Body, IOStyles } from "@pagopa/io-app-design-system"; -import * as React from "react"; import { View } from "react-native"; import I18n from "../../i18n"; diff --git a/ts/utils/jest/withStore.tsx b/ts/utils/jest/withStore.tsx index 12530410608..01f432d98bd 100644 --- a/ts/utils/jest/withStore.tsx +++ b/ts/utils/jest/withStore.tsx @@ -1,4 +1,4 @@ -import React, { JSXElementConstructor } from "react"; +import { JSXElementConstructor } from "react"; import { createStore } from "redux"; import { Provider } from "react-redux"; import { appReducer } from "../../store/reducers"; diff --git a/ts/utils/keyboard.tsx b/ts/utils/keyboard.tsx index 5372b7ec5c4..933487d5168 100644 --- a/ts/utils/keyboard.tsx +++ b/ts/utils/keyboard.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { ReactNode } from "react"; import { KeyboardAvoidingView, Platform } from "react-native"; import customVariables from "../theme/variables"; @@ -9,7 +9,7 @@ import customVariables from "../theme/variables"; * @param content */ export const withKeyboard = ( - content: React.ReactNode, + content: ReactNode, insideSafeAreaView: boolean = false ) => ( ( - screen: React.ComponentType, // I need any to avoid passing navigation + screen: ComponentType, // I need any to avoid passing navigation route: string, params: Record, store: Store, diff --git a/tsconfig.json b/tsconfig.json index 405ad4dea34..f88c01dcc8c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "@react-native/typescript-config/tsconfig.json", "compilerOptions": { + "jsx": "react-jsx", "target": "esnext", "lib": ["es6", "dom", "es2019"], "importHelpers": true, @@ -11,7 +12,7 @@ "noUnusedParameters": true, "noUnusedLocals": true, "strictFunctionTypes": true, - "useUnknownInCatchVariables": true + "useUnknownInCatchVariables": true, }, "exclude": [ "android", diff --git a/yarn.lock b/yarn.lock index c80e9c9d1bb..cee80ba780e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -86,6 +86,17 @@ __metadata: languageName: node linkType: hard +"@babel/code-frame@npm:^7.26.0": + version: 7.26.2 + resolution: "@babel/code-frame@npm:7.26.2" + dependencies: + "@babel/helper-validator-identifier": ^7.25.9 + js-tokens: ^4.0.0 + picocolors: ^1.0.0 + checksum: db13f5c42d54b76c1480916485e6900748bbcb0014a8aca87f50a091f70ff4e0d0a6db63cade75eb41fcc3d2b6ba0a7f89e343def4f96f00269b41b8ab8dd7b8 + languageName: node + linkType: hard + "@babel/code-frame@npm:~7.10.4": version: 7.10.4 resolution: "@babel/code-frame@npm:7.10.4" @@ -163,6 +174,29 @@ __metadata: languageName: node linkType: hard +"@babel/core@npm:^7.26.0": + version: 7.26.0 + resolution: "@babel/core@npm:7.26.0" + dependencies: + "@ampproject/remapping": ^2.2.0 + "@babel/code-frame": ^7.26.0 + "@babel/generator": ^7.26.0 + "@babel/helper-compilation-targets": ^7.25.9 + "@babel/helper-module-transforms": ^7.26.0 + "@babel/helpers": ^7.26.0 + "@babel/parser": ^7.26.0 + "@babel/template": ^7.25.9 + "@babel/traverse": ^7.25.9 + "@babel/types": ^7.26.0 + convert-source-map: ^2.0.0 + debug: ^4.1.0 + gensync: ^1.0.0-beta.2 + json5: ^2.2.3 + semver: ^6.3.1 + checksum: b296084cfd818bed8079526af93b5dfa0ba70282532d2132caf71d4060ab190ba26d3184832a45accd82c3c54016985a4109ab9118674347a7e5e9bc464894e6 + languageName: node + linkType: hard + "@babel/eslint-parser@npm:^7.18.2, @babel/eslint-parser@npm:^7.20.0": version: 7.24.7 resolution: "@babel/eslint-parser@npm:7.24.7" @@ -201,6 +235,19 @@ __metadata: languageName: node linkType: hard +"@babel/generator@npm:^7.26.0": + version: 7.26.3 + resolution: "@babel/generator@npm:7.26.3" + dependencies: + "@babel/parser": ^7.26.3 + "@babel/types": ^7.26.3 + "@jridgewell/gen-mapping": ^0.3.5 + "@jridgewell/trace-mapping": ^0.3.25 + jsesc: ^3.0.2 + checksum: fb09fa55c66f272badf71c20a3a2cee0fa1a447fed32d1b84f16a668a42aff3e5f5ddc6ed5d832dda1e952187c002ca1a5cdd827022efe591b6ac44cada884ea + languageName: node + linkType: hard + "@babel/helper-annotate-as-pure@npm:^7.10.4, @babel/helper-annotate-as-pure@npm:^7.24.7": version: 7.24.7 resolution: "@babel/helper-annotate-as-pure@npm:7.24.7" @@ -446,7 +493,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-module-transforms@npm:^7.25.9": +"@babel/helper-module-transforms@npm:^7.25.9, @babel/helper-module-transforms@npm:^7.26.0": version: 7.26.0 resolution: "@babel/helper-module-transforms@npm:7.26.0" dependencies: @@ -660,6 +707,16 @@ __metadata: languageName: node linkType: hard +"@babel/helpers@npm:^7.26.0": + version: 7.26.0 + resolution: "@babel/helpers@npm:7.26.0" + dependencies: + "@babel/template": ^7.25.9 + "@babel/types": ^7.26.0 + checksum: d77fe8d45033d6007eadfa440355c1355eed57902d5a302f450827ad3d530343430a21210584d32eef2f216ae463d4591184c6fc60cf205bbf3a884561469200 + languageName: node + linkType: hard + "@babel/highlight@npm:^7.10.4, @babel/highlight@npm:^7.24.7": version: 7.24.7 resolution: "@babel/highlight@npm:7.24.7" @@ -704,6 +761,17 @@ __metadata: languageName: node linkType: hard +"@babel/parser@npm:^7.26.0, @babel/parser@npm:^7.26.3": + version: 7.26.3 + resolution: "@babel/parser@npm:7.26.3" + dependencies: + "@babel/types": ^7.26.3 + bin: + parser: ./bin/babel-parser.js + checksum: e2bff2e9fa6540ee18fecc058bc74837eda2ddcecbe13454667314a93fc0ba26c1fb862c812d84f6d5f225c3bd8d191c3a42d4296e287a882c4e1f82ff2815ff + languageName: node + linkType: hard + "@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:^7.24.7": version: 7.24.7 resolution: "@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:7.24.7" @@ -2159,6 +2227,21 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-react-jsx@npm:^7.25.9": + version: 7.25.9 + resolution: "@babel/plugin-transform-react-jsx@npm:7.25.9" + dependencies: + "@babel/helper-annotate-as-pure": ^7.25.9 + "@babel/helper-module-imports": ^7.25.9 + "@babel/helper-plugin-utils": ^7.25.9 + "@babel/plugin-syntax-jsx": ^7.25.9 + "@babel/types": ^7.25.9 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 5c6523c3963e3c6cf4c3cc2768a3766318af05b8f6c17aff52a4010e2c170e87b2fcdc94e9c9223ae12158664df4852ce81b9c8d042c15ea8fd83d6375f9f30f + languageName: node + linkType: hard + "@babel/plugin-transform-regenerator@npm:^7.0.0, @babel/plugin-transform-regenerator@npm:^7.24.7": version: 7.24.7 resolution: "@babel/plugin-transform-regenerator@npm:7.24.7" @@ -10530,6 +10613,19 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-ft-flow@npm:latest": + version: 3.0.11 + resolution: "eslint-plugin-ft-flow@npm:3.0.11" + dependencies: + lodash: ^4.17.21 + string-natural-compare: ^3.0.1 + peerDependencies: + eslint: ^8.56.0 || ^9.0.0 + hermes-eslint: ">=0.15.0" + checksum: eba55022633424b7c5e491d4939eeba5525f5b1345a9fa0846a47f508885b91a0ee2a008276e4031260d0f9c1d971903b7469d8915ebc668cce67a01cdb808d0 + languageName: node + linkType: hard + "eslint-plugin-functional@npm:^4.1.1": version: 4.1.1 resolution: "eslint-plugin-functional@npm:4.1.1" @@ -13550,7 +13646,11 @@ __metadata: version: 0.0.0-use.local resolution: "italia-app@workspace:." dependencies: - "@babel/core": ^7.20.0 + "@babel/core": ^7.26.0 + "@babel/plugin-transform-class-properties": ^7.25.9 + "@babel/plugin-transform-private-methods": ^7.25.9 + "@babel/plugin-transform-private-property-in-object": ^7.25.9 + "@babel/plugin-transform-react-jsx": ^7.25.9 "@babel/plugin-transform-regenerator": ^7.18.6 "@babel/preset-env": ^7.20.0 "@babel/preset-typescript": ^7.23.3 @@ -13635,6 +13735,7 @@ __metadata: detox: ^19.9.2 eslint: ^8.19.0 eslint-config-prettier: ^8.3.0 + eslint-plugin-ft-flow: latest eslint-plugin-functional: ^4.1.1 eslint-plugin-import: ^2.25.4 eslint-plugin-jest: ^28.8.3