Skip to content

Commit bb3c6b5

Browse files
committed
doc(Calendar): 新增api 试例
1 parent dbe19da commit bb3c6b5

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

packages/core/src/Calendar/README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,81 @@ function CalendarView() {
8383
export default CalendarView
8484
```
8585

86+
### 隐藏头部
87+
88+
```jsx mdx:preview
89+
import React,{Component} from 'react';
90+
import { View } from 'react-native';
91+
import { Calendar } from '@uiw/react-native';
92+
import Layout, { Container } from '../Layout';
93+
const { Header, Body, Footer } = Layout;
94+
95+
function CalendarView() {
96+
const title = 'Calendar';
97+
return (
98+
<Container>
99+
<Layout>
100+
<Body>
101+
<Calendar showBar={false} />
102+
</Body>
103+
<Footer />
104+
</Layout>
105+
</Container>
106+
);
107+
}
108+
export default CalendarView
109+
```
110+
111+
### 自定义日期额外内容
112+
113+
```jsx mdx:preview
114+
import React,{Component} from 'react';
115+
import { View,Text } from 'react-native';
116+
import { Calendar } from '@uiw/react-native';
117+
import Layout, { Container } from '../Layout';
118+
const { Header, Body, Footer } = Layout;
119+
120+
function CalendarView() {
121+
const title = 'Calendar';
122+
return (
123+
<Container>
124+
<Layout>
125+
<Body>
126+
<Calendar renderDay={()=><View><Text>1</Text></View>} />
127+
</Body>
128+
<Footer />
129+
</Layout>
130+
</Container>
131+
);
132+
}
133+
export default CalendarView
134+
```
135+
136+
### value值
137+
138+
```jsx mdx:preview
139+
import React,{Component} from 'react';
140+
import { View,Text } from 'react-native';
141+
import { Calendar } from '@uiw/react-native';
142+
import Layout, { Container } from '../Layout';
143+
const { Header, Body, Footer } = Layout;
144+
145+
function CalendarView() {
146+
const title = 'Calendar';
147+
return (
148+
<Container>
149+
<Layout>
150+
<Body>
151+
<Calendar value={new Date('2023-1-1')} />
152+
</Body>
153+
<Footer />
154+
</Layout>
155+
</Container>
156+
);
157+
}
158+
export default CalendarView
159+
```
160+
86161
### Props
87162

88163
集成继承 `Button` 组件自定义属性,外层包裹继承 [`Flex`] 组件。

0 commit comments

Comments
 (0)