Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
ds147000
/
react-native-project-storage
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit c0c3eafa
authored
Jun 14, 2020
by
GGbong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
补充手势关闭
1 parent
09d078fe
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
30 deletions
src/commo/theme.js
src/router/config.js
src/router/route/index.js
src/views/home/style.js
src/views/home/view.js
src/commo/theme.js
View file @
c0c3eaf
import
React
from
'react'
import
{
StyleSheet
}
from
'react-native'
import
{
Colors
}
from
'react-native/Libraries/NewAppScreen'
import
{
CardStyleInterpolators
}
from
'@react-navigation/stack'
import
{
setUnit
}
from
'../libs/utils'
import
{
Icons
}
from
'../assets/icons'
const
Style
=
StyleSheet
.
create
({
headerStyle
:
{
backgroundColor
:
Colors
.
white
}
})
const
headerStyle
=
{
headerTitleAlign
:
'center'
,
headerStyle
:
Style
.
headerStyle
,
// 标题栏样式
headerTintColor
:
'#333333'
,
// 标题栏字体颜色
headerTitleStyle
:
{
fontSize
:
setUnit
(
38
)
},
headerBackImage
:
()
=>
(
<
Icons
name
=
"zuo"
size
=
{
30
}
color
=
"#333"
/>
),
// 标题栏返回图标
cardStyleInterpolator
:
CardStyleInterpolators
.
forHorizontalIOS
// 设置左右滑动
}
export
{
headerStyle
}
\ No newline at end of file
src/router/config.js
0 → 100644
View file @
c0c3eaf
import
React
from
'react'
import
{
Colors
}
from
'react-native/Libraries/NewAppScreen'
import
{
CardStyleInterpolators
}
from
'@react-navigation/stack'
import
{
setUnit
}
from
'../libs/utils'
import
{
Icons
}
from
'../assets/icons'
const
headerStyle
=
{
headerTitleAlign
:
'center'
,
// 文字居中
headerStyle
:
{
backgroundColor
:
Colors
.
white
},
// 标题栏样式
headerTintColor
:
'#333333'
,
// 标题栏字体颜色
headerTitleStyle
:
{
fontSize
:
setUnit
(
38
)
},
headerBackImage
:
()
=>
(
<
Icons
name
=
"zuo"
size
=
{
30
}
color
=
"#333"
/>
),
// 标题栏返回图标
cardStyleInterpolator
:
CardStyleInterpolators
.
forHorizontalIOS
,
// 设置左右滑动
gestureDirection
:
'horizontal'
,
// 初始化右滑手势配置
gestureEnabled
:
true
// 启用右滑返回
}
export
{
headerStyle
}
\ No newline at end of file
src/router/route/index.js
View file @
c0c3eaf
// 路由配置
import
React
from
'react'
import
{
createStackNavigator
}
from
'@react-navigation/stack'
import
{
headerStyle
}
from
'../
../commo/theme
'
import
{
headerStyle
}
from
'../
config
'
import
{
TabRouter
}
from
'../tab'
import
{
Error404
}
from
'../../views/error/404'
import
Login
from
'../../views/login'
...
...
src/views/home/style.js
View file @
c0c3eaf
import
{
StyleSheet
}
from
'react-native'
import
{
Colors
}
from
'react-native/Libraries/NewAppScreen'
import
{
setUnit
}
from
'../../libs/utils'
const
styles
=
StyleSheet
.
create
({
scrollView
:
{
...
...
@@ -20,6 +21,21 @@ const styles = StyleSheet.create({
button
:
{
marginBottom
:
20
,
marginTop
:
20
},
shoppItem
:
{
width
:
'100%'
,
padding
:
setUnit
(
20
)
},
img
:
{
height
:
setUnit
(
500
)
},
shoppTitle
:
{
textAlign
:
'center'
,
fontSize
:
16
,
color
:
'rgba(0,0,0,.7)'
,
paddingTop
:
5
,
paddingBottom
:
5
,
backgroundColor
:
'#fff'
}
})
...
...
src/views/home/view.js
View file @
c0c3eaf
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
,
memo
}
from
'react'
;
import
{
ScrollView
,
View
,
Text
,
Button
TouchableWithoutFeedback
,
Image
}
from
'react-native'
;
import
{
SafeAreaView
}
from
'react-native-safe-area-context'
import
{
styles
}
from
'./style'
const
ShoppItem
=
memo
(({
title
,
go
})
=>
{
return
(
<
TouchableWithoutFeedback
onPress
=
{
()
=>
go
({
name
:
title
})
}
>
<
View
style
=
{
styles
.
shoppItem
}
>
<
Image
source
=
{{
uri
:
"https://images.b2bwings.com/10170109-22af-467b-8b18-008ec4d09724.jpg"
}}
style
=
{
styles
.
img
}
/
>
<
Text
style
=
{
styles
.
shoppTitle
}
>
{
title
}
<
/Text
>
<
/View>
<
/TouchableWithoutFeedback
>
)
})
const
Page
:
()
=>
React$Node
=
({
navigation
})
=>
{
...
...
@@ -27,9 +38,7 @@ const Page: () => React$Node = ({ navigation }) => {
<
View
>
<
Text
style
=
{
styles
.
h1
}
>
信巴迪
-
基础环境
<
/Text
>
<
/View
>
{
list
.
map
(
e
=>
(
<
Button
title
=
{
e
}
onPress
=
{
()
=>
go
({
name
:
e
})
}
key
=
{
e
}
/
>
))}
{
list
.
map
(
e
=>
(
<
ShoppItem
title
=
{
e
}
go
=
{
go
}
key
=
{
e
}
/>
))
}
<
/ScrollView>
<
/SafeAreaView
>
)
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment