Skip to content

Commit ebdaa89

Browse files
committed
Merge branch 'dev'
2 parents d96a971 + e5d4bec commit ebdaa89

File tree

20 files changed

+474
-459
lines changed

20 files changed

+474
-459
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020

2121
- run: yarn install
2222
- run: npm run build
23+
- run: npm run test
2324
- run: npm run doc
2425
- run: rm -rf packages/docs/doc
2526
- run: mkdir -p packages/docs/doc

.github/workflows/pull_request.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717

1818
- run: yarn install
1919
- run: npm run build
20+
- run: npm run test
2021
- run: npm run doc
2122
- run: rm -rf packages/docs/doc
2223
- run: mkdir -p packages/docs/doc

example/examples/src/routes/TextArea/index.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default class TextAreaView extends Component<TextAreaProps> {
1414
value1: '只读状态不可输入',
1515
value3: '自定义输入框样式',
1616
value4: '',
17+
value5: '',
1718
};
1819

1920
render() {
@@ -35,6 +36,16 @@ export default class TextAreaView extends Component<TextAreaProps> {
3536
placeholder="默认提示语"
3637
/>
3738
</Card>
39+
<Card title="根据内容自动调整高度" style={styles.card}>
40+
<TextArea
41+
onChange={(value5: string) => {
42+
this.setState({value5});
43+
}}
44+
value={this.state.value5}
45+
placeholder="默认提示语"
46+
autoSize
47+
/>
48+
</Card>
3849
<Card title="展示字数" style={styles.card}>
3950
<TextArea
4051
onChange={(value4: string) => {

packages/core/src/Avatar/index.tsx

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Component } from 'react';
1+
import React from 'react';
22
import { View, ViewProps, Image, ImageProps, StyleSheet } from 'react-native';
33

44
const styles = StyleSheet.create({
@@ -36,31 +36,23 @@ export interface AvatarProps extends ViewProps {
3636
shape?: 'circle' | 'square';
3737
}
3838

39-
export default class Avatar extends Component<AvatarProps> {
40-
static defaultProps: AvatarProps = {
41-
src: defaultImage,
42-
shape: 'square',
43-
rounded: 3,
44-
size: 40,
45-
};
46-
render() {
47-
const { style, src, size, shape, rounded, imageProps, ...otherProps } = this.props;
48-
return (
49-
<View
50-
style={[
51-
styles.defalut,
52-
style,
53-
{ width: size, height: size },
54-
{ borderRadius: shape === 'circle' ? size! / 2 : rounded },
55-
]}
56-
{...otherProps}
57-
>
58-
<Image
59-
style={{ width: size, height: size }}
60-
source={typeof src === 'number' ? src : { uri: src as string }}
61-
{...imageProps}
62-
/>
63-
</View>
64-
);
65-
}
39+
export default function Avatar(props: AvatarProps) {
40+
const { style, src = defaultImage, size = 40, shape = 'square', rounded = 3, imageProps, ...otherProps } = props;
41+
return (
42+
<View
43+
style={[
44+
styles.defalut,
45+
style,
46+
{ width: size, height: size },
47+
{ borderRadius: shape === 'circle' ? size! / 2 : rounded },
48+
]}
49+
{...otherProps}
50+
>
51+
<Image
52+
style={{ width: size, height: size }}
53+
source={typeof src === 'number' ? src : { uri: src as string }}
54+
{...imageProps}
55+
/>
56+
</View>
57+
);
6658
}

packages/core/src/Calendar/index.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useEffect, useState } from 'react';
2-
import { View, Text, ViewProps, StyleSheet, TouchableOpacity, Dimensions, Platform } from 'react-native';
2+
import { View, Text, ViewProps, TextProps, StyleSheet, TouchableOpacity, Dimensions, Platform } from 'react-native';
33
import Icon from '../Icon';
44
import Ellipsis from '../Ellipsis';
55
import { getMonths, getWeeksArray, daysArrProps, getType, getNameLen } from './utils';
@@ -112,7 +112,7 @@ const Calendar = (props: CalendarProps) => {
112112

113113
let nameLen = getNameLen(day.lunarHolidays);
114114
let lineHeight =
115-
lunarHoliday === true && Platform.OS === 'ios' ? 0 : lunarHoliday === true ? MainWidth < 1000 ? 18 : 55 : MainWidth < 1000 ? MainWidth / 7 - 4.5 : MainWidth / 14.5;
115+
lunarHoliday === true && Platform.OS === 'ios' ? 0 : lunarHoliday === true ? 18 : MainWidth / 7 - 4.5;
116116
let paddingTop = lunarHoliday === true ? 4 : 0;
117117
let colorType = '';
118118
if (day.colorType === '') {
@@ -211,9 +211,9 @@ const Calendar = (props: CalendarProps) => {
211211
setCurrentMonth(toMonth);
212212
setCurrentDays(toDays);
213213
};
214-
// const goCurrentDay = (day: number) => {
215-
// setCurrentDays(day);
216-
// };
214+
const goCurrentDay = (day: number) => {
215+
setCurrentDays(day);
216+
};
217217

218218
return (
219219
<View style={{ flex: 1, position: 'relative' }}>
@@ -298,10 +298,10 @@ const styles = StyleSheet.create({
298298
},
299299
calendarWeekdays: {
300300
flexDirection: 'row',
301-
justifyContent: 'space-around',
301+
justifyContent: 'space-between',
302302
alignItems: 'center',
303-
paddingHorizontal: MainWidth < 1000 ? MainWidth / 7 - 33 : MainWidth / 30,
304-
paddingTop: 12,
303+
paddingHorizontal: MainWidth / 7 - 33,
304+
paddingTop: 10,
305305
},
306306
calendarWedText: {
307307
color: '#616161',
@@ -312,12 +312,12 @@ const styles = StyleSheet.create({
312312
},
313313
weekDay: {
314314
flexDirection: 'row',
315-
paddingHorizontal: 22,
315+
paddingHorizontal: 2,
316316
},
317317
dateBase: {
318-
marginHorizontal: 8,
319-
width: MainWidth < 1000 ? MainWidth / 7 - 4.5 : MainWidth / 14,
320-
height: MainHeight < 300 ? MainWidth / 7 - 4.5 : MainWidth / 14,
318+
marginHorizontal: 2,
319+
width: MainWidth / 7 - 4.5,
320+
height: MainWidth / 7 - 4.5,
321321
...Platform.select({
322322
ios: {},
323323
android: {
@@ -327,15 +327,15 @@ const styles = StyleSheet.create({
327327
},
328328
currentMonth: {
329329
backgroundColor: '#329BCB',
330-
borderRadius: 60,
330+
borderRadius: 50,
331331
},
332332
selectMonth: {
333333
borderWidth: 1,
334334
borderColor: '#329BCB',
335-
borderRadius: 60,
335+
borderRadius: 50,
336336
},
337337
otherMonth: {
338-
borderRadius: 60,
338+
borderRadius: 50,
339339
},
340340
dayText: {
341341
textAlign: 'center',

packages/core/src/CardCollapse/README.md

Lines changed: 11 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -56,44 +56,14 @@ export default Demo
5656

5757
### Props
5858

59-
```ts
60-
type CardCollapseProps = ViewProps & {
61-
/**
62-
* 是否折叠
63-
*/
64-
isCollapsed: boolean;
65-
/**
66-
* 渲染的内容
67-
*/
68-
children: JSX.Element | JSX.Element[]
69-
/**
70-
* 外层样式
71-
*/
72-
containerStyle?: StyleProp<ViewStyle>;
73-
/**
74-
* 内容样式
75-
*/
76-
contentContainerStyle?: StyleProp<ViewStyle>;
77-
/**
78-
* 卡片圆角
79-
*/
80-
itemBorderRadius?: number;
81-
/**
82-
* 点击卡片回调
83-
*/
84-
onItemPress?: (index: number) => void;
85-
/**
86-
* 卡片折叠回调(值是未来折叠状态)
87-
*/
88-
onCollapseWillChange?: (changed: boolean) => void;
89-
/**
90-
* 卡片折叠回调(值是目前状态)
91-
*/
92-
onCollapseChanged?: (changed: boolean) => void;
93-
/**
94-
* 卡片是否可以点击
95-
*/
96-
disablePresses?: boolean;
97-
};
98-
```
99-
59+
| 参数 | 说明 | 类型 | 默认值 |
60+
|------|------|-----|------|
61+
| `isCollapsed` | 是否折叠 | `boolean` | - |
62+
| `children` | 渲染的内容 | `JSX.Element, JSX.Element[]` | - |
63+
| `containerStyle` | 外层样式 | `StyleProp<ViewStyle>` | - |
64+
| `contentContainerStyle` | 内容样式 | `StyleProp<ViewStyle>` | - |
65+
| `itemBorderRadius` | 卡片圆角 | `number` | - |
66+
| `onItemPress` | 点击卡片回调 | (`index: number) => void` | - |
67+
| `onCollapseWillChange` | 卡片折叠回调(值是未来折叠状态) | `(changed: boolean) => void` | - |
68+
| `onCollapseChanged` | 卡片折叠回调(值是目前状态) | `(changed: boolean) => void` | - |
69+
| `disablePresses` | 卡片是否可以点击 | `boolean` | - |

packages/core/src/ImageViewer/README.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,11 @@ export default Demo
6262

6363
### props
6464

65-
```ts
66-
export interface ImageViewerProps extends ViewProps {
67-
/** 图片宽度 */
68-
width?: number,
69-
/** 图片高度 */
70-
height?: number,
71-
/** 图像源(远程URL或本地文件资源 */
72-
src?: string | number;
73-
/** 默认展示第几张图片 */
74-
defaultIndex: number
75-
}
76-
```
65+
组件继承 [`ViewProps`](https://reactnative.dev/docs/view)
66+
67+
| 参数 | 说明 | 类型 | 默认值 |
68+
|------|------|-----|------|
69+
| `width` | 图片宽度 | `number` | - |
70+
| `height` | 图片高度 | `number` | - |
71+
| `src` | 图像源(远程URL或本地文件资源) | `'string' \| 'number'` | - |
72+
| `defaultIndex` | 默认展示第几张图片 | `number` | - |

packages/core/src/NoticeBar/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const NoticeBar = (props: NoticeBarProps) => {
4040
operationDom = <View style={styles.actionWrap}>{action ? action : <Text style={[styles.link]}></Text>}</View>;
4141
}
4242
const main = (
43-
<View style={[styles.notice, style]}>
43+
<View style={[styles.notice, style]} testID="RNE__NoticeBar__style">
4444
{icon && <View style={styles.left15}>{icon}</View>}
4545
<View style={[styles.container, icon ? styles.left6 : styles.left15]}>
4646
<Marquee style={[styles.content, textStyle]} text={children} {...marqueeProps} />
@@ -54,7 +54,7 @@ const NoticeBar = (props: NoticeBarProps) => {
5454
mode === 'closable' ? (
5555
main
5656
) : (
57-
<TouchableWithoutFeedback onPress={onPress}>{main}</TouchableWithoutFeedback>
57+
<TouchableWithoutFeedback onPress={onPress} testID="RNE__NoticeBar__link" >{main}</TouchableWithoutFeedback>
5858
)
5959
) : null}
6060
</View>

packages/core/src/Picker/README.md

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -61,45 +61,16 @@ function Demo() {
6161
export default Demo
6262
```
6363

64-
65-
6664
### Props
6765

68-
```ts
69-
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
70-
71-
export interface PickerData {
72-
label?: string,
73-
render?: (key: string, record: PickerData, index: number)=>React.ReactNode,
74-
[key: string]: any
75-
}
66+
属性 | 说明 | 类型 | 默认值
67+
----|-----|------|------
68+
| lines | 显示行数 | number | 3 |
69+
| rowKey | 在开始位置设置图标 | string | - |
70+
| data | 需要渲染的数据 | Array | - |
71+
| containerStyle | item 容器样式 | obj | - |
72+
| textStyle | 容器的文本样式 | TextStyle | - |
73+
| value | 选中当前项的下标 | number | - |
74+
| onChange | value 改变时触发 | fn | - |
75+
| readonly | 是否只读 | fn | - |
7676

77-
export interface PickerProps {
78-
/** 显示几行, 默认 3 */
79-
lines?: number,
80-
/** 指定需要显示的 key, 默认使用 data 的 label 属性 */
81-
rowKey?: string,
82-
/** 需要渲染的数据 */
83-
data?: Array<PickerData>,
84-
/** item 容器样式 */
85-
containerStyle?: {
86-
/** 激活的容器样式 */
87-
actived?: StyleProp<ViewStyle>,
88-
/** 未激活的容器样式 */
89-
unactived?: StyleProp<ViewStyle>,
90-
},
91-
/** 容器的文本样式 */
92-
textStyle?: {
93-
/** 激活的文本样式 */
94-
actived?: StyleProp<TextStyle>,
95-
/** 未激活的文本样式 */
96-
unactived?: StyleProp<TextStyle>,
97-
},
98-
/** 选中当前项的下标 */
99-
value?: number,
100-
/** value 改变时触发 */
101-
onChange?: (value: number)=>unknown,
102-
/** 是否只读 不能点击不能滑动但可以通过value控制 */
103-
readonly?: boolean
104-
}
105-
```

0 commit comments

Comments
 (0)