Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bluejoyq
/
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-19 23:54:07 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
839e67906662ae5fcf4d637ad6526f3a389d44a0
839e6790
1 parent
dc77803d
complete loading animation with redux
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
21 deletions
searchGuide/components/Home/Home.js
searchGuide/components/Loading/Loading.js
searchGuide/components/Main/Main.js
searchGuide/components/SearchBar/SearchBar.js
searchGuide/components/SearchCard/SearchCard.js
searchGuide/reducers/ToggleLoading.js
searchGuide/components/Home/Home.js
View file @
839e679
import
React
from
'react'
;
import
{
View
}
from
'react-native'
;
import
Icon
from
'react-native-vector-icons/FontAwesome'
;
import
SearchBar
from
'../SearchBar/SearchBar'
;
import
SearchBar
Container
from
'../SearchBar/SearchBar'
;
import
SearchCard
from
'../SearchCard/SearchCard'
;
...
...
@@ -19,7 +19,7 @@ class Home extends React.Component {
render
()
{
return
(
<
View
style
=
{{
flex
:
1
,
backgroundColor
:
'#eee'
,
margin
:
0
,
padding
:
0
}}
>
<
SearchBar
toggleLoading
=
{
this
.
props
.
toggleLoading
}
/
>
<
SearchBar
Container
/>
<
SearchCard
title
=
{
'네이버- 지식인...인간사냥꾼 니달리를ㄴㄴㅁ'
}
content
=
{
'문도 가고 싶은 데로 간다!'
}
url
=
{
'https://www.naver.com'
}
/
>
<
/View
>
...
...
searchGuide/components/Loading/Loading.js
View file @
839e679
...
...
@@ -4,7 +4,7 @@ import {View,ActivityIndicator,StyleSheet,Dimensions, Modal} from 'react-native'
const
Loading
=
()
=>
{
return
(
<
Modal
transparent
=
{
true
}
animationType
=
{
'none'
}
>
<
View
style
=
{
styles
.
container
}
><
ActivityIndicator
size
=
{
80
}
color
=
"#ffffff"
/><
/View
>
<
View
style
=
{
styles
.
container
}
><
ActivityIndicator
size
=
{
80
}
color
=
"#ffffff"
style
=
{
styles
.
icon
}
/></
View
>
<
/Modal
>
)
}
...
...
@@ -12,14 +12,16 @@ const Loading = () => {
const
styles
=
StyleSheet
.
create
({
container
:
{
zIndex
:
2
,
height
:
Dimensions
.
get
(
'window'
).
height
,
height
:
Dimensions
.
get
(
'window'
).
height
+
50
,
width
:
'100%'
,
display
:
'flex'
,
alignItems
:
'center'
,
justifyContent
:
'center'
,
backgroundColor
:
'rgba(15,15,15,0.7)'
,
paddingBottom
:
50
,
},
icon
:{
paddingBottom
:
100
,
}
});
...
...
searchGuide/components/Main/Main.js
View file @
839e679
...
...
@@ -8,23 +8,22 @@ const Main = ({ isLoading, toggleLoading}) => {
return
(
<>
<
Loading
/
>
<
AppTabContainer
toggleLoading
=
{
toggleLoading
}
/
>
<
AppTabContainer
/>
<
/
>
)
}
else
{
return
(
<
AppTabContainer
toggleLoading
=
{
toggleLoading
}
/
>
<
AppTabContainer
/>
)
}
}
}
const
MainContainer
=
({
isLoading
,
toggleLoading
})
=>
{
const
MainContainer
=
({
isLoading
})
=>
{
return
(
<
Main
isLoading
=
{
isLoading
}
/>
)
}
const
mapStateToProps
=
(
state
)
=>
({
isLoading
:
state
.
ToggleLoading
.
isLoading
})
const
mapStateToProps
=
(
state
)
=>
({
isLoading
:
state
.
ToggleLoading
.
isLoading
})
export
default
connect
(
mapStateToProps
)(
MainContainer
);
\ No newline at end of file
export
default
connect
(
mapStateToProps
)(
MainContainer
);
\ No newline at end of file
...
...
searchGuide/components/SearchBar/SearchBar.js
View file @
839e679
import
React
from
'react'
;
import
{
View
,
Alert
}
from
'react-native'
;
import
{
Searchbar
}
from
'react-native-paper'
;
import
{
connect
}
from
'react-redux'
;
import
{
toggleLoading
}
from
'../../reducers/ToggleLoading'
;
export
default
class
SearchBar
extends
React
.
Component
{
class
SearchBar
extends
React
.
Component
{
constructor
(
props
){
super
(
props
);
this
.
state
=
{
...
...
@@ -15,8 +18,8 @@ export default class SearchBar extends React.Component {
}
submit
=
()
=>
{
this
.
props
.
toggleLoading
;
set
Interval
(()
=>
{
this
.
props
.
toggleLoading
},
5
);
this
.
props
.
toggleLoading
()
;
set
Timeout
(()
=>
{
this
.
props
.
toggleLoading
()},
1000
);
this
.
setState
({
query
:
''
});
}
...
...
@@ -46,4 +49,12 @@ export default class SearchBar extends React.Component {
<
/
>
)
}
}
\ No newline at end of file
}
const
SearchBarContainer
=
({
toggleLoading
})
=>
{
return
(
<
SearchBar
toggleLoading
=
{
toggleLoading
}
/>
)
}
const
mapDispatchToProps
=
(
dispatch
)
=>
({
toggleLoading
:
()
=>
{
dispatch
(
toggleLoading
()
)}});
export
default
connect
(
null
,
mapDispatchToProps
)(
SearchBarContainer
);
\ No newline at end of file
...
...
searchGuide/components/SearchCard/SearchCard.js
View file @
839e679
...
...
@@ -3,7 +3,7 @@ import { DARK_MAIN,LIGHT_MAIN, WHITE_MAIN} from 'react-native-dotenv';
import
{
Avatar
,
Button
,
Card
,
Title
,
Paragraph
}
from
'react-native-paper'
;
import
{
Linking
}
from
'react-native'
;
const
MyComponent
=
(
props
)
=>
(
const
SearchCard
=
(
props
)
=>
(
<
Card
style
=
{{
margin
:
10
}}
>
<
Card
.
Title
title
=
{
props
.
title
}
left
=
{
(
props
)
=>
(
...
...
@@ -20,4 +20,4 @@ const MyComponent = (props) => (
<
/Card
>
);
export
default
MyComponent
;
\ No newline at end of file
export
default
SearchCard
;
\ No newline at end of file
...
...
searchGuide/reducers/ToggleLoading.js
View file @
839e679
const
TOGGLE_LOADING
=
'ToggleLoading/TOGGLE'
;
export
const
toggleLoading
=
()
=>
({
type
:
TOGGLE_LOADING
,})
...
...
@@ -11,7 +9,7 @@ const initialState = {
export
default
ToggleLoading
=
(
state
=
initialState
,
action
)
=>
{
switch
(
action
.
type
)
{
case
TOGGLE_LOADING
:
return
{
isLoading
:
!
initialS
tate
.
isLoading
};
return
{
...
state
,
isLoading
:
!
s
tate
.
isLoading
};
default
:
return
state
;
}
...
...
Please
register
or
login
to post a comment