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-20 14:12:36 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fd424b74e06c3bd621147f099a5ac8436abd7c4b
fd424b74
1 parent
bbb0323b
add search result map
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
14 deletions
searchGuide/.expo/packager-info.json
searchGuide/components/Home/Home.js
searchGuide/components/SearchCard/SearchCard.js
searchGuide/reducers/search.js
searchGuide/.expo/packager-info.json
View file @
fd424b7
...
...
@@ -2,8 +2,8 @@
"devToolsPort"
:
19002
,
"expoServerPort"
:
19000
,
"packagerPort"
:
19001
,
"packagerPid"
:
2488
4
,
"packagerPid"
:
1202
4
,
"expoServerNgrokUrl"
:
"https://s4-47j.anonymous.searchguide.exp.direct"
,
"packagerNgrokUrl"
:
"https://packager.s4-47j.anonymous.searchguide.exp.direct"
,
"ngrokPid"
:
2
5980
"ngrokPid"
:
2
2188
}
...
...
searchGuide/components/Home/Home.js
View file @
fd424b7
import
React
from
'react'
;
import
{
View
}
from
'react-native'
;
import
{
connect
}
from
'react-redux'
import
Icon
from
'react-native-vector-icons/FontAwesome'
;
import
SearchBar
Container
from
'../SearchBar/SearchBar'
;
import
SearchBar
from
'../SearchBar/SearchBar'
;
import
SearchCard
from
'../SearchCard/SearchCard'
;
const
Home
=
()
=>
{
const
Home
=
(
{
searchResults
}
)
=>
{
return
(
<
View
style
=
{{
flex
:
1
,
backgroundColor
:
'#eee'
,
margin
:
0
,
padding
:
0
}}
>
<
SearchBarContainer
/>
<
SearchCard
title
=
{
'네이버- 지식인...인간사냥꾼 니달리를ㄴㄴㅁ'
}
content
=
{
'문도 가고 싶은 데로 간다!'
}
url
=
{
'https://www.naver.com'
}
/
>
<
SearchBar
/>
{
searchResults
&&
searchResults
.
map
((
searchResult
,
index
)
=>
(
<
SearchCard
key
=
{
index
}
title
=
{
searchResult
.
title
}
content
=
{
searchResult
.
passage
}
url
=
{
searchResult
.
url
}
/
>
))}
<
/View
>
)
}
Home
.
navigationOptions
=
{
const
HomeContainer
=
({
searchResults
})
=>
{
return
(
<
Home
searchResults
=
{
searchResults
}
/>
)
}
HomeContainer
.
navigationOptions
=
{
title
:
'검색'
,
tabBarIcon
:
({
tintColor
})
=>
(
<
Icon
name
=
"search"
color
=
{
tintColor
}
style
=
{{
marginLeft
:
2
}}
size
=
{
20
}
/>
)
,
}
export
default
Home
;
\ No newline at end of file
export
default
connect
(
({
search
})
=>
({
searchResults
:
search
.
result
.
return_data
.
searchResults
})
)(
HomeContainer
);
\ No newline at end of file
...
...
searchGuide/components/SearchCard/SearchCard.js
View file @
fd424b7
...
...
@@ -6,9 +6,7 @@ import {Linking } from 'react-native';
const
SearchCard
=
(
props
)
=>
(
<
Card
style
=
{{
margin
:
10
}}
>
<
Card
.
Title
title
=
{
props
.
title
}
left
=
{
(
props
)
=>
(
<
Avatar
.
Icon
{...
props
}
icon
=
"folder"
color
=
{
WHITE_MAIN
}
style
=
{{
backgroundColor
:
LIGHT_MAIN
}}
/>
)
}
/>
left
=
{
(
props
)
=>
(
<
Avatar
.
Icon
{...
props
}
icon
=
"folder"
color
=
{
WHITE_MAIN
}
style
=
{{
backgroundColor
:
LIGHT_MAIN
}}
/>
)
} /
>
<
Card
.
Content
>
<
Paragraph
>
{
props
.
content
}
<
/Paragraph
>
<
/Card.Content
>
...
...
searchGuide/reducers/search.js
View file @
fd424b7
...
...
@@ -16,7 +16,8 @@ export const submit = (text) => async (dispatch) => {
try
{
/*const response = await sendSearch(text);*/
const
response
=
await
readTest
();
// 테스트용입니당~
setTimeout
(()
=>
dispatch
(
{
type
:
SUCCESS
,
result
:
response
}),
1000
);
// 셋타임아웃도 테스트용
dispatch
(
{
type
:
SUCCESS
,
result
:
response
})
//setTimeout(()=>,1000); // 셋타임아웃도 테스트용
}
catch
(
err
){
dispatch
({
type
:
FAILURE
,
result
:
response
})
...
...
@@ -26,7 +27,11 @@ export const submit = (text) => async (dispatch) => {
const
initialState
=
{
query
:
''
,
searchResult
:{},
result
:
{
return_data
:
{
searchResults
:
[]
}
},
isLoading
:
false
,
};
...
...
@@ -35,7 +40,7 @@ export default ToggleLoading = (state = initialState, action) => {
case
CHANGE
:
return
{...
state
,
query
:
action
.
text
};
case
SUCCESS
:
return
{...
state
,
isLoading
:
false
,
searchResult
:
action
.
response
};
return
{...
state
,
isLoading
:
false
,
result
:
action
.
result
};
case
FAILURE
:
return
{...
state
,
isLoading
:
false
};
case
START
:
...
...
Please
register
or
login
to post a comment