bluejoyq

drop voice recognition

1 { 1 {
2 "devToolsPort": 19002, 2 "devToolsPort": 19002,
3 "expoServerPort": 19000, 3 "expoServerPort": 19000,
4 - "packagerPort": null, 4 + "packagerPort": 19001,
5 - "packagerPid": null, 5 + "packagerPid": 4420,
6 "expoServerNgrokUrl": "https://ep-ukj.anonymous.searchguide.exp.direct", 6 "expoServerNgrokUrl": "https://ep-ukj.anonymous.searchguide.exp.direct",
7 "packagerNgrokUrl": "https://packager.ep-ukj.anonymous.searchguide.exp.direct", 7 "packagerNgrokUrl": "https://packager.ep-ukj.anonymous.searchguide.exp.direct",
8 - "ngrokPid": 28468 8 + "ngrokPid": 26692
9 } 9 }
......
...@@ -17,8 +17,8 @@ class Rate extends React.Component { ...@@ -17,8 +17,8 @@ class Rate extends React.Component {
17 17
18 render() { 18 render() {
19 return( 19 return(
20 - <View> 20 + <View >
21 - <Text>평가</Text> 21 + <Text >평가</Text>
22 </View> 22 </View>
23 ) 23 )
24 } 24 }
......
1 import React from 'react'; 1 import React from 'react';
2 -import {View} from 'react-native'; 2 +import {View,ScrollView} from 'react-native';
3 import { Searchbar } from 'react-native-paper'; 3 import { Searchbar } from 'react-native-paper';
4 import Icon from 'react-native-vector-icons/FontAwesome'; 4 import Icon from 'react-native-vector-icons/FontAwesome';
5 5
...@@ -10,16 +10,15 @@ export default class SearchBar extends React.Component { ...@@ -10,16 +10,15 @@ export default class SearchBar extends React.Component {
10 10
11 render(){ 11 render(){
12 return( 12 return(
13 - <View style={{flexDirection: 'row'}}> 13 + <>
14 - <Searchbar style={{flex: 0.9}} 14 + <View style={{margin:0,padding:0}}>
15 + <Searchbar
15 placeholder="검색할 질문을 입력하세요." 16 placeholder="검색할 질문을 입력하세요."
16 onChangeText={query => { this.setState({ firstQuery: query }); }} 17 onChangeText={query => { this.setState({ firstQuery: query }); }}
17 value={this.state.firstQuery} 18 value={this.state.firstQuery}
18 /> 19 />
19 - <View style={{flex:0.15,flexDirection: 'column', justifycontent:'center', alignItems:'center' }} >
20 - <Icon name="bar-chart-o" size={30} />
21 - </View>
22 </View> 20 </View>
21 + </>
23 ) 22 )
24 } 23 }
25 } 24 }
...\ No newline at end of file ...\ No newline at end of file
......
1 +import React, { Component } from 'react';
2 +import { StyleSheet, Text, View, Image, TouchableHighlight } from 'react-native';
3 +import Voice from 'react-native-voice';
4 +import * as Permissions from "expo-permissions";
5 +
6 +/*
7 +순수 react native 프로젝트로 변경후 업뎃 필요!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
8 +*/
9 +class VoiceTest extends Component {
10 + constructor(props) {
11 + super(props)
12 + Voice.onSpeechStart = this.onSpeechStartHandler;
13 + Voice.onSpeechEnd = this.onSpeechEndHandler;
14 + Voice.onSpeechResults = this.onSpeechResultsHandler;
15 + this.state = {
16 + showRecordButton: false,
17 + result: []
18 + }
19 + }
20 +
21 + async componentDidMount() {
22 + const { status, expires, permissions } = await Permissions.askAsync(
23 + Permissions.AUDIO_RECORDING
24 + );
25 + if (status !== "granted") {
26 + //Permissions not granted. Don't show the start recording button because it will cause problems if it's pressed.
27 + this.setState({showRecordButton: false});
28 + } else {
29 + this.setState({showRecordButton: true});
30 + }
31 + }
32 + componentWillUnmount() {
33 + Voice.destroy().then(Voice.removeAllListeners);
34 + }
35 + onSpeechStartHandler = e => {
36 + console.log('onSpeechStart: ', e);
37 + };
38 + onSpeechEndHandler = e => {
39 + console.log('onSpeechEnd: ', e);
40 + };
41 + onSpeechResultsHandler = e => {
42 + console.log('onSpeechResults: ', e);
43 + this.setState({
44 + results: e.value,
45 + });
46 + }
47 +
48 + _startRecognizing = async () => {
49 + try {
50 + await Voice.start('ko-KR', {
51 + "RECOGNIZER_ENGINE": "GOOGLE",
52 + "EXTRA_PARTIAL_RESULTS": true
53 + });
54 + } catch (e) {
55 + //eslint-disable-next-line
56 + console.error(e);
57 + }
58 + };
59 +
60 + _stopRecognizing = async () => {
61 + try {
62 + await Voice.stop();
63 + } catch (e) {
64 + //eslint-disable-next-line
65 + console.error(e);
66 + }
67 + };
68 +
69 + _cancelRecognizing = async () => {
70 + try {
71 + await Voice.cancel();
72 + } catch (e) {
73 + //eslint-disable-next-line
74 + console.error(e);
75 + }
76 + };
77 +
78 + _destroyRecognizer = async () => {
79 + try {
80 + await Voice.destroy();
81 + } catch (e) {
82 + //eslint-disable-next-line
83 + console.error(e);
84 + }
85 + };
86 + render(){
87 + return(
88 + <View>
89 + <TouchableHighlight onPress={this._startRecognizing}>
90 + <Text>Start Recognizing</Text>
91 + </TouchableHighlight>
92 + <TouchableHighlight onPress={this._stopRecognizing}>
93 + <Text>Stop Recognizing</Text>
94 + </TouchableHighlight>
95 + <TouchableHighlight onPress={this._cancelRecognizing}>
96 + <Text>Cancel</Text>
97 + </TouchableHighlight>
98 + <TouchableHighlight onPress={this._destroyRecognizer}>
99 + <Text>Destroy</Text>
100 + </TouchableHighlight>
101 + </View>
102 + )
103 + }
104 +}
105 +
106 +export default VoiceTest;
...\ No newline at end of file ...\ No newline at end of file
...@@ -2594,6 +2594,11 @@ ...@@ -2594,6 +2594,11 @@
2594 "resolved": "https://registry.npmjs.org/expo-permissions/-/expo-permissions-7.0.0.tgz", 2594 "resolved": "https://registry.npmjs.org/expo-permissions/-/expo-permissions-7.0.0.tgz",
2595 "integrity": "sha512-C+qyVz+pdZO4YpVR2HSC3gsBZg0Qb8brCFgzmDmWcAtgrOiHClaLPdhI2XtQuGh8ubXcKPUGZp++UCEGiG0Jxg==" 2595 "integrity": "sha512-C+qyVz+pdZO4YpVR2HSC3gsBZg0Qb8brCFgzmDmWcAtgrOiHClaLPdhI2XtQuGh8ubXcKPUGZp++UCEGiG0Jxg=="
2596 }, 2596 },
2597 + "expo-speech": {
2598 + "version": "7.0.0",
2599 + "resolved": "https://registry.npmjs.org/expo-speech/-/expo-speech-7.0.0.tgz",
2600 + "integrity": "sha512-746OmuP0os0z8750s0hwALIVQS7wGDFMwC4+C1eFLEZrN65i2695CTh6MyRTaOwTN87AVVak6j585sQ680MqyQ=="
2601 + },
2597 "expo-sqlite": { 2602 "expo-sqlite": {
2598 "version": "7.0.0", 2603 "version": "7.0.0",
2599 "resolved": "https://registry.npmjs.org/expo-sqlite/-/expo-sqlite-7.0.0.tgz", 2604 "resolved": "https://registry.npmjs.org/expo-sqlite/-/expo-sqlite-7.0.0.tgz",
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
10 "dependencies": { 10 "dependencies": {
11 "1.3.0": "^1.3.0", 11 "1.3.0": "^1.3.0",
12 "expo": "^35.0.0", 12 "expo": "^35.0.0",
13 + "expo-permissions": "~7.0.0",
14 + "expo-speech": "~7.0.0",
13 "react": "16.8.3", 15 "react": "16.8.3",
14 "react-dom": "16.8.3", 16 "react-dom": "16.8.3",
15 "react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz", 17 "react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz",
......