Skip to content

Commit 7f75816

Browse files
authored
Merge pull request #1353 from ant-design/5.2.0-rc.1
5.2.0 rc.1
2 parents 4a99b02 + b3665d6 commit 7f75816

File tree

81 files changed

+10112
-3954
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+10112
-3954
lines changed

.jest.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ const transformPackages = [
88
'react-native-collapsible',
99
'@bang88/react-native-ultimate-listview',
1010
'@react-native-community',
11-
'react-native-gesture-handler'
11+
'react-native-gesture-handler',
12+
'react-native-reanimated'
1213
];
1314

1415
module.exports = {

README.md

Lines changed: 42 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -29,60 +29,23 @@ A configurable Mobile UI specification and React-based implementation.
2929

3030
## Expo
3131

32-
- **Web support**
33-
34-
Preview Web Platform in [[here] 🔗](https://1uokun.github.io/ant-design-mobile-rn/index.html)
32+
> HTML5 Preview: [ant-design-mobile-rn/index.html](https://1uokun.github.io/ant-design-mobile-rn/index.html)
3533
36-
- **Expo demo app**
3734

3835
|SDK 49+|
3936
|--|
4037
| [<img width="250" alt="expo/ant-design-mobile-rn" src="https://qr.expo.dev/eas-update?slug=exp&projectId=7729a68b-f881-4294-89f5-5ae751bfb2b2&groupId=5278146b-c8d6-4c93-8a6b-6f942a2b5fb5" />](https://expo.dev/preview/update?message=5.2.0%20Form%20%26%20Input&updateRuntimeVersion=5.2.0&createdAt=2024-05-24T06%3A10%3A13.909Z&slug=exp&projectId=7729a68b-f881-4294-89f5-5ae751bfb2b2&group=5278146b-c8d6-4c93-8a6b-6f942a2b5fb5) |
4138

39+
Open the camera app on your device and scan the code above, <br>
40+
need install expo app: https://expo.io/tools
41+
4242
<details><summary>Expo SDK history version</summary>
4343

4444
|Expo SDK 44|SDK 47 iOS|SDK 47 Android|
4545
|--|--|--|
4646
| [<img width="250" alt="expo/ant-design-mobile-rn" src="https://qr.expo.dev/expo-go?owner=1uokun&slug=ant-design-mobile-rn&releaseChannel=default&host=exp.host" />](https://expo.dev/@1uokun/ant-design-mobile-rn) | [<img width="250" alt="expo/ant-design-mobile-rn" src="https://qr.expo.dev/eas-update?updateId=38b3a547-ab2b-4066-95ed-400f1707dcc6&appScheme=exp&host=u.expo.dev" />](https://expo.dev/@1uokun/ant-design-mobile-rn) | [<img width="250" alt="expo/ant-design-mobile-rn" src="https://qr.expo.dev/eas-update?updateId=05f0e308-2dd5-4cb9-9e6b-1ae31561bfee&appScheme=exp&host=u.expo.dev" />](https://expo.dev/@1uokun/ant-design-mobile-rn) |
4747
</details>
4848

49-
> Open the camera app on your device and scan the code above, <br>
50-
need install expo app: https://expo.io/tools
51-
52-
## Development
53-
54-
- **Running On Device**
55-
56-
```bash
57-
# clone
58-
git clone git@github.com:ant-design/ant-design-mobile-rn.git
59-
60-
# go to ant rn folder
61-
cd ant-design-mobile-rn
62-
63-
# install dependencies
64-
yarn
65-
66-
# start ios
67-
cd rn-kitchen-sink/ios && pod install
68-
yarn ios
69-
70-
# start android
71-
yarn android
72-
```
73-
74-
- **Running On Expo**
75-
76-
```bash
77-
# go to expo example folder
78-
cd example
79-
80-
# install dependencies
81-
yarn
82-
83-
# start expo
84-
yarn expo
85-
```
8649

8750
## Install & Usage
8851

@@ -123,14 +86,48 @@ then
12386
npx react-native-asset
12487
```
12588

126-
[introduce](docs/react/introduce.en-US.md#2-installation)
127-
12889
## Links
12990

13091
- [Home Page](http://rn.mobile.ant.design)
92+
- [More Introduce >](docs/react/introduce.en-US.md)
13193
- [Developer Instruction](development.en-US.md)
132-
- [React components](http://github.com/react-component/)
133-
- [Demos](https://github.com/ant-design/antd-mobile-samples)
94+
95+
## Development
96+
97+
- **Running On Expo**
98+
99+
> node >= 18
100+
101+
```bash
102+
# go to expo example folder
103+
cd example
104+
105+
# install dependencies
106+
yarn
107+
108+
# start expo
109+
yarn expo
110+
```
111+
112+
- **Running On Device**
113+
114+
```bash
115+
# clone
116+
git clone git@github.com:ant-design/ant-design-mobile-rn.git
117+
118+
# go to ant rn folder
119+
cd ant-design-mobile-rn
120+
121+
# install dependencies
122+
yarn
123+
124+
# start ios
125+
cd rn-kitchen-sink/ios && pod install
126+
yarn ios
127+
128+
# start android
129+
yarn android
130+
```
134131

135132
## Contributing
136133

README.zh-CN.md

Lines changed: 45 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,14 @@ Ant Design 移动端设计规范。`@ant-design/react-native` 是 Ant Design 的
2727

2828
## Expo
2929

30-
- **Web support**
31-
32-
点击[[这里] 🔗 ](https://1uokun.github.io/ant-design-mobile-rn/index.html)预览H5网页版本
30+
> HTML5 预览: [ant-design-mobile-rn/index.html](https://1uokun.github.io/ant-design-mobile-rn/index.html)
3331
34-
- **Expo demo app**
3532

36-
|SDK 49+ iOS|SDK 49+ Android|
37-
|--|--|
38-
| [<img width="250" alt="expo/ant-design-mobile-rn" src="https://qr.expo.dev/eas-update?updateId=91ccee3a-f631-4bdb-b643-e3d01b52a95c&appScheme=exp&host=u.expo.dev" />](https://expo.dev/@1uokun/ant-design-mobile-rn) | [<img width="250" alt="expo/ant-design-mobile-rn" src="https://qr.expo.dev/eas-update?updateId=49a4c02d-5dc0-47b9-a98f-61932a6d4765&appScheme=exp&host=u.expo.dev" />](https://expo.dev/@1uokun/ant-design-mobile-rn) |
33+
|SDK 49+|
34+
|--|
35+
| [<img width="250" alt="expo/ant-design-mobile-rn" src="https://qr.expo.dev/eas-update?slug=exp&projectId=7729a68b-f881-4294-89f5-5ae751bfb2b2&groupId=5278146b-c8d6-4c93-8a6b-6f942a2b5fb5" />](https://expo.dev/preview/update?message=5.2.0%20Form%20%26%20Input&updateRuntimeVersion=5.2.0&createdAt=2024-05-24T06%3A10%3A13.909Z&slug=exp&projectId=7729a68b-f881-4294-89f5-5ae751bfb2b2&group=5278146b-c8d6-4c93-8a6b-6f942a2b5fb5) |
36+
37+
提示:使用本地原相机扫瞄上面的二维码, 需要下载 Expo App: https://expo.io/tools
3938

4039
<details><summary>Expo SDK历史版本</summary>
4140

@@ -44,46 +43,6 @@ Ant Design 移动端设计规范。`@ant-design/react-native` 是 Ant Design 的
4443
| [<img width="250" alt="expo/ant-design-mobile-rn" src="https://qr.expo.dev/expo-go?owner=1uokun&slug=ant-design-mobile-rn&releaseChannel=default&host=exp.host" />](https://expo.dev/@1uokun/ant-design-mobile-rn) | [<img width="250" alt="expo/ant-design-mobile-rn" src="https://qr.expo.dev/eas-update?updateId=38b3a547-ab2b-4066-95ed-400f1707dcc6&appScheme=exp&host=u.expo.dev" />](https://expo.dev/@1uokun/ant-design-mobile-rn) | [<img width="250" alt="expo/ant-design-mobile-rn" src="https://qr.expo.dev/eas-update?updateId=05f0e308-2dd5-4cb9-9e6b-1ae31561bfee&appScheme=exp&host=u.expo.dev" />](https://expo.dev/@1uokun/ant-design-mobile-rn) |
4544
</details>
4645

47-
> 提示:使用本地原相机扫瞄上面的二维码, 需要下载 Expo App: https://expo.io/tools
48-
49-
## 本地演示
50-
51-
- **使用 react-native-cli 运行**
52-
53-
```bash
54-
# clone
55-
git clone git@github.com:ant-design/ant-design-mobile-rn.git
56-
57-
# go to ant rn folder
58-
cd ant-design-mobile-rn
59-
60-
# install dependencies
61-
yarn
62-
63-
# start ios
64-
cd rn-kitchen-sink/ios && pod install
65-
yarn ios
66-
67-
# start android
68-
yarn android
69-
70-
# start expo
71-
yarn expo
72-
```
73-
74-
- **使用 expo-cli 运行**
75-
76-
```bash
77-
# go to expo example folder
78-
cd example
79-
80-
# install dependencies
81-
yarn
82-
83-
# start expo
84-
yarn expo
85-
```
86-
8746
## 安装 & 使用
8847

8948
```bash
@@ -99,20 +58,19 @@ yarn add @ant-design/react-native
9958
### 安装peer依赖
10059

10160
```bash
102-
npm install @react-native-community/segmented-control @react-native-community/slider
61+
npm install @react-native-community/segmented-control @react-native-community/slider @ant-design/icons-react-native react-native-gesture-handler
10362
```
10463

10564
or
10665

10766
```bash
108-
yarn add @react-native-community/segmented-control @react-native-community/slider
67+
yarn add @react-native-community/segmented-control @react-native-community/slider @ant-design/icons-react-native react-native-gesture-handler
10968
```
11069

11170
> 安装完依赖后需要到 iOS 目录 `pod install`(auto linking),Android 不需要手动处理
11271
11372
### 链接字体图标
11473

115-
11674
```js
11775
// 配置根目录下的 `react-native.config.js` 文件
11876
module.exports = {
@@ -125,14 +83,46 @@ module.exports = {
12583
npx react-native-asset
12684
```
12785

128-
[介绍](docs/react/introduce.zh-CN.md#2-安装)
129-
13086
## 链接
13187

13288
- [首页](http://rn.mobile.ant.design)
133-
- [开发文档](development.zh-CN.md)
134-
- [底层 React 模块](http://github.com/react-component)
135-
- [官方 Demo 集合](https://github.com/ant-design/antd-mobile-samples)
89+
- [更详细的安装说明 >](docs/react/introduce.zh-CN.md)
90+
- [开发者文档](development.zh-CN.md)
91+
92+
## 本地演示
93+
94+
- **使用 expo-cli 运行**
95+
96+
```bash
97+
# go to expo example folder
98+
cd example
99+
100+
# install dependencies
101+
yarn
102+
103+
# start expo
104+
yarn expo
105+
```
106+
107+
- **使用 react-native-cli 运行**
108+
109+
```bash
110+
# clone
111+
git clone git@github.com:ant-design/ant-design-mobile-rn.git
112+
113+
# go to ant rn folder
114+
cd ant-design-mobile-rn
115+
116+
# install dependencies
117+
yarn
118+
119+
# start ios
120+
cd rn-kitchen-sink/ios && pod install
121+
yarn ios
122+
123+
# start android
124+
yarn android
125+
```
136126

137127
## 欢迎贡献
138128

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { useEffect, useMemo, useRef } from 'react'
2+
import {
3+
DeviceEventEmitter,
4+
EmitterSubscription,
5+
GestureResponderEvent,
6+
NativeEventEmitter,
7+
} from 'react-native'
8+
9+
export const USE_CLICK_AWAY_EVENT_NAME = 'ANT_DESIGN_MOBILE_RN_USE_CLICK_AWAY'
10+
11+
export default function useClickAway(
12+
onClickAway: (event: GestureResponderEvent) => void,
13+
) {
14+
const TopViewEventEmitter = useMemo(
15+
() => DeviceEventEmitter || new NativeEventEmitter(),
16+
[],
17+
)
18+
19+
const onClickAwayRef = useRef<EmitterSubscription>()
20+
21+
useEffect(() => {
22+
onClickAwayRef.current = TopViewEventEmitter.addListener(
23+
USE_CLICK_AWAY_EVENT_NAME,
24+
onClickAway,
25+
)
26+
return () => {
27+
onClickAwayRef.current?.remove?.()
28+
}
29+
}, [TopViewEventEmitter, onClickAway])
30+
}

components/date-picker-view/index.en-US.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ Properties | Descrition | Type | Default | Version
4545
| filter | Filter available time | `DatePickerFilter` | - | `5.1.0` |
4646
4747
48-
In addition, the following attributes of [PickerView](/components/picker-view) are supported: `style` `styles` `itemStyle` `itemHeight` `numberOfLines` `renderMaskTop` `renderMaskBottom`
48+
In addition, the following properties of [PickerView](/components/picker-view) are supported: `style` `styles` `itemStyle` `itemHeight` `numberOfLines` `renderMaskTop` `renderMaskBottom`

components/date-picker/index.en-US.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ Properties | Descrition | Type | Default | Version
5050
| filter | Filter available time | `DatePickerFilter` | - | `5.1.0` |
5151
5252
53-
In addition, the following attributes of [Picker](/components/picker) are supported: `onPickerChange` `onVisibleChange` `style` `styles` `itemStyle` `itemHeight` `numberOfLines` `title` `okText` `dismissText` `okButtonProps` `dismissButtonProps` `visible` `children` `renderMaskTop` `renderMaskBottom`
53+
In addition, the following properties of [Picker](/components/picker) are supported: `onPickerChange` `onVisibleChange` `style` `styles` `itemStyle` `itemHeight` `numberOfLines` `title` `okText` `dismissText` `okButtonProps` `dismissButtonProps` `visible` `children` `renderMaskTop` `renderMaskBottom`
5454
5555
### Children
56-
Same as [Picker](/components/picker/#Children), except type `format` is different:
56+
Same as [Picker](/components/picker#children), except type `format` is different:
5757
5858
Properties | Descrition | Type | Default
5959
----|-----|------|------
6060
| format | format the selected value |`(value: Date) => date string` | import [Day.js Format](https://day.js.org/docs/en/parse/string-format), precision:`YYYY-MM-DD`,`YYYY-MM-DD HH:mm:ss`|
6161
6262
### Ref
63-
Same as `Picker`
63+
Same as [Picker](/components/picker#ref)

components/date-picker/index.zh-CN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ type DatePickerFilter = Partial<
5454
此外还支持 [Picker](/components/picker-cn) 的以下属性:`onPickerChange` `onVisibleChange` `style` `styles` `itemStyle` `itemHeight` `numberOfLines` `title` `okText` `dismissText` `okButtonProps` `dismissButtonProps` `visible` `children` `renderMaskTop` `renderMaskBottom`
5555
5656
### Children
57-
同 [Picker](/components/picker-cn/#Children),其中`format`类型不同:
57+
同 [Picker](/components/picker-cn#children),其中`format`类型不同:
5858
5959
属性 | 说明 | 类型 | 默认值
6060
----|-----|------|------
6161
| format | 格式化选中的值 |`(value: Date) => date string` | 引用 [Day.js Format](https://day.js.org/docs/en/parse/string-format),参数对应精度:`YYYY-MM-DD`,`YYYY-MM-DD HH:mm:ss`|
6262
6363
### Ref
64-
`Picker`
64+
[Picker](/components/picker-cn#ref)

components/image-picker/index.en-US.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ type: Data Entry
44
title: DatePickerView
55
subtitle: (deprecated)
66
---
7+
8+
Deprecated since `5.1.0`.

components/image-picker/index.zh-CN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ type: Data Entry
44
title: ImagePicker
55
subtitle: 图片选择器(已弃用)
66
---
7+
8+
`5.1.0`开始已弃用。

components/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export { default as Provider } from './provider/index'
3636
export { default as Radio } from './radio/index'
3737
export { default as Result } from './result/index'
3838
export { default as SearchBar } from './search-bar/index'
39-
export { default as SegmentedControl } from './segmented-control/index'
4039
export { default as Slider } from './slider/index'
4140
export { default as Stepper } from './stepper/index'
4241
export { default as Steps } from './steps/index'
@@ -55,3 +54,7 @@ export { default as WingBlank } from './wing-blank/index'
5554
* @deprecated
5655
*/
5756
export class ImagePicker {}
57+
/**
58+
* @deprecated
59+
*/
60+
export class SegmentedControl {}

0 commit comments

Comments
 (0)