Skip to content

Commit 7f72454

Browse files
authored
Fix/ forwardRef warning (#1786)
* move forwardRef * skip button tests * remove temp change
1 parent b2a134f commit 7f72454

File tree

4 files changed

+11
-11
lines changed
  • generatedTypes
    • lib/components/Keyboard/KeyboardTracking/KeyboardTrackingView
    • src/incubator/ChipsInput
  • lib/components/Keyboard/KeyboardTracking/KeyboardTrackingView
  • src/incubator/ChipsInput

4 files changed

+11
-11
lines changed

generatedTypes/lib/components/Keyboard/KeyboardTracking/KeyboardTrackingView/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export declare type KeyboardTrackingViewProps = ViewProps & {
2626
children?: React.ReactChild | React.ReactChild[];
2727
style?: ViewStyle;
2828
};
29-
declare const _default: React.ForwardRefExoticComponent<Pick<ViewProps & {
29+
declare const KeyboardTrackingView: React.ForwardRefExoticComponent<Pick<ViewProps & {
3030
/**
3131
* Enables tracking of the keyboard when it's dismissed interactively (false by default).
3232
* Why? When using an external keyboard (BT),
@@ -52,4 +52,4 @@ declare const _default: React.ForwardRefExoticComponent<Pick<ViewProps & {
5252
children?: React.ReactChild | React.ReactChild[] | undefined;
5353
style?: ViewStyle | undefined;
5454
}, keyof ViewProps | "useSafeArea" | "trackInteractive" | "scrollToFocusedInput" | "scrollBehavior" | "revealKeyboardInteractive" | "manageScrollView" | "requiresSameParentToManageScrollView" | "addBottomView" | "allowHitsOutsideBounds"> & React.RefAttributes<unknown>>;
55-
export default _default;
55+
export default KeyboardTrackingView;

generatedTypes/src/incubator/ChipsInput/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export declare type ChipsInputProps = Omit<TextFieldProps, 'ref'> & {
3030
*/
3131
maxChips?: number;
3232
};
33-
declare const _default: React.ForwardRefExoticComponent<Omit<TextFieldProps, "ref"> & {
33+
declare const ChipsInput: React.ForwardRefExoticComponent<Omit<TextFieldProps, "ref"> & {
3434
/**
3535
* Chip items to render in the input
3636
*/
@@ -52,4 +52,4 @@ declare const _default: React.ForwardRefExoticComponent<Omit<TextFieldProps, "re
5252
*/
5353
maxChips?: number | undefined;
5454
} & React.RefAttributes<any>>;
55-
export default _default;
55+
export default ChipsInput;

lib/components/Keyboard/KeyboardTracking/KeyboardTrackingView/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ export type KeyboardTrackingViewProps = ViewProps & {
3737
style?: ViewStyle;
3838
}
3939

40-
const KeyboardTrackingView = ({children, ...others}: KeyboardTrackingViewProps, ref: any) => {
40+
const KeyboardTrackingView = forwardRef(({children, ...others}: KeyboardTrackingViewProps, ref: any) => {
4141
const KeyboardTrackingViewContainer = isAndroid ? KeyboardTrackingViewAndroid : KeyboardTrackingViewIOS;
4242

4343
return (
4444
<KeyboardTrackingViewContainer {...others} ref={ref}>
4545
{children}
4646
</KeyboardTrackingViewContainer>
4747
);
48-
};
48+
});
4949

50-
export default forwardRef(KeyboardTrackingView);
50+
export default KeyboardTrackingView;

src/incubator/ChipsInput/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export type ChipsInputProps = Omit<TextFieldProps, 'ref'> & {
3838
maxChips?: number;
3939
};
4040

41-
const ChipsInput = (props: ChipsInputProps, refToForward: React.Ref<any>) => {
41+
const ChipsInput = forwardRef((props: ChipsInputProps, refToForward: React.Ref<any>) => {
4242
const fieldRef = useCombinedRefs(refToForward);
4343
const {
4444
chips = [],
@@ -150,17 +150,17 @@ const ChipsInput = (props: ChipsInputProps, refToForward: React.Ref<any>) => {
150150
accessibilityHint={props.editable ? 'press keyboard delete button to remove last tag' : undefined}
151151
/>
152152
);
153-
};
153+
});
154154

155155
const styles = StyleSheet.create({
156156
fieldStyle: {
157157
flexWrap: 'wrap'
158158
}
159159
});
160-
160+
// @ts-expect-error
161161
ChipsInput.changeReasons = {
162162
ADDED: 'added',
163163
REMOVED: 'removed'
164164
};
165165

166-
export default forwardRef(ChipsInput);
166+
export default ChipsInput;

0 commit comments

Comments
 (0)