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 00:09:07 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
870d17c407b18234a339eaff6f44862be6aadb64
870d17c4
1 parent
839e6790
change name of ToggleLoading to loading
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
79 additions
and
53 deletions
searchGuide/components/Home/Home.js
searchGuide/components/Main/Main.js
searchGuide/components/Rate/Rate.js
searchGuide/components/SearchBar/SearchBar.js
searchGuide/reducers/Store.js
searchGuide/reducers/ToggleLoading.js → searchGuide/reducers/loading.js
searchGuide/reducers/search.js
searchGuide/components/Home/Home.js
View file @
870d17c
...
...
@@ -5,27 +5,19 @@ import SearchBarContainer from '../SearchBar/SearchBar';
import
SearchCard
from
'../SearchCard/SearchCard'
;
class
Home
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
}
}
static
navigationOptions
=
{
title
:
'검색'
,
tabBarIcon
:
({
tintColor
})
=>
(
<
Icon
name
=
"search"
color
=
{
tintColor
}
style
=
{{
marginLeft
:
2
}}
size
=
{
20
}
/>
)
,
}
render
()
{
return
(
<
View
style
=
{{
flex
:
1
,
backgroundColor
:
'#eee'
,
margin
:
0
,
padding
:
0
}}
>
<
SearchBarContainer
/>
<
SearchCard
title
=
{
'네이버- 지식인...인간사냥꾼 니달리를ㄴㄴㅁ'
}
content
=
{
'문도 가고 싶은 데로 간다!'
}
url
=
{
'https://www.naver.com'
}
/
>
<
/View
>
)
}
const
Home
=
()
=>
{
return
(
<
View
style
=
{{
flex
:
1
,
backgroundColor
:
'#eee'
,
margin
:
0
,
padding
:
0
}}
>
<
SearchBarContainer
/>
<
SearchCard
title
=
{
'네이버- 지식인...인간사냥꾼 니달리를ㄴㄴㅁ'
}
content
=
{
'문도 가고 싶은 데로 간다!'
}
url
=
{
'https://www.naver.com'
}
/
>
<
/View
>
)
}
Home
.
navigationOptions
=
{
title
:
'검색'
,
tabBarIcon
:
({
tintColor
})
=>
(
<
Icon
name
=
"search"
color
=
{
tintColor
}
style
=
{{
marginLeft
:
2
}}
size
=
{
20
}
/>
)
,
}
export
default
Home
;
\ No newline at end of file
...
...
searchGuide/components/Main/Main.js
View file @
870d17c
...
...
@@ -3,7 +3,7 @@ import AppTabContainer from '../AppTabContainer/AppTabContainer';
import
Loading
from
'../Loading/Loading'
;
import
{
connect
}
from
'react-redux'
;
const
Main
=
({
isLoading
,
toggleLoading
})
=>
{
const
Main
=
({
isLoading
})
=>
{
if
(
isLoading
)
{
return
(
<>
...
...
@@ -24,6 +24,6 @@ const MainContainer = ({isLoading}) => {
return
(
<
Main
isLoading
=
{
isLoading
}
/>
)
}
const
mapStateToProps
=
(
state
)
=>
({
isLoading
:
state
.
ToggleL
oading
.
isLoading
})
const
mapStateToProps
=
(
state
)
=>
({
isLoading
:
state
.
l
oading
.
isLoading
})
export
default
connect
(
mapStateToProps
)(
MainContainer
);
\ No newline at end of file
...
...
searchGuide/components/Rate/Rate.js
View file @
870d17c
...
...
@@ -2,27 +2,17 @@ import React from 'react';
import
{
View
,
Text
}
from
'react-native'
;
import
Icon
from
'react-native-vector-icons/FontAwesome'
;
class
Rate
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
}
}
static
navigationOptions
=
{
title
:
'평가'
,
tabBarIcon
:
({
tintColor
})
=>
(
<
Icon
name
=
"bar-chart-o"
color
=
{
tintColor
}
style
=
{{
marginLeft
:
0.5
}}
size
=
{
20
}
/>
)
,
}
const
Rate
=
()
=>
{
return
(
<
View
style
=
{{
flex
:
1
,
backgroundColor
:
'#eee'
,
margin
:
0
,
padding
:
0
}}
>
<
Text
>
평가
<
/Text
>
<
/View
>
)
}
render
()
{
return
(
<
View
style
=
{{
flex
:
1
,
backgroundColor
:
'#eee'
,
margin
:
0
,
padding
:
0
}}
>
<
Text
>
평가
<
/Text
>
<
/View
>
)
}
Rate
.
navigationOptions
=
{
title
:
'평가'
,
tabBarIcon
:
({
tintColor
})
=>
(
<
Icon
name
=
"bar-chart-o"
color
=
{
tintColor
}
style
=
{{
marginLeft
:
0.5
}}
size
=
{
20
}
/>
)
,
}
export
default
Rate
;
\ No newline at end of file
...
...
searchGuide/components/SearchBar/SearchBar.js
View file @
870d17c
...
...
@@ -2,8 +2,17 @@ import React from 'react';
import
{
View
,
Alert
}
from
'react-native'
;
import
{
Searchbar
}
from
'react-native-paper'
;
import
{
connect
}
from
'react-redux'
;
import
{
toggle
Loading
}
from
'../../reducers/ToggleL
oading'
;
import
{
toggle
}
from
'../../reducers/l
oading'
;
const
voiceRecognition
=
()
=>
{
Alert
.
alert
(
'음성 인식'
,
'아직 구현 못함'
,
[
{
text
:
'확인'
,
onPress
:
()
=>
{}},
],
)
}
class
SearchBar
extends
React
.
Component
{
constructor
(
props
){
...
...
@@ -42,7 +51,7 @@ class SearchBar extends React.Component {
onChangeText
=
{
this
.
queryChange
}
value
=
{
this
.
state
.
query
}
icon
=
'microphone'
onIconPress
=
{
this
.
voiceRecognition
}
onIconPress
=
{
voiceRecognition
}
onSubmitEditing
=
{
this
.
submit
}
/
>
<
/View
>
...
...
@@ -51,10 +60,10 @@ class SearchBar extends React.Component {
}
}
const
SearchBarContainer
=
({
toggle
Loading
})
=>
{
return
(
<
SearchBar
toggleLoading
=
{
toggle
Loading
}
/>
)
const
SearchBarContainer
=
({
toggle
})
=>
{
return
(
<
SearchBar
toggleLoading
=
{
toggle
}
/>
)
}
const
mapDispatchToProps
=
(
dispatch
)
=>
({
toggle
Loading
:
()
=>
{
dispatch
(
toggleLoading
()
)}});
const
mapDispatchToProps
=
(
dispatch
)
=>
({
toggle
:
()
=>
{
dispatch
(
toggle
()
)}});
export
default
connect
(
null
,
mapDispatchToProps
)(
SearchBarContainer
);
\ No newline at end of file
...
...
searchGuide/reducers/Store.js
View file @
870d17c
import
{
createStore
,
combineReducers
}
from
'redux'
;
import
ToggleLoading
from
'./ToggleL
oading'
import
loading
from
'./l
oading'
const
store
=
combineReducers
({
ToggleL
oading
});
const
store
=
combineReducers
({
l
oading
});
export
default
createStore
(
store
)
\ No newline at end of file
...
...
searchGuide/reducers/
ToggleL
oading.js
→
searchGuide/reducers/
l
oading.js
View file @
870d17c
const
TOGGLE
_LOADING
=
'ToggleL
oading/TOGGLE'
;
const
TOGGLE
=
'l
oading/TOGGLE'
;
export
const
toggle
Loading
=
()
=>
({
type
:
TOGGLE_LOADING
,})
export
const
toggle
=
()
=>
({
type
:
TOGGLE
,})
const
initialState
=
{
isLoading
:
false
,
};
export
default
ToggleL
oading
=
(
state
=
initialState
,
action
)
=>
{
export
default
l
oading
=
(
state
=
initialState
,
action
)
=>
{
switch
(
action
.
type
)
{
case
TOGGLE
_LOADING
:
case
TOGGLE
:
return
{...
state
,
isLoading
:
!
state
.
isLoading
};
default
:
return
state
;
...
...
searchGuide/reducers/search.js
0 → 100644
View file @
870d17c
const
CHANGE
=
'search/CHANGE'
;
const
SUBMIT
=
'search/SUBMIT'
;
export
const
change
=
(
text
)
=>
({
type
:
CHANGE
,
text
,
})
export
const
submit
=
(
text
)
=>
({
type
:
CHANGE
,
text
,
})
const
initialState
=
{
query
:
''
,
searchResult
:{},
};
export
default
ToggleLoading
=
(
state
=
initialState
,
action
)
=>
{
switch
(
action
.
type
)
{
case
CHANGE
:
return
{...
state
,
query
:
action
.
text
};
case
SUBMIT
:
return
{...
state
,
query
:
''
}
default
:
return
state
;
}
}
submit
=
()
=>
{
this
.
props
.
toggleLoading
();
setTimeout
(()
=>
{
this
.
props
.
toggleLoading
()},
1000
);
this
.
setState
({
query
:
''
});
}
Please
register
or
login
to post a comment