Skip to content

Commit 31d6695

Browse files
Fix warning (#3831)
* Fix warning * fix: Update Hint component snapshots by removing unused props * ts ignore --------- Co-authored-by: adids1221 <adids1221@gmail.com>
1 parent 77681ec commit 31d6695

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

src/components/hint/__tests__/__snapshots__/index.spec.tsx.snap

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ exports[`Hint Screen component test Different positions and scenarios center pos
5656
"typography": undefined,
5757
}
5858
}
59-
position="bottom"
6059
style={
6160
[
6261
undefined,
@@ -91,7 +90,6 @@ exports[`Hint Screen component test Different positions and scenarios center pos
9190
"y": 200,
9291
}
9392
}
94-
useModal={true}
9593
useSideTip={true}
9694
visible={true}
9795
>
@@ -336,7 +334,6 @@ exports[`Hint Screen component test Different positions and scenarios center pos
336334
"typography": undefined,
337335
}
338336
}
339-
position="bottom"
340337
style={
341338
[
342339
undefined,
@@ -371,7 +368,6 @@ exports[`Hint Screen component test Different positions and scenarios center pos
371368
"y": 200,
372369
}
373370
}
374-
useModal={true}
375371
visible={true}
376372
>
377373
<View
@@ -615,7 +611,6 @@ exports[`Hint Screen component test Different positions and scenarios left posit
615611
"typography": undefined,
616612
}
617613
}
618-
position="bottom"
619614
style={
620615
[
621616
undefined,
@@ -650,7 +645,6 @@ exports[`Hint Screen component test Different positions and scenarios left posit
650645
"y": 370,
651646
}
652647
}
653-
useModal={true}
654648
useSideTip={true}
655649
visible={true}
656650
>
@@ -895,7 +889,6 @@ exports[`Hint Screen component test Different positions and scenarios left posit
895889
"typography": undefined,
896890
}
897891
}
898-
position="bottom"
899892
style={
900893
[
901894
undefined,
@@ -930,7 +923,6 @@ exports[`Hint Screen component test Different positions and scenarios left posit
930923
"y": 370,
931924
}
932925
}
933-
useModal={true}
934926
visible={true}
935927
>
936928
<View
@@ -1174,7 +1166,6 @@ exports[`Hint Screen component test Different positions and scenarios right posi
11741166
"typography": undefined,
11751167
}
11761168
}
1177-
position="bottom"
11781169
style={
11791170
[
11801171
undefined,
@@ -1209,7 +1200,6 @@ exports[`Hint Screen component test Different positions and scenarios right posi
12091200
"y": 150,
12101201
}
12111202
}
1212-
useModal={true}
12131203
useSideTip={true}
12141204
visible={true}
12151205
>
@@ -1454,7 +1444,6 @@ exports[`Hint Screen component test Different positions and scenarios right posi
14541444
"typography": undefined,
14551445
}
14561446
}
1457-
position="bottom"
14581447
style={
14591448
[
14601449
undefined,
@@ -1489,7 +1478,6 @@ exports[`Hint Screen component test Different positions and scenarios right posi
14891478
"y": 150,
14901479
}
14911480
}
1492-
useModal={true}
14931481
visible={true}
14941482
>
14951483
<View

src/components/hint/index.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ const HINT_MIN_WIDTH = 68;
2525
const Hint = (props: HintProps) => {
2626
const {
2727
visible,
28-
useModal,
29-
position,
28+
useModal = true,
29+
position = HintPositions.BOTTOM,
3030
children,
3131
message,
3232
containerWidth = Constants.windowWidth,
@@ -60,6 +60,7 @@ const Hint = (props: HintProps) => {
6060
if (targetRef.current && hintRef.current) {
6161
focusAccessibilityOnHint(targetRef.current, hintRef.current);
6262
}
63+
// eslint-disable-next-line react-hooks/exhaustive-deps
6364
}, []);
6465

6566
const targetLayout = useMemo(() => {
@@ -71,6 +72,7 @@ const Hint = (props: HintProps) => {
7172
if (hintRef.current) {
7273
focusAccessibilityOnHint(targetRef.current, hintRef.current);
7374
}
75+
// eslint-disable-next-line react-hooks/exhaustive-deps
7476
}, []);
7577

7678
const showHint = !!targetLayout;
@@ -299,10 +301,6 @@ const styles = StyleSheet.create({
299301
});
300302

301303
Hint.displayName = 'Hint';
302-
Hint.defaultProps = {
303-
position: HintPositions.BOTTOM,
304-
useModal: true
305-
};
306304
Hint.positions = HintPositions;
307305

308306
export {HintProps, Hint};

0 commit comments

Comments
 (0)