Skip to content

Commit 6d90ba9

Browse files
committed
Merge branch 'dev' of https://github.com/uiwjs/react-native-uiw into dev
2 parents 9253fa0 + e631dde commit 6d90ba9

File tree

11 files changed

+176
-164
lines changed

11 files changed

+176
-164
lines changed

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/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/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-
```

packages/core/src/SpeedDial/README.md

Lines changed: 21 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function Demo() {
2424
children={[
2525
{
2626
icon: 'plus',
27-
title: <Text>'Add'</Text>,
27+
title: <Text>Add</Text>,
2828
onPress:()=>console.log('Add')
2929
},
3030
{
@@ -47,57 +47,28 @@ function Demo() {
4747
export default Demo
4848
```
4949

50+
### Props
5051

51-
### SpeedDial Props
52+
| 参数 | 说明 | 类型 | 默认值|
53+
|------|------|-----|------|
54+
| `icon` | 显示的图标 | `string` | `plus` \| `close` |
55+
| `style` | 盒子样式 | `string` | - |
56+
| `bottom` | 初始距离下边位置 | `number` | 350 |
57+
| `right` | 初始距离右边位置 | `number` | 40 |
58+
| `children` | 展开显示的标记 | Array<`SpeedDialItemProps`> | - |
59+
| `isDrag` | 是否支持拖拽 | `boolean` | `false` |
60+
| `transitionDuration` | 动画时间 | `number` | 200 |
61+
| `onOpen` | 打开时触发 | Function | - |
62+
| `onClose` | 关闭时触发 | Function | - |
5263

53-
```ts
54-
import { ViewStyle,ViewProps } from 'react-native';
55-
import { icoType,SpeedDialItemProps } from '@uiw/react-native';
56-
57-
export interface SpeedDialProps extends ViewProps {
58-
/** 显示的图标 [默认显示, 展开显示] */
59-
icon?: icoType,
60-
/** 盒子样式 */
61-
style?: ViewStyle,
62-
/** 初始距离下边位置 */
63-
bottom?: number, //
64-
/** 初始距离右边位置 */
65-
right?: number, //
66-
/** 展开显示的标记 */
67-
children?: Array<SpeedDialItemProps>,
68-
/** 是否支持拖拽 */
69-
isDrag?: boolean,
70-
/** 动画时间 */
71-
transitionDuration?: number,
72-
/**
73-
* 打开时触发
74-
*/
75-
onOpen?: Function,
76-
/**
77-
* 关闭时触发
78-
*/
79-
onClose?: Function,
80-
}
81-
```
8264

65+
### SpeedDialItemProps
8366

84-
### SpeedDialItem Props
67+
| 参数 | 说明 | 类型 | 默认值|
68+
|------|------|-----|------|
69+
| `icon` | 右边显示的图标 | `string` | - |
70+
| `title` | 左边文字 | `JSX.Element` \| `string` \| `number` | - |
71+
| `titleStyle` | 左边文字盒子样式 | ViewStyle | - |
72+
| `iconStyle` | 右边图标盒子样式 | ViewStyle | - |
73+
| `onPress` | 点击右边时触发 | Function | - |
8574

86-
```ts
87-
import { TabsItemIconTypes,IconsName } from '@uiw/react-native';
88-
89-
export interface SpeedDialItemProps {
90-
/** 右边 显示的图标 */
91-
icon: TabsItemIconTypes,
92-
/** 左边文字 */
93-
title: JSX.Element | string | number,
94-
/** 左边文字盒子样式 */
95-
titleStyle?: ViewStyle,
96-
/** 右边图标盒子样式 */
97-
iconStyle?: ViewStyle,
98-
/**
99-
* 点击右边时触发
100-
*/
101-
onPress?: Function,
102-
}
103-
```

packages/core/src/SwipeAction/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,36 @@ import React,{ useRef } from 'react';
101101
import {SwipeAction} from '@uiw/react-native';
102102
import { View,Text } from 'react-native'
103103

104+
function Demo() {
105+
const ref = useRef()
106+
const right = [
107+
{
108+
text: '查看',
109+
color: 'orange',
110+
x: 250,
111+
},
112+
{
113+
text: '删除',
114+
color: 'red',
115+
x: 250,
116+
},
117+
];
118+
return (
119+
<SwipeAction ref={ref} buttonWidth={60} right={right}>
120+
<View><Text>滑动</Text></View>
121+
</SwipeAction>
122+
);
123+
}
124+
export default Demo;
125+
```
126+
127+
### 禁用
128+
129+
```jsx
130+
import React,{ useRef } from 'react';
131+
import {SwipeAction} from '@uiw/react-native';
132+
import { View,Text } from 'react-native'
133+
104134
function Demo() {
105135
const ref = useRef()
106136
const right = [

packages/core/src/TextArea/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,29 @@ function Demo() {
112112
export default Demo
113113
```
114114

115+
### 根据内容自动调整高度
116+
117+
```jsx mdx:preview
118+
import React, { useState } from 'react';
119+
import TextArea from '@uiw/react-native/lib/TextArea';
120+
121+
function Demo() {
122+
const [value, setValue] = useState('')
123+
124+
return (
125+
<TextArea
126+
value={value}
127+
onChange={(value) => {
128+
setValue(value);
129+
}}
130+
placeholder='请输入'
131+
autoSize
132+
/>
133+
)
134+
}
135+
export default Demo
136+
```
137+
115138
### 自定义输入框样式
116139
```jsx mdx:preview
117140
import React, { useState } from 'react';

0 commit comments

Comments
 (0)