File tree Expand file tree Collapse file tree 7 files changed +35
-6
lines changed
Expand file tree Collapse file tree 7 files changed +35
-6
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import type { ThemeProp } from 'src/types';
66
77import { useInternalTheme } from '../../core/theming' ;
88import { black } from '../../styles/themes/v2/colors' ;
9+ import { forwardRef } from '../../utils/forwardRef' ;
910import type { IconSource } from '../Icon' ;
1011import IconButton from '../IconButton/IconButton' ;
1112
@@ -73,7 +74,7 @@ export type Props = React.ComponentPropsWithoutRef<typeof IconButton> & {
7374 * export default MyComponent;
7475 * ```
7576 */
76- const AppbarAction = React . forwardRef < View , Props > (
77+ const AppbarAction = forwardRef < View , Props > (
7778 (
7879 {
7980 size = 24 ,
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import type {
66 View ,
77} from 'react-native' ;
88
9+ import { forwardRef } from '../../utils/forwardRef' ;
910import type { $Omit } from './../../types' ;
1011import AppbarAction from './AppbarAction' ;
1112import AppbarBackIcon from './AppbarBackIcon' ;
@@ -60,7 +61,7 @@ export type Props = $Omit<
6061 * export default MyComponent;
6162 * ```
6263 */
63- const AppbarBackAction = React . forwardRef < View , Props > (
64+ const AppbarBackAction = forwardRef < View , Props > (
6465 ( { accessibilityLabel = 'Back' , ...rest } : Props , ref ) => (
6566 < AppbarAction
6667 accessibilityLabel = { accessibilityLabel }
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import {
1111
1212import { useInternalTheme } from '../../core/theming' ;
1313import type { $RemoveChildren , ThemeProp } from '../../types' ;
14+ import { forwardRef } from '../../utils/forwardRef' ;
1415import ActivityIndicator from '../ActivityIndicator' ;
1516import CrossFadeIcon from '../CrossFadeIcon' ;
1617import Icon , { IconSource } from '../Icon' ;
@@ -154,7 +155,7 @@ export type Props = $RemoveChildren<typeof Surface> & {
154155 * export default MyComponent;
155156 * ```
156157 */
157- const FAB = React . forwardRef < View , Props > (
158+ const FAB = forwardRef < View , Props > (
158159 (
159160 {
160161 icon,
Original file line number Diff line number Diff line change 99
1010import { useInternalTheme } from '../../core/theming' ;
1111import type { $RemoveChildren , ThemeProp } from '../../types' ;
12+ import { forwardRef } from '../../utils/forwardRef' ;
1213import CrossFadeIcon from '../CrossFadeIcon' ;
1314import Icon , { IconSource } from '../Icon' ;
1415import Surface from '../Surface' ;
@@ -112,7 +113,7 @@ export type Props = $RemoveChildren<typeof TouchableRipple> & {
112113 *
113114 * @extends TouchableRipple props https://callstack.github.io/react-native-paper/touchable-ripple.html
114115 */
115- const IconButton = React . forwardRef < View , Props > (
116+ const IconButton = forwardRef < View , Props > (
116117 (
117118 {
118119 icon,
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import color from 'color';
1717
1818import { useInternalTheme } from '../core/theming' ;
1919import type { ThemeProp } from '../types' ;
20+ import { forwardRef } from '../utils/forwardRef' ;
2021import ActivityIndicator from './ActivityIndicator' ;
2122import type { IconSource } from './Icon' ;
2223import IconButton from './IconButton/IconButton' ;
@@ -119,7 +120,7 @@ type TextInputHandles = Pick<
119120
120121 * ```
121122 */
122- const Searchbar = React . forwardRef < TextInputHandles , Props > (
123+ const Searchbar = forwardRef < TextInputHandles , Props > (
123124 (
124125 {
125126 clearAccessibilityLabel = 'clear' ,
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import {
1010
1111import { useInternalTheme } from '../../core/theming' ;
1212import type { ThemeProp } from '../../types' ;
13+ import { forwardRef } from '../../utils/forwardRef' ;
1314import TextInputAffix , {
1415 Props as TextInputAffixProps ,
1516} from './Adornment/TextInputAffix' ;
@@ -220,7 +221,7 @@ type TextInputHandles = Pick<
220221 * @extends TextInput props https://reactnative.dev/docs/textinput#props
221222 */
222223
223- const TextInput = React . forwardRef < TextInputHandles , Props > (
224+ const TextInput = forwardRef < TextInputHandles , Props > (
224225 (
225226 {
226227 mode = 'flat' ,
Original file line number Diff line number Diff line change 1+ import {
2+ forwardRef as reactForwardRef ,
3+ ForwardRefRenderFunction ,
4+ PropsWithoutRef ,
5+ RefAttributes ,
6+ ForwardRefExoticComponent ,
7+ } from 'react' ;
8+
9+ export type ForwarRefComponent < T , P = { } > = ForwardRefExoticComponent <
10+ PropsWithoutRef < P > & RefAttributes < T >
11+ > ;
12+
13+ /**
14+ * TypeScript generated a large union of props from `ViewProps` in
15+ * `d.ts` files when using `React.forwardRef`. To prevent this
16+ * `ForwarRefComponent` was created and exported. Use this
17+ * `forwardRef` instead of `React.forwardRef` so you don't have to
18+ * import `ForwarRefComponent`.
19+ * More info: https://github.com/callstack/react-native-paper/pull/3603
20+ */
21+ export const forwardRef : < T , P = { } > (
22+ render : ForwardRefRenderFunction < T , P >
23+ ) => ForwarRefComponent < T , P > = reactForwardRef ;
You can’t perform that action at this time.
0 commit comments