1
- import React , { PureComponent } from 'react' ;
2
- import { StyleSheet , View , ViewProps , ViewStyle , SafeAreaView , ScrollView , ScrollViewProps , Text , TextStyle , Image , StyleProp } from 'react-native' ;
1
+ import React , { PureComponent } from 'react' ;
2
+ import { StyleSheet , View , ViewProps , ViewStyle , SafeAreaView , ScrollView , ScrollViewProps , Text , TextStyle , Image , StyleProp } from 'react-native' ;
3
3
import PropTypes from 'prop-types' ;
4
- import { Theme } from '@uiw/react-native' ;
5
- import { useTheme } from '@shopify/restyle' ;
4
+ import { Theme , useTheme } from '@uiw/react-native' ;
6
5
7
6
export interface HeaderProps {
8
7
title ?: string ;
@@ -15,8 +14,8 @@ export interface HeaderProps {
15
14
}
16
15
17
16
const Header = ( props : HeaderProps ) => {
18
- const { children, title, description, style, hasLogo, titleStyle, descriptionStyle } = props ;
19
- const theme = useTheme < Theme > ( ) ;
17
+ const { children, title, description, style, hasLogo, titleStyle, descriptionStyle} = props ;
18
+ const theme = useTheme ( ) as Theme ;
20
19
const styles = createStyles ( {
21
20
backgroundColor : theme . colors . background ,
22
21
shadowColor : theme . colors . border ,
@@ -27,7 +26,7 @@ const Header = (props: HeaderProps) => {
27
26
{ title && < Text style = { [ styles . title , titleStyle ] } > { title } </ Text > }
28
27
{ hasLogo && (
29
28
< View style = { styles . logo } >
30
- < Image source = { require ( '../image/logo.png' ) } style = { { width : 103 , height : 18 } } />
29
+ < Image source = { require ( '../image/logo.png' ) } style = { { width : 103 , height : 18 } } />
31
30
</ View >
32
31
) }
33
32
{ description && < Text style = { [ styles . description , descriptionStyle ] } > { description } </ Text > }
@@ -43,8 +42,8 @@ export interface BodyProps extends ScrollViewProps {
43
42
}
44
43
45
44
const Body = ( props : BodyProps ) => {
46
- const { children, style, isScroll, ...other } = props ;
47
- const theme = useTheme < Theme > ( ) ;
45
+ const { children, style, isScroll, ...other } = props ;
46
+ const theme = useTheme ( ) as Theme ;
48
47
const styles = createStyles ( {
49
48
backgroundColor : theme . colors . background ,
50
49
shadowColor : theme . colors . border ,
@@ -65,8 +64,8 @@ export interface FooterProps {
65
64
}
66
65
67
66
const Footer = ( props : FooterProps ) => {
68
- const { children, copyright, style, isShowCopyRight, ...other } = props ;
69
- const theme = useTheme < Theme > ( ) ;
67
+ const { children, copyright, style, isShowCopyRight, ...other } = props ;
68
+ const theme = useTheme ( ) as Theme ;
70
69
const styles = createStyles ( {
71
70
backgroundColor : theme . colors . background ,
72
71
shadowColor : theme . colors . border ,
@@ -91,8 +90,8 @@ export interface CardProps extends ViewProps {
91
90
}
92
91
93
92
const Card = ( props : CardProps ) => {
94
- const { title, titleStyle, bodyStyle, children, style, showTitle, extra, ...other } = props ;
95
- const theme = useTheme < Theme > ( ) ;
93
+ const { title, titleStyle, bodyStyle, children, style, showTitle, extra, ...other } = props ;
94
+ const theme = useTheme ( ) as Theme ;
96
95
const styles = createStyles ( {
97
96
backgroundColor : theme . colors . background ,
98
97
shadowColor : theme . colors . border ,
@@ -103,7 +102,7 @@ const Card = (props: CardProps) => {
103
102
{ extra ? (
104
103
< View style = { [ styles . extra , styles . cardTitle ] } >
105
104
{ showTitle && (
106
- < View style = { { flex : 2 } } >
105
+ < View style = { { flex : 2 } } >
107
106
< Text style = { [ titleStyle ] } > { title } </ Text >
108
107
</ View >
109
108
) }
@@ -123,32 +122,32 @@ export interface ContainerProps extends ScrollViewProps {
123
122
}
124
123
125
124
export const Container = ( props : ContainerProps ) => {
126
- const { children, ...others } = props ;
127
- const theme = useTheme < Theme > ( ) ;
125
+ const { children, ...others } = props ;
126
+ const theme = useTheme ( ) as Theme ;
128
127
return (
129
- < SafeAreaView style = { { backgroundColor : theme . colors . background } } { ...others } >
130
- < ScrollView style = { { height : '100%' } } { ...others } >
128
+ < SafeAreaView style = { { backgroundColor : theme . colors . background } } { ...others } >
129
+ < ScrollView style = { { height : '100%' } } { ...others } >
131
130
{ children }
132
131
</ ScrollView >
133
132
</ SafeAreaView >
134
133
) ;
135
134
} ;
136
135
137
- export interface LayoutProps extends ViewProps { }
136
+ export interface LayoutProps extends ViewProps { }
138
137
139
138
export default class Layout extends PureComponent < LayoutProps > {
140
139
static Header = Header ;
141
140
static Body = Body ;
142
141
static Footer = Footer ;
143
142
static Card = Card ;
144
143
render ( ) {
145
- const { children, style } = this . props ;
144
+ const { children, style} = this . props ;
146
145
const styles = createStyles ( { } ) ;
147
146
return < View style = { [ styles . container , style ] } > { children } </ View > ;
148
147
}
149
148
}
150
149
151
- function createStyles ( { backgroundColor = '#F7F7F7' , shadowColor = '#E6E6E6' , color = '#9A9A9A' } ) {
150
+ function createStyles ( { backgroundColor = '#F7F7F7' , shadowColor = '#E6E6E6' , color = '#9A9A9A' } ) {
152
151
return StyleSheet . create ( {
153
152
container : {
154
153
backgroundColor : backgroundColor ,
@@ -162,7 +161,7 @@ function createStyles({ backgroundColor = '#F7F7F7', shadowColor = '#E6E6E6', co
162
161
paddingRight : 16 ,
163
162
shadowColor : shadowColor ,
164
163
backgroundColor : backgroundColor ,
165
- shadowOffset : { width : 0 , height : 3 } ,
164
+ shadowOffset : { width : 0 , height : 3 } ,
166
165
shadowRadius : 3 ,
167
166
// shadowOpacity: 0.8,
168
167
shadowOpacity : 0 ,
0 commit comments