-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.tsx
More file actions
75 lines (69 loc) · 2.06 KB
/
Copy pathindex.tsx
File metadata and controls
75 lines (69 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import * as React from 'react';
import {Text, Input, Button, InputRef, useTheme, Gap} from '@fast-base/native';
const InputExample: React.FC = () => {
const {colors} = useTheme();
const ref = React.useRef<InputRef>(null);
const Left = React.useCallback(
() => (
<Text color={colors?.secondText} size={13}>
www.
</Text>
),
[colors?.secondText],
);
const Right = React.useCallback(
() => (
<Text color={colors?.secondText} size={13}>
.com
</Text>
),
[colors?.secondText],
);
return (
<React.Fragment>
<Gap space={10}>
<Input.Underline
ref={ref}
animatable
label="Label"
placeholder="Write inline..."
focusedBorderColor="purple-400"
/>
<Input.Outline
// invalid
label="Username"
placeholder="Write inline..."
invalidLabel="Username pattern is invalid"
hintLabel="Username should be only characters"
/>
<Input.Outline
radius="lg"
leftElement={Left}
rightElement={Right}
placeholder="Enter website"
/>
<Input.Outline radius="full" passowrd placeholder="Password" />
<Input.Outline size="lg" multiline placeholder="Enter multiline..." />
<Button pressable size="sm" onPress={() => ref.current?.shake()}>
Shake!
</Button>
<Button pressable size="sm" onPress={() => ref.current?.bounce()}>
Bounce!
</Button>
<Button pressable size="sm" onPress={() => ref.current?.focus()}>
Focus!
</Button>
<Button pressable size="sm" onPress={() => ref.current?.blur()}>
Blur!
</Button>
<Button pressable size="sm" onPress={() => ref.current?.clear()}>
Clear!
</Button>
<Text color={colors?.secondText} ax="justify" size={13}>
The above action buttons were been referenced to the first text input.{' '}
</Text>
</Gap>
</React.Fragment>
);
};
export default InputExample;