-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathStickyNote.js
81 lines (77 loc) · 2.27 KB
/
StickyNote.js
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
76
77
78
79
80
81
import React, { Component } from 'react';
import moment from 'moment';
import { Text, TextInput, View, StyleSheet } from 'react-native';
import { Card, Button } from 'react-native-elements';
import DateTimePicker from 'react-native-modal-datetime-picker';
export default class StickyNote extends Component {
state = {
isDateTimePickerVisible: false,
limitDateTime: moment().format('YYYY年MM月DD日 HH時mm分')
};
showDateTimePicker = () => this.setState({ isDateTimePickerVisible: true });
hideDateTimePicker = () => this.setState({ isDateTimePickerVisible: false });
setDateTime = dateTime =>
this.setState({
limitDateTime: moment(dateTime).format('YYYY年MM月DD日 HH時mm分'),
});
render() {
return (
<Card
containerStyle={styles.card}
title={
<View>
<TextInput
placeholder="タイトルを入力"
placeholderTextColor="#7c7c7c"
underlineColorAndroid={'rgba(0,0,0,0)'}
/>
</View>
}>
<Button
title="×"
buttonStyle={styles.deleteButton}
onPress={() => this.props.deleteStickyNote(this.props.uuid)}
/>
<TextInput
placeholder="内容を入力"
placeholderTextColor="#7c7c7c"
multiline
underlineColorAndroid={'rgba(0,0,0,0)'}
/>
<View style={styles.datetimeContainer}>
<Text>期限:</Text>
<Text onPress={this.showDateTimePicker}>
{this.state.limitDateTime}
</Text>
</View>
<DateTimePicker
isVisible={this.state.isDateTimePickerVisible}
mode={'datetime'}
onConfirm={dateTime => {
this.setDateTime(dateTime);
this.hideDateTimePicker();
}}
onCancel={this.hideDateTimePicker}
/>
</Card>
);
}
}
const styles = StyleSheet.create({
card: {
backgroundColor: '#f5f99a',
},
deleteButton: {
backgroundColor: '#EFD032',
position: 'absolute',
bottom: 0,
right: 0,
height: 30,
width: 30,
borderRadius: 30
},
datetimeContainer: {
marginTop: 10,
flexDirection: 'row',
},
});