Skip to content

Commit 0e0fbd2

Browse files
Fix Issue #1444 (#1446)
* lint fix * fix: prevent ref prop from being passed to extra component in ListItem * update snapshots
1 parent 6266c01 commit 0e0fbd2

File tree

9 files changed

+41
-17
lines changed

9 files changed

+41
-17
lines changed

.eslintrc.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ module.exports = {
66
rules: {
77
'react-native/no-inline-styles': 0,
88
semi: [1, 'never'],
9-
'@typescript-eslint/no-unused-vars': [1, { args: 'none' }],
9+
'@typescript-eslint/no-unused-vars': [
10+
1,
11+
{
12+
args: 'none',
13+
argsIgnorePattern: '^_',
14+
varsIgnorePattern: '^_',
15+
},
16+
],
1017
},
1118
env: {
1219
browser: true,

components/badge/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default class Badge extends React.Component<BadgeProps, any> {
3535
...restProps // todo: hot
3636
} = this.props
3737
return (
38-
<WithTheme themeStyles={BadgeStyles} styles={this.props.styles}>
38+
<WithTheme themeStyles={BadgeStyles} styles={styles}>
3939
{(s) => {
4040
text =
4141
typeof text === 'number' && text > (overflowCount as number)

components/list/ListItem.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,16 @@ const InternalListItem: React.ForwardRefRenderFunction<
159159
if (typeof extra.props.children === 'function') {
160160
return <AntmView style={[itemStyles.Extra]}>{extra}</AntmView>
161161
}
162+
163+
const viewProps = { ...(extra.props ?? {}) } as Record<string, any>
164+
if ('ref' in viewProps) {
165+
delete viewProps.ref
166+
}
167+
162168
return (
163169
<AntmView
164170
children={extra}
165-
{...extra.props}
171+
{...viewProps}
166172
style={[itemStyles.Extra, extra.props.style]}
167173
/>
168174
)

components/modal/__tests__/__snapshots__/demo.test.js.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ exports[`renders ./components/modal/demo/basic.tsx correctly 1`] = `
237237
"marginLeft": 29,
238238
"marginRight": 2,
239239
"textAlign": "center",
240+
"zIndex": -1,
240241
}
241242
}
242243
>

components/provider/AccessibilityContext.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ export interface AccessibilityContextProps {
1010
children?: React.ReactNode
1111
}
1212

13-
export const AccessibilityContextProvider: React.FC<AccessibilityContextProps> =
14-
({ children, isRTL }) => {
15-
const originValue = React.useContext(AccessibilityContext)
16-
return (
17-
<AccessibilityContext.Provider value={isRTL ?? originValue}>
18-
{children}
19-
</AccessibilityContext.Provider>
20-
)
21-
}
13+
export const AccessibilityContextProvider: React.FC<
14+
AccessibilityContextProps
15+
> = ({ children, isRTL }) => {
16+
const originValue = React.useContext(AccessibilityContext)
17+
return (
18+
<AccessibilityContext.Provider value={isRTL ?? originValue}>
19+
{children}
20+
</AccessibilityContext.Provider>
21+
)
22+
}
2223

2324
export default AccessibilityContext

components/search-bar/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,8 @@ export default class SearchBar extends React.Component<
103103
const {
104104
showCancelButton,
105105
styles,
106-
value: propsValue,
107106
cancelText,
108-
onChangeText,
109-
onChange,
107+
onChange: _,
110108
disabled,
111109
style,
112110
...restProps

components/switch/__tests__/__snapshots__/demo.test.js.snap

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ exports[`renders ./components/switch/demo/basic.tsx correctly 1`] = `
199199
"marginLeft": 29,
200200
"marginRight": 2,
201201
"textAlign": "center",
202+
"zIndex": -1,
202203
}
203204
}
204205
/>
@@ -423,6 +424,7 @@ exports[`renders ./components/switch/demo/basic.tsx correctly 1`] = `
423424
"marginLeft": 29,
424425
"marginRight": 2,
425426
"textAlign": "center",
427+
"zIndex": -1,
426428
}
427429
}
428430
/>
@@ -747,6 +749,7 @@ exports[`renders ./components/switch/demo/basic.tsx correctly 1`] = `
747749
"marginLeft": 29,
748750
"marginRight": 2,
749751
"textAlign": "center",
752+
"zIndex": -1,
750753
}
751754
}
752755
>
@@ -921,6 +924,7 @@ exports[`renders ./components/switch/demo/basic.tsx correctly 1`] = `
921924
"marginLeft": 29,
922925
"marginRight": 2,
923926
"textAlign": "center",
927+
"zIndex": -1,
924928
}
925929
}
926930
>
@@ -1108,6 +1112,7 @@ exports[`renders ./components/switch/demo/basic.tsx correctly 1`] = `
11081112
"marginLeft": 29,
11091113
"marginRight": 2,
11101114
"textAlign": "center",
1115+
"zIndex": -1,
11111116
}
11121117
}
11131118
>
@@ -1370,6 +1375,7 @@ exports[`renders ./components/switch/demo/basic.tsx correctly 1`] = `
13701375
"marginLeft": 29,
13711376
"marginRight": 2,
13721377
"textAlign": "center",
1378+
"zIndex": -1,
13731379
}
13741380
}
13751381
/>
@@ -1565,6 +1571,7 @@ exports[`renders ./components/switch/demo/basic.tsx correctly 1`] = `
15651571
"marginLeft": 29,
15661572
"marginRight": 2,
15671573
"textAlign": "center",
1574+
"zIndex": -1,
15681575
}
15691576
}
15701577
/>
@@ -1790,6 +1797,7 @@ exports[`renders ./components/switch/demo/basic.tsx correctly 1`] = `
17901797
"marginLeft": 29,
17911798
"marginRight": 2,
17921799
"textAlign": "center",
1800+
"zIndex": -1,
17931801
}
17941802
}
17951803
/>
@@ -2011,6 +2019,7 @@ exports[`renders ./components/switch/demo/basic.tsx correctly 1`] = `
20112019
"marginLeft": 29,
20122020
"marginRight": 2,
20132021
"textAlign": "center",
2022+
"zIndex": -1,
20142023
}
20152024
}
20162025
/>

components/tabs/Tabs.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,14 +304,14 @@ export class Tabs extends React.PureComponent<TabsProps, StateType> {
304304
}
305305
}
306306

307-
renderTabBar(tabBarProps: any, DefaultTabBar: React.ComponentClass) {
307+
renderTabBar(tabBarProps: any, DefaultTabBarComponent: React.ComponentClass) {
308308
const { renderTabBar } = this.props
309309
if (renderTabBar === false) {
310310
return null
311311
} else if (renderTabBar) {
312312
return renderTabBar(tabBarProps)
313313
} else {
314-
return <DefaultTabBar {...tabBarProps} />
314+
return <DefaultTabBarComponent {...tabBarProps} />
315315
}
316316
}
317317

components/toast/__tests__/__snapshots__/demo.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ exports[`renders ./components/toast/demo/basic.tsx correctly 1`] = `
224224
"marginLeft": 29,
225225
"marginRight": 2,
226226
"textAlign": "center",
227+
"zIndex": -1,
227228
}
228229
}
229230
/>
@@ -435,6 +436,7 @@ exports[`renders ./components/toast/demo/basic.tsx correctly 1`] = `
435436
"marginLeft": 29,
436437
"marginRight": 2,
437438
"textAlign": "center",
439+
"zIndex": -1,
438440
}
439441
}
440442
/>

0 commit comments

Comments
 (0)