diff --git a/package.json b/package.json index fd64125a84..db5af76fbd 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "@react-native/typescript-config": "0.78.3", "@shopify/flash-list": "1.7.6", "@testing-library/react-native": "^11.5.1", - "@types/hoist-non-react-statics": "^3.3.1", + "@types/hoist-non-react-statics": "^3.3.7", "@types/jest": "^29.5.13", "@types/lodash": "^4.0.0", "@types/react": "19.0.0", diff --git a/packages/react-native-ui-lib/package.json b/packages/react-native-ui-lib/package.json index 95f880812a..56652a5e46 100644 --- a/packages/react-native-ui-lib/package.json +++ b/packages/react-native-ui-lib/package.json @@ -65,7 +65,7 @@ "@react-native/typescript-config": "0.78.3", "@shopify/flash-list": "1.7.6", "@testing-library/react-native": "^11.5.1", - "@types/hoist-non-react-statics": "^3.3.1", + "@types/hoist-non-react-statics": "^3.3.7", "@types/jest": "^29.5.13", "@types/lodash": "^4.0.0", "@types/react": "19.0.0", diff --git a/packages/react-native-ui-lib/src/components/featureHighlight/index.tsx b/packages/react-native-ui-lib/src/components/featureHighlight/index.tsx index 229597a5b5..fdde33b55f 100644 --- a/packages/react-native-ui-lib/src/components/featureHighlight/index.tsx +++ b/packages/react-native-ui-lib/src/components/featureHighlight/index.tsx @@ -327,7 +327,6 @@ class FeatureHighlight extends Component { titleStyle ]} numberOfLines={titleNumberOfLines} - // @ts-expect-error pointerEvents={'none'} > {title} @@ -338,7 +337,6 @@ class FeatureHighlight extends Component { text70 style={[styles.message, {color}, messageStyle]} numberOfLines={messageNumberOfLines} - // @ts-expect-error pointerEvents={'none'} > {message} diff --git a/packages/react-native-ui-lib/src/components/hint/HintMockChildren.tsx b/packages/react-native-ui-lib/src/components/hint/HintMockChildren.tsx index 8bf9607fc4..92f29d09a8 100644 --- a/packages/react-native-ui-lib/src/components/hint/HintMockChildren.tsx +++ b/packages/react-native-ui-lib/src/components/hint/HintMockChildren.tsx @@ -25,7 +25,7 @@ export default function HintMockChildren({children, backdropColor, targetLayout} {React.cloneElement(children, { collapsable: false, key: 'mock', - style: [children.props.style, styles.mockChildren] + style: [(children.props as any).style, styles.mockChildren] })} ); diff --git a/packages/react-native-ui-lib/src/components/hint/HintOld.tsx b/packages/react-native-ui-lib/src/components/hint/HintOld.tsx index 1371c87199..ecc68838fc 100644 --- a/packages/react-native-ui-lib/src/components/hint/HintOld.tsx +++ b/packages/react-native-ui-lib/src/components/hint/HintOld.tsx @@ -593,7 +593,7 @@ class Hint extends Component { {React.cloneElement(children, { collapsable: false, key: 'mock', - style: [children.props.style, styles.mockChildren] + style: [(children.props as any).style, styles.mockChildren] })} ); diff --git a/packages/react-native-ui-lib/src/components/image/index.tsx b/packages/react-native-ui-lib/src/components/image/index.tsx index 3057023875..09bc8fa76f 100644 --- a/packages/react-native-ui-lib/src/components/image/index.tsx +++ b/packages/react-native-ui-lib/src/components/image/index.tsx @@ -245,17 +245,21 @@ class Image extends PureComponent { const {margins} = modifiers; return ( - // @ts-ignore { - /** - * Whether to use a FlatList. NOTE: you must pass 'data' and 'renderItem' props as well - */ - useList?: boolean; +export type ListProps = + | (FlatListProps & { + /** + * Whether to use a FlatList. NOTE: you must pass 'data' and 'renderItem' props as well + */ + useList: true; + }) + | (ScrollViewProps & { + /** + * Whether to use a ScrollView. NOTE: you must pass 'contentContainerStyle' prop as well + */ + useList?: false; + }); + +export type ScrollBarProps = ListProps & { /** * The element to use as a container, instead of a View */ @@ -58,7 +69,7 @@ export interface ScrollBarProps extends FlatListProps { * The index to currently focus on */ focusIndex?: number; -} +}; type Props = ScrollBarProps & ForwardRefInjectedProps; diff --git a/packages/react-native-ui-lib/src/components/view/index.tsx b/packages/react-native-ui-lib/src/components/view/index.tsx index b082ea2ea4..f223cd09fd 100644 --- a/packages/react-native-ui-lib/src/components/view/index.tsx +++ b/packages/react-native-ui-lib/src/components/view/index.tsx @@ -116,7 +116,7 @@ function View(props: ViewProps, ref: any) { } return container; - }, [useSafeArea, animated, reanimated]); + }, [useSafeArea, animated, reanimated]) as React.ComponentType; const _style = useMemo(() => { const backgroundColor = backgroundColorProps || backgroundColorModifiers; @@ -155,7 +155,6 @@ function View(props: ViewProps, ref: any) { } return ( - //@ts-expect-error (...refs: React.Ref[]) => { if (typeof ref === 'function') { ref(targetRef.current); } else { - // @ts-expect-error ref.current = targetRef.current; } }); diff --git a/packages/react-native-ui-lib/src/typings/module.d.ts b/packages/react-native-ui-lib/src/typings/module.d.ts index 56aa60b906..7f0f87496c 100644 --- a/packages/react-native-ui-lib/src/typings/module.d.ts +++ b/packages/react-native-ui-lib/src/typings/module.d.ts @@ -3,11 +3,20 @@ declare namespace globalThis { var _UILIB_TESTING: boolean; } +declare global { + // eslint-disable-next-line no-var + var _UILIB_TESTING: boolean; +} + // This support importing png files, typing wise declare module '*.png'; -declare namespace JSX { - interface IntrinsicAttributes { - fsTagName?: string; +import 'react'; + +declare module 'react' { + namespace JSX { + interface IntrinsicAttributes { + fsTagName?: string; + } } } diff --git a/yarn.lock b/yarn.lock index 0382bd9608..fab7d263e6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2929,13 +2929,14 @@ __metadata: languageName: node linkType: hard -"@types/hoist-non-react-statics@npm:^3.3.1": - version: 3.3.5 - resolution: "@types/hoist-non-react-statics@npm:3.3.5" +"@types/hoist-non-react-statics@npm:^3.3.7": + version: 3.3.7 + resolution: "@types/hoist-non-react-statics@npm:3.3.7" dependencies: - "@types/react": "npm:*" hoist-non-react-statics: "npm:^3.3.0" - checksum: 10c0/2a3b64bf3d9817d7830afa60ee314493c475fb09570a64e7737084cd482d2177ebdddf888ce837350bac51741278b077683facc9541f052d4bbe8487b4e3e618 + peerDependencies: + "@types/react": "*" + checksum: 10c0/ed8f4e88338f7d021d0f956adf6089d2a12b2e254a03c05292324f2e986d2376eb9efdb8a4f04596823e8fca88c9d06361d20dab4a2a00dc935fb36ac911de55 languageName: node linkType: hard @@ -9560,7 +9561,7 @@ __metadata: "@react-native/typescript-config": "npm:0.78.3" "@shopify/flash-list": "npm:1.7.6" "@testing-library/react-native": "npm:^11.5.1" - "@types/hoist-non-react-statics": "npm:^3.3.1" + "@types/hoist-non-react-statics": "npm:^3.3.7" "@types/jest": "npm:^29.5.13" "@types/lodash": "npm:^4.0.0" "@types/react": "npm:19.0.0" @@ -9610,7 +9611,7 @@ __metadata: "@react-native/typescript-config": "npm:0.78.3" "@shopify/flash-list": "npm:1.7.6" "@testing-library/react-native": "npm:^11.5.1" - "@types/hoist-non-react-statics": "npm:^3.3.1" + "@types/hoist-non-react-statics": "npm:^3.3.7" "@types/jest": "npm:^29.5.13" "@types/lodash": "npm:^4.0.0" "@types/react": "npm:19.0.0"