From c6bb25114dc72f92972252117c4bddc7dfeb4e1b Mon Sep 17 00:00:00 2001 From: hy Date: Tue, 11 Apr 2023 14:29:11 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=88Accordion=EF=BC=89=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0Accordion=E6=89=8B=E9=A3=8E=E7=90=B4=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/examples/lib2/ImagePicker/index.js | 14 +-- example/examples/lib2/index.d.ts | 2 +- example/examples/lib2/index.js | 4 +- example/examples/src/routes.tsx | 10 +- .../examples/src/routes/Accordion/index.tsx | 77 ++++++++++++ packages/core/src/Accordion/README.md | 61 +++++++++ packages/core/src/Accordion/index.tsx | 119 ++++++++++++++++++ packages/core/src/index.tsx | 3 +- .../src/pages/components/accordion/index.tsx | 6 + website/src/routes/menus.ts | 1 + website/src/routes/router.tsx | 4 + 11 files changed, 288 insertions(+), 13 deletions(-) create mode 100644 example/examples/src/routes/Accordion/index.tsx create mode 100644 packages/core/src/Accordion/README.md create mode 100644 packages/core/src/Accordion/index.tsx create mode 100644 website/src/pages/components/accordion/index.tsx diff --git a/example/examples/lib2/ImagePicker/index.js b/example/examples/lib2/ImagePicker/index.js index eaa9f2661..7a4628e06 100644 --- a/example/examples/lib2/ImagePicker/index.js +++ b/example/examples/lib2/ImagePicker/index.js @@ -1,17 +1,15 @@ import React from 'react'; -import {View, Text, StyleSheet} from 'react-native'; +import { View, Text, StyleSheet } from 'react-native'; const ImagePicker = () => { - return ( - + return ImagePicker - - ); + ; }; const styles = StyleSheet.create({ tree: { paddingHorizontal: 10, paddingVertical: 5, - backgroundColor: '#fff', - }, + backgroundColor: '#fff' + } }); -export default ImagePicker; +export default ImagePicker; \ No newline at end of file diff --git a/example/examples/lib2/index.d.ts b/example/examples/lib2/index.d.ts index a5785e9d9..4193e7bf1 100644 --- a/example/examples/lib2/index.d.ts +++ b/example/examples/lib2/index.d.ts @@ -1,2 +1,2 @@ -export {default as ImagePicker} from './ImagePicker'; +export { default as ImagePicker } from './ImagePicker'; export * from './ImagePicker'; diff --git a/example/examples/lib2/index.js b/example/examples/lib2/index.js index a5785e9d9..481390a5b 100644 --- a/example/examples/lib2/index.js +++ b/example/examples/lib2/index.js @@ -1,2 +1,2 @@ -export {default as ImagePicker} from './ImagePicker'; -export * from './ImagePicker'; +export { default as ImagePicker } from './ImagePicker'; +export * from './ImagePicker'; \ No newline at end of file diff --git a/example/examples/src/routes.tsx b/example/examples/src/routes.tsx index dc85ac96d..729483dfc 100644 --- a/example/examples/src/routes.tsx +++ b/example/examples/src/routes.tsx @@ -1,4 +1,4 @@ -import {StackNavigationProp, StackNavigationOptions} from '@react-navigation/stack'; +import { StackNavigationProp, StackNavigationOptions } from '@react-navigation/stack'; type ModalStackNavigation = StackNavigationProp<{}>; @@ -498,4 +498,12 @@ export const stackPageData: Routes[] = [ description: '图片上传', }, }, + { + name: 'Accordion', + component: require('./routes/Accordion').default, + params: { + title: 'Accordion 手风琴', + description: '可以折叠/展开的内容区域。', + }, + }, ]; diff --git a/example/examples/src/routes/Accordion/index.tsx b/example/examples/src/routes/Accordion/index.tsx new file mode 100644 index 000000000..e75703c53 --- /dev/null +++ b/example/examples/src/routes/Accordion/index.tsx @@ -0,0 +1,77 @@ +import React, { Component } from 'react'; +import { View, Image } from 'react-native'; +import { Accordion, Text } from '@uiw/react-native'; +import Layout, { Container } from '../../Layout'; +import { ComProps } from '../../routes'; +const { Header, Body, Card, Footer } = Layout; + +export interface Accordion extends ComProps { } + +const contents = [ + { + title: Section 1, + content: ( + + Content of section 1 + + + ), + }, + { + title: Section 2, + content: ( + + Content of section 2 + + + ), + }, + { + title: Section 3, + content: ( + + Content of section 3 + + + ), + }, +]; +export default class MenuDropdownView extends Component { + state = { + expanded: false, + top: false, + }; + render() { + const { route } = this.props; + const description = route.params.description; + const title = route.params.title; + return ( + + +
+ + + + + + + + + + + + + + + + + + + + +