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' ;
33import 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' ;
65
76export interface HeaderProps {
87 title ?: string ;
@@ -15,8 +14,8 @@ export interface HeaderProps {
1514}
1615
1716const 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 ;
2019 const styles = createStyles ( {
2120 backgroundColor : theme . colors . background ,
2221 shadowColor : theme . colors . border ,
@@ -27,7 +26,7 @@ const Header = (props: HeaderProps) => {
2726 { title && < Text style = { [ styles . title , titleStyle ] } > { title } </ Text > }
2827 { hasLogo && (
2928 < 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 } } />
3130 </ View >
3231 ) }
3332 { description && < Text style = { [ styles . description , descriptionStyle ] } > { description } </ Text > }
@@ -43,8 +42,8 @@ export interface BodyProps extends ScrollViewProps {
4342}
4443
4544const 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 ;
4847 const styles = createStyles ( {
4948 backgroundColor : theme . colors . background ,
5049 shadowColor : theme . colors . border ,
@@ -65,8 +64,8 @@ export interface FooterProps {
6564}
6665
6766const 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 ;
7069 const styles = createStyles ( {
7170 backgroundColor : theme . colors . background ,
7271 shadowColor : theme . colors . border ,
@@ -91,8 +90,8 @@ export interface CardProps extends ViewProps {
9190}
9291
9392const 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 ;
9695 const styles = createStyles ( {
9796 backgroundColor : theme . colors . background ,
9897 shadowColor : theme . colors . border ,
@@ -103,7 +102,7 @@ const Card = (props: CardProps) => {
103102 { extra ? (
104103 < View style = { [ styles . extra , styles . cardTitle ] } >
105104 { showTitle && (
106- < View style = { { flex : 2 } } >
105+ < View style = { { flex : 2 } } >
107106 < Text style = { [ titleStyle ] } > { title } </ Text >
108107 </ View >
109108 ) }
@@ -123,32 +122,32 @@ export interface ContainerProps extends ScrollViewProps {
123122}
124123
125124export 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 ;
128127 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 } >
131130 { children }
132131 </ ScrollView >
133132 </ SafeAreaView >
134133 ) ;
135134} ;
136135
137- export interface LayoutProps extends ViewProps { }
136+ export interface LayoutProps extends ViewProps { }
138137
139138export default class Layout extends PureComponent < LayoutProps > {
140139 static Header = Header ;
141140 static Body = Body ;
142141 static Footer = Footer ;
143142 static Card = Card ;
144143 render ( ) {
145- const { children, style } = this . props ;
144+ const { children, style} = this . props ;
146145 const styles = createStyles ( { } ) ;
147146 return < View style = { [ styles . container , style ] } > { children } </ View > ;
148147 }
149148}
150149
151- function createStyles ( { backgroundColor = '#F7F7F7' , shadowColor = '#E6E6E6' , color = '#9A9A9A' } ) {
150+ function createStyles ( { backgroundColor = '#F7F7F7' , shadowColor = '#E6E6E6' , color = '#9A9A9A' } ) {
152151 return StyleSheet . create ( {
153152 container : {
154153 backgroundColor : backgroundColor ,
@@ -162,7 +161,7 @@ function createStyles({ backgroundColor = '#F7F7F7', shadowColor = '#E6E6E6', co
162161 paddingRight : 16 ,
163162 shadowColor : shadowColor ,
164163 backgroundColor : backgroundColor ,
165- shadowOffset : { width : 0 , height : 3 } ,
164+ shadowOffset : { width : 0 , height : 3 } ,
166165 shadowRadius : 3 ,
167166 // shadowOpacity: 0.8,
168167 shadowOpacity : 0 ,
0 commit comments