forked from bamlab/react-native-testing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDisabledButton.tsx
More file actions
26 lines (22 loc) · 843 Bytes
/
DisabledButton.tsx
File metadata and controls
26 lines (22 loc) · 843 Bytes
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
import React, { useState } from 'react';
import { View, Text } from 'react-native';
import { Button } from '../../components/Button';
import { Input } from '../../components/StyledComponents';
import styled from '../../utils/styled-components';
export const DisabledButton = () => {
const [password, setPassword] = useState('');
const [isPasswordConfirmed, setIsPasswordConfirmed] = useState(false);
const onConfirm = () => setIsPasswordConfirmed(true);
return (
<Container>
<Input value={password} onChangeText={setPassword} placeholder="password" />
<Button disabled={password === ''} title="Confirm" onPress={onConfirm} />
{isPasswordConfirmed && <Text>Password confirmed</Text>}
</Container>
);
};
const Container = styled(View)`
justify-content: space-around;
flex-grow: 1;
padding: 16px;
`;