Skip to content

Commit eefd66e

Browse files
committed
fix:ExpandableSection 展开缩放组件文档
1 parent 4e4f556 commit eefd66e

File tree

5 files changed

+21
-5
lines changed

5 files changed

+21
-5
lines changed

packages/core/src/ExpandableSection/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
ExpandableSection 展开缩放
22
---
33

4-
展开缩放
4+
ExpandableSection 组件以在 sectionHeader标题 下方或上方呈现展开的内容部分
55

66
### 基础示例
77

88
<!--DemoStart-->
99
```js
10+
import React from 'react';
1011
import { ExpandableSection,H5 } from '@uiw/react-native';
1112

12-
class Demo extends Component {
13+
export default class ExpandableSectionDemo extends Component {
1314
state={
1415
expanded:false,
1516
top:false
@@ -38,7 +39,6 @@ class Demo extends Component {
3839
|------|------|-----|------|
3940
| `sectionHeader` | 设置标题 | JSX.Element | - |
4041
| `children` | 展开内容| ReactNode | - |
41-
| `labelStyle` | 设置提示文本样式 | TextProps['style'] | - |
4242
| `expanded` | 是否展开 | boolean | - |
4343
| `top` | 展开后显示位置 标题上或标题下 | boolean | - |
44-
| `top` | 点击事件 | void | - |
44+
| `onPress` | 点击事件 | void | - |

packages/core/src/ExpandableSection/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ export type ExpandableSectionProps = {
2525
};
2626

2727
function ExpandableSection(props: ExpandableSectionProps) {
28-
const { expanded, sectionHeader, children, top } = props;
28+
const { expanded = false, sectionHeader, children, top = false } = props;
2929

3030
const onPress = () => {
3131
props.onPress?.();
32+
// 动画效果
3233
LayoutAnimation.configureNext({ ...LayoutAnimation.Presets.easeInEaseOut, duration: 300 });
3334
};
3435

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import Markdown, { importAll } from '../../../component/Markdown';
2+
3+
export default class Page extends Markdown {
4+
path="/packages/core/src/ExpandableSection/README.md"
5+
getMarkdown = async () => {
6+
const md = await import('@uiw/react-native/lib/ExpandableSection/README.md');
7+
// 支持 markdown 中,相对于当前 index.tsx 相对路径引入图片资源
8+
importAll((require as any).context('./', true, /\.(png|gif|jpg)$/), this.imageFiles);
9+
return md.default || md;
10+
}
11+
}

website/src/routes/menus.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const componentMenus: MenuData[] = [
1515
{ path: "/components/drawer", name: "Drawer 抽屉" },
1616
{ path: "/components/menudropdown", name: "MenuDropdown 菜单下拉按钮" },
1717
{ path: "/components/swipeaction", name: "SwipeAction 滑动操作组件" },
18+
{ path: "/components/expandablesection", name: "ExpandableSection 展开缩放组件" },
1819
{ divider: true, name: "Data Entry" },
1920
{ path: "/components/buttongroup", name: "ButtonGroup 按钮组" },
2021
{ path: "/components/checkbox", name: "CheckBox 复选框" },

website/src/routes/router.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ export const getRouterData = {
8787
'/components/swipeaction': {
8888
component: dynamicWrapper([], () => import('../pages/components/swipeaction')),
8989
},
90+
'/components/expandablesection': {
91+
component: dynamicWrapper([], () => import('../pages/components/expandablesection')),
92+
},
9093
'/components/button': {
9194
component: dynamicWrapper([], () => import('../pages/components/button')),
9295
},

0 commit comments

Comments
 (0)