1- import React , { Component } from 'react' ;
2- import { StyleSheet , Image , View } from 'react-native' ;
3- import { ExpandableSection , Text , Icon } from '@uiw/react-native' ;
4- import Layout , { Container } from '../../Layout' ;
5- import { ComProps } from '../../routes' ;
1+ import React , { Component } from 'react' ;
2+ import { StyleSheet , Image , View } from 'react-native' ;
3+ import { ExpandableSection , Text , Icon } from '@uiw/react-native' ;
4+ import Layout , { Container } from '../../Layout' ;
5+ import { ComProps } from '../../routes' ;
66import map from 'lodash/map' ;
7- const { Header, Body, Card, Footer } = Layout ;
7+ const { Header, Body, Card, Footer} = Layout ;
88
9- export interface ExpandableSection extends ComProps { }
9+ export interface ExpandableSection extends ComProps { }
1010
1111const contents = [
1212 'https://wx3.sinaimg.cn/mw690/4718260ely1gt2cg7t5udj23dw1wkhdu.jpg' ,
@@ -21,17 +21,9 @@ export default class MenuDropdownView extends Component<ExpandableSection> {
2121 } ;
2222 getChevron ( ) {
2323 if ( this . state . expanded ) {
24- return this . state . top ? (
25- < Icon name = 'right' size = { 15 } />
26- ) : (
27- < Icon name = 'down' size = { 15 } />
28- ) ;
24+ return this . state . top ? < Icon name = "right" size = { 15 } /> : < Icon name = "down" size = { 15 } /> ;
2925 }
30- return this . state . top ? (
31- < Icon name = 'down' size = { 15 } />
32- ) : (
33- < Icon name = 'right' size = { 15 } />
34- ) ;
26+ return this . state . top ? < Icon name = "down" size = { 15 } /> : < Icon name = "right" size = { 15 } /> ;
3527 }
3628
3729 getHeaderElement ( ) {
@@ -44,14 +36,14 @@ export default class MenuDropdownView extends Component<ExpandableSection> {
4436 }
4537 renderItem = ( _ : string , index : number ) => {
4638 return (
47- < View key = { index } style = { { padding : 12 } } >
48- < Image source = { { uri : contents [ index ] } } style = { { height : 180 } } />
39+ < View key = { index } style = { { padding : 12 } } >
40+ < Image source = { { uri : contents [ index ] } } style = { { height : 180 } } />
4941 </ View >
5042 ) ;
5143 } ;
5244 render ( ) {
53- const { route } = this . props ;
54- const { expanded, top } = this . state ;
45+ const { route} = this . props ;
46+ const { expanded, top} = this . state ;
5547 const description = route . params . description ;
5648 const title = route . params . title ;
5749 return (
@@ -60,11 +52,7 @@ export default class MenuDropdownView extends Component<ExpandableSection> {
6052 < Header title = { title } description = { description } />
6153 < Body >
6254 < Card title = "基础实例" style = { styles . card } >
63- < ExpandableSection
64- expanded = { expanded }
65- onPress = { ( ) => this . setState ( { expanded : ! expanded } ) }
66- sectionHeader = { this . getHeaderElement ( ) }
67- top = { top } >
55+ < ExpandableSection expanded = { expanded } onPress = { ( ) => this . setState ( { expanded : ! expanded } ) } sectionHeader = { this . getHeaderElement ( ) } top = { top } >
6856 { map ( contents , ( item , index ) => {
6957 return this . renderItem ( item , index ) ;
7058 } ) }
@@ -80,12 +68,11 @@ export default class MenuDropdownView extends Component<ExpandableSection> {
8068
8169const styles = StyleSheet . create ( {
8270 card : {
83- paddingLeft : 20 ,
84- paddingRight : 20 ,
71+ paddingLeft : 16 ,
72+ paddingRight : 16 ,
8573 } ,
8674 icon : {
8775 alignSelf : 'center' ,
88-
8976 } ,
9077 row : {
9178 display : 'flex' ,
0 commit comments