Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김서영
/
searchGuide
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
bluejoyq
2019-11-15 04:16:08 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e672d16965ff8f51c483767435117c8bc5cb0962
e672d169
1 parent
6781ca9c
drop voice recognition
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
123 additions
and
11 deletions
searchGuide/.expo/packager-info.json
searchGuide/components/Rate/Rate.js
searchGuide/components/SearchBar/SearchBar.js
searchGuide/components/VoiceTest/VoiceTest.js
searchGuide/package-lock.json
searchGuide/package.json
searchGuide/.expo/packager-info.json
View file @
e672d16
{
"devToolsPort"
:
19002
,
"expoServerPort"
:
19000
,
"packagerPort"
:
null
,
"packagerPid"
:
null
,
"packagerPort"
:
19001
,
"packagerPid"
:
4420
,
"expoServerNgrokUrl"
:
"https://ep-ukj.anonymous.searchguide.exp.direct"
,
"packagerNgrokUrl"
:
"https://packager.ep-ukj.anonymous.searchguide.exp.direct"
,
"ngrokPid"
:
2
8468
"ngrokPid"
:
2
6692
}
...
...
searchGuide/components/Rate/Rate.js
View file @
e672d16
...
...
@@ -17,8 +17,8 @@ class Rate extends React.Component {
render
()
{
return
(
<
View
>
<
Text
>
평가
<
/Text
>
<
View
>
<
Text
>
평가
<
/Text
>
<
/View
>
)
}
...
...
searchGuide/components/SearchBar/SearchBar.js
View file @
e672d16
import
React
from
'react'
;
import
{
View
}
from
'react-native'
;
import
{
View
,
ScrollView
}
from
'react-native'
;
import
{
Searchbar
}
from
'react-native-paper'
;
import
Icon
from
'react-native-vector-icons/FontAwesome'
;
...
...
@@ -10,16 +10,15 @@ export default class SearchBar extends React.Component {
render
(){
return
(
<
View
style
=
{{
flexDirection
:
'row'
}}
>
<
Searchbar
style
=
{{
flex
:
0.9
}}
<>
<
View
style
=
{{
margin
:
0
,
padding
:
0
}}
>
<
Searchbar
placeholder
=
"검색할 질문을 입력하세요."
onChangeText
=
{
query
=>
{
this
.
setState
({
firstQuery
:
query
});
}}
value
=
{
this
.
state
.
firstQuery
}
/
>
<
View
style
=
{{
flex
:
0.15
,
flexDirection
:
'column'
,
justifycontent
:
'center'
,
alignItems
:
'center'
}}
>
<
Icon
name
=
"bar-chart-o"
size
=
{
30
}
/
>
<
/View
>
<
/View
>
<
/
>
)
}
}
\ No newline at end of file
...
...
searchGuide/components/VoiceTest/VoiceTest.js
0 → 100644
View file @
e672d16
import
React
,
{
Component
}
from
'react'
;
import
{
StyleSheet
,
Text
,
View
,
Image
,
TouchableHighlight
}
from
'react-native'
;
import
Voice
from
'react-native-voice'
;
import
*
as
Permissions
from
"expo-permissions"
;
/*
순수 react native 프로젝트로 변경후 업뎃 필요!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
class
VoiceTest
extends
Component
{
constructor
(
props
)
{
super
(
props
)
Voice
.
onSpeechStart
=
this
.
onSpeechStartHandler
;
Voice
.
onSpeechEnd
=
this
.
onSpeechEndHandler
;
Voice
.
onSpeechResults
=
this
.
onSpeechResultsHandler
;
this
.
state
=
{
showRecordButton
:
false
,
result
:
[]
}
}
async
componentDidMount
()
{
const
{
status
,
expires
,
permissions
}
=
await
Permissions
.
askAsync
(
Permissions
.
AUDIO_RECORDING
);
if
(
status
!==
"granted"
)
{
//Permissions not granted. Don't show the start recording button because it will cause problems if it's pressed.
this
.
setState
({
showRecordButton
:
false
});
}
else
{
this
.
setState
({
showRecordButton
:
true
});
}
}
componentWillUnmount
()
{
Voice
.
destroy
().
then
(
Voice
.
removeAllListeners
);
}
onSpeechStartHandler
=
e
=>
{
console
.
log
(
'onSpeechStart: '
,
e
);
};
onSpeechEndHandler
=
e
=>
{
console
.
log
(
'onSpeechEnd: '
,
e
);
};
onSpeechResultsHandler
=
e
=>
{
console
.
log
(
'onSpeechResults: '
,
e
);
this
.
setState
({
results
:
e
.
value
,
});
}
_startRecognizing
=
async
()
=>
{
try
{
await
Voice
.
start
(
'ko-KR'
,
{
"RECOGNIZER_ENGINE"
:
"GOOGLE"
,
"EXTRA_PARTIAL_RESULTS"
:
true
});
}
catch
(
e
)
{
//eslint-disable-next-line
console
.
error
(
e
);
}
};
_stopRecognizing
=
async
()
=>
{
try
{
await
Voice
.
stop
();
}
catch
(
e
)
{
//eslint-disable-next-line
console
.
error
(
e
);
}
};
_cancelRecognizing
=
async
()
=>
{
try
{
await
Voice
.
cancel
();
}
catch
(
e
)
{
//eslint-disable-next-line
console
.
error
(
e
);
}
};
_destroyRecognizer
=
async
()
=>
{
try
{
await
Voice
.
destroy
();
}
catch
(
e
)
{
//eslint-disable-next-line
console
.
error
(
e
);
}
};
render
(){
return
(
<
View
>
<
TouchableHighlight
onPress
=
{
this
.
_startRecognizing
}
>
<
Text
>
Start
Recognizing
<
/Text
>
<
/TouchableHighlight
>
<
TouchableHighlight
onPress
=
{
this
.
_stopRecognizing
}
>
<
Text
>
Stop
Recognizing
<
/Text
>
<
/TouchableHighlight
>
<
TouchableHighlight
onPress
=
{
this
.
_cancelRecognizing
}
>
<
Text
>
Cancel
<
/Text
>
<
/TouchableHighlight
>
<
TouchableHighlight
onPress
=
{
this
.
_destroyRecognizer
}
>
<
Text
>
Destroy
<
/Text
>
<
/TouchableHighlight
>
<
/View
>
)
}
}
export
default
VoiceTest
;
\ No newline at end of file
searchGuide/package-lock.json
View file @
e672d16
...
...
@@ -2594,6 +2594,11 @@
"resolved"
:
"https://registry.npmjs.org/expo-permissions/-/expo-permissions-7.0.0.tgz"
,
"integrity"
:
"sha512-C+qyVz+pdZO4YpVR2HSC3gsBZg0Qb8brCFgzmDmWcAtgrOiHClaLPdhI2XtQuGh8ubXcKPUGZp++UCEGiG0Jxg=="
},
"expo-speech"
:
{
"version"
:
"7.0.0"
,
"resolved"
:
"https://registry.npmjs.org/expo-speech/-/expo-speech-7.0.0.tgz"
,
"integrity"
:
"sha512-746OmuP0os0z8750s0hwALIVQS7wGDFMwC4+C1eFLEZrN65i2695CTh6MyRTaOwTN87AVVak6j585sQ680MqyQ=="
},
"expo-sqlite"
:
{
"version"
:
"7.0.0"
,
"resolved"
:
"https://registry.npmjs.org/expo-sqlite/-/expo-sqlite-7.0.0.tgz"
,
...
...
searchGuide/package.json
View file @
e672d16
...
...
@@ -10,6 +10,8 @@
"dependencies"
:
{
"1.3.0"
:
"^1.3.0"
,
"expo"
:
"^35.0.0"
,
"expo-permissions"
:
"~7.0.0"
,
"expo-speech"
:
"~7.0.0"
,
"react"
:
"16.8.3"
,
"react-dom"
:
"16.8.3"
,
"react-native"
:
"https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz"
,
...
...
Please
register
or
login
to post a comment