SearchBar.js
1.15 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
import React from 'react';
import {View,Alert} from 'react-native';
import { Searchbar } from 'react-native-paper';
export default class SearchBar extends React.Component {
constructor(props){
super(props);
this.state = {
query: '',
};
}
queryChange=(query)=>{
this.setState({ query: query });
}
submit=()=>{
this.props.toggleLoading;
setInterval(()=>{this.props.toggleLoading},5);
this.setState({query:''});
}
voiceRecognition=()=>{
Alert.alert(
'음성 인식',
'아직 구현 못함',
[
{text: '확인', onPress: () => {}},
],
)
}
render(){
return(
<>
<View>
<Searchbar
placeholder="검색할 질문을 입력하세요."
onChangeText={this.queryChange}
value={this.state.query}
icon='microphone'
onIconPress={this.voiceRecognition}
onSubmitEditing={this.submit}
/>
</View>
</>
)
}
}