Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ const restrictedImportPaths = [
importNames: ['useSafeAreaInsets', 'SafeAreaConsumer', 'SafeAreaInsetsContext'],
message: "Please use 'useSafeAreaInsets' from 'src/hooks/useSafeAreaInset' and/or 'SafeAreaConsumer' from 'src/components/SafeAreaConsumer' instead.",
},
{
name: 'react',
importNames: ['CSSProperties'],
message: "Please use 'ViewStyle', 'TextStyle', 'ImageStyle' from 'react-native' instead.",
},
];

const restrictedImportPatterns = [
Expand Down
2 changes: 1 addition & 1 deletion src/components/Icon/svgs/LoungeAccessIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import Svg, {G, Path, Polygon} from 'react-native-svg';
import useTheme from '@hooks/useTheme';

Expand Down
2 changes: 1 addition & 1 deletion src/components/MapView/MapView.website.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ const MapView = forwardRef<MapViewHandle, ComponentProps>(
latitude: currentPosition?.latitude,
zoom: initialState.zoom,
}}
style={StyleUtils.getTextColorStyle(theme.mapAttributionText) as React.CSSProperties}
style={StyleUtils.getTextColorStyle(theme.mapAttributionText)}
mapStyle={styleURL}
>
{waypoints?.map(({coordinate, markerComponent, id}) => {
Expand Down
8 changes: 4 additions & 4 deletions src/styles/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {CSSProperties} from 'react';
import {Animated, DimensionValue, PressableStateCallbackType, StyleProp, StyleSheet, TextStyle, ViewStyle} from 'react-native';
import {EdgeInsets} from 'react-native-safe-area-context';
import {ValueOf} from 'type-fest';
Expand Down Expand Up @@ -31,6 +30,7 @@ import {
EReceiptColorName,
EreceiptColorStyle,
ParsableStyle,
TextColorStyle,
WorkspaceColorStyle,
} from './types';

Expand Down Expand Up @@ -402,7 +402,7 @@ function getBackgroundColorStyle(backgroundColor: string): ViewStyle {
/**
* Returns a style for text color
*/
function getTextColorStyle(color: string): TextStyle {
function getTextColorStyle(color: string): TextColorStyle {
return {
color,
};
Expand Down Expand Up @@ -613,7 +613,7 @@ function getMinimumHeight(minHeight: number): ViewStyle {
/**
* Get minimum width as style
*/
function getMinimumWidth(minWidth: number): ViewStyle | CSSProperties {
function getMinimumWidth(minWidth: number): ViewStyle {
return {
minWidth,
};
Expand Down Expand Up @@ -906,7 +906,7 @@ function getMenuItemTextContainerStyle(isSmallAvatarSubscriptMenu: boolean): Vie
/**
* Returns color style
*/
function getColorStyle(color: string): ViewStyle | CSSProperties {
function getColorStyle(color: string): TextColorStyle {
return {color};
}

Expand Down
3 changes: 1 addition & 2 deletions src/styles/utils/objectFit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {CSSProperties} from 'react';
import {ViewStyle} from 'react-native';

export default {
Expand All @@ -14,4 +13,4 @@ export default {
oFNone: {
objectFit: 'none',
},
} satisfies Record<string, ViewStyle | CSSProperties>;
} satisfies Record<string, ViewStyle>;
2 changes: 2 additions & 0 deletions src/styles/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type AvatarSize = {width: number};

type WorkspaceColorStyle = {backgroundColor: ColorValue; fill: ColorValue};
type EreceiptColorStyle = {backgroundColor: ColorValue; color: ColorValue};
type TextColorStyle = {color: string};

export type {
AllStyles,
Expand All @@ -56,4 +57,5 @@ export type {
AvatarSize,
WorkspaceColorStyle,
EreceiptColorStyle,
TextColorStyle,
};
1 change: 1 addition & 0 deletions src/types/modules/react-native.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/* eslint-disable @typescript-eslint/no-empty-interface */

/* eslint-disable @typescript-eslint/consistent-type-definitions */
// eslint-disable-next-line no-restricted-imports
import {CSSProperties, FocusEventHandler, KeyboardEventHandler, MouseEventHandler, PointerEventHandler, UIEventHandler, WheelEventHandler} from 'react';
import 'react-native';
import {BootSplashModule} from '@libs/BootSplash/types';
Expand Down
3 changes: 1 addition & 2 deletions src/types/onyx/Bank.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {CSSProperties} from 'react';
import {ViewStyle} from 'react-native';
import {SvgProps} from 'react-native-svg';
import {ValueOf} from 'type-fest';
Expand All @@ -9,7 +8,7 @@ type BankIcon = {
iconSize?: number;
iconHeight?: number;
iconWidth?: number;
iconStyles?: Array<ViewStyle | CSSProperties>;
iconStyles?: ViewStyle[];
};

type BankName = ValueOf<typeof CONST.BANK_NAMES>;
Expand Down
3 changes: 1 addition & 2 deletions src/types/onyx/PaymentMethod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {CSSProperties} from 'react';
import {ViewStyle} from 'react-native';
import {SvgProps} from 'react-native-svg';
import BankAccount from './BankAccount';
Expand All @@ -10,7 +9,7 @@ type PaymentMethod = (BankAccount | Fund) & {
iconSize?: number;
iconHeight?: number;
iconWidth?: number;
iconStyles?: Array<ViewStyle | CSSProperties>;
iconStyles?: ViewStyle[];
};

export default PaymentMethod;