Skip to content

Commit 8311151

Browse files
fix: linter errors
1 parent d4b4662 commit 8311151

6 files changed

Lines changed: 17 additions & 8 deletions

File tree

src/components/Surface.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { useInternalTheme } from '../core/theming';
1212
import overlay, { isAnimatedValue } from '../styles/overlay';
1313
import shadow from '../styles/shadow';
1414
import type { ThemeProp, MD3Elevation } from '../types';
15+
import { forwardRef } from '../utils/forwardRef';
1516

1617
export type Props = React.ComponentPropsWithRef<typeof View> & {
1718
/**
@@ -39,7 +40,7 @@ export type Props = React.ComponentPropsWithRef<typeof View> & {
3940
ref?: React.RefObject<View>;
4041
};
4142

42-
const MD2Surface = React.forwardRef<View, Props>(
43+
const MD2Surface = forwardRef<View, Props>(
4344
({ style, theme: overrideTheme, ...rest }: Omit<Props, 'elevation'>, ref) => {
4445
const { elevation = 4 } = (StyleSheet.flatten(style) || {}) as ViewStyle;
4546
const { dark: isDarkTheme, mode, colors } = useInternalTheme(overrideTheme);
@@ -105,7 +106,7 @@ const MD2Surface = React.forwardRef<View, Props>(
105106
* });
106107
* ```
107108
*/
108-
const Surface = React.forwardRef<View, Props>(
109+
const Surface = forwardRef<View, Props>(
109110
(
110111
{
111112
elevation = 1,

src/components/ToggleButton/ToggleButton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import color from 'color';
1212
import { useInternalTheme } from '../../core/theming';
1313
import { black, white } from '../../styles/themes/v2/colors';
1414
import type { ThemeProp } from '../../types';
15+
import { forwardRef } from '../../utils/forwardRef';
1516
import type { IconSource } from '../Icon';
1617
import IconButton from '../IconButton/IconButton';
1718
import { ToggleButtonGroupContext } from './ToggleButtonGroup';
@@ -92,7 +93,7 @@ export type Props = {
9293
*
9394
* ```
9495
*/
95-
const ToggleButton = React.forwardRef<View, Props>(
96+
const ToggleButton = forwardRef<View, Props>(
9697
(
9798
{
9899
icon,

src/components/Typography/Text.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99

1010
import { useInternalTheme } from '../../core/theming';
1111
import { Font, MD3TypescaleKey, ThemeProp } from '../../types';
12+
import { forwardRef } from '../../utils/forwardRef';
1213

1314
export type Props = React.ComponentProps<typeof NativeText> & {
1415
/**
@@ -149,4 +150,4 @@ const styles = StyleSheet.create({
149150
},
150151
});
151152

152-
export default React.forwardRef(Text);
153+
export default forwardRef(Text);

src/components/Typography/v2/Text.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
import type { MD2Theme } from 'src/types';
1010

1111
import { useInternalTheme } from '../../../core/theming';
12+
import { forwardRef } from '../../../utils/forwardRef';
1213

1314
type Props = React.ComponentProps<typeof NativeText> & {
1415
style?: StyleProp<TextStyle>;
@@ -58,4 +59,4 @@ const styles = StyleSheet.create({
5859
},
5960
});
6061

61-
export default React.forwardRef(Text);
62+
export default forwardRef(Text);

src/components/__tests__/.eslintrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"rules": {
3+
"local-rules/no-react-forwardref-usage": "off"
4+
}
5+
}

src/utils/forwardRef.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {
2-
forwardRef as reactForwardRef,
1+
import * as React from 'react';
2+
import type {
33
ForwardRefRenderFunction,
44
PropsWithoutRef,
55
RefAttributes,
@@ -20,4 +20,4 @@ export type ForwarRefComponent<T, P = {}> = ForwardRefExoticComponent<
2020
*/
2121
export const forwardRef: <T, P = {}>(
2222
render: ForwardRefRenderFunction<T, P>
23-
) => ForwarRefComponent<T, P> = reactForwardRef;
23+
) => ForwarRefComponent<T, P> = React.forwardRef;

0 commit comments

Comments
 (0)