Skip to content

Commit 3b39627

Browse files
authored
Add webShowOutline prop to text input (#847)
1 parent a8036dc commit 3b39627

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

packages/core/src/components/TextInput.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,28 @@ import React from "react";
22
import {
33
TextInput as NativeTextInput,
44
TextInputProps as NativeTextInputProps,
5+
Platform,
56
} from "react-native";
67
import { useDebounce, useOnUpdate } from "../hooks";
78

89
export interface TextInputProps extends NativeTextInputProps {
10+
webShowOutline?: boolean;
911
onChangeTextDelayed?: (text: string) => void;
1012
changeTextDelay?: number;
1113
}
1214

1315
const TextInput = React.forwardRef<NativeTextInput, TextInputProps>(
14-
({ onChangeTextDelayed, changeTextDelay = 500, value, ...rest }, ref) => {
16+
(
17+
{
18+
onChangeTextDelayed,
19+
changeTextDelay = 500,
20+
webShowOutline = true,
21+
style,
22+
value,
23+
...rest
24+
},
25+
ref
26+
) => {
1527
const delayedValue = useDebounce(value, changeTextDelay);
1628

1729
useOnUpdate(() => {
@@ -25,6 +37,11 @@ const TextInput = React.forwardRef<NativeTextInput, TextInputProps>(
2537
testID="native-text-input"
2638
ref={ref}
2739
value={value}
40+
style={[
41+
//@ts-ignore Web specific prop. Removes default blue outline that appears on the hidden TextInput
42+
Platform.OS === "web" && !webShowOutline ? { outlineWidth: 0 } : {},
43+
style,
44+
]}
2845
{...rest}
2946
/>
3047
);

0 commit comments

Comments
 (0)