Skip to content

Commit 3da153f

Browse files
refactor(types): sync components types (#242)
Co-authored-by: ZakaryCode <ZakaryCode@users.noreply.github.com>
1 parent cf02ce1 commit 3da153f

File tree

7 files changed

+29
-10
lines changed

7 files changed

+29
-10
lines changed

docs/components/forms/picker.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ export default class PagePicker extends Component {
166166

167167
| 参数 | 类型 | 默认值 | 必填 | 说明 |
168168
| --- | --- | :---: | :---: | --- |
169+
| headerText | `string` | || 选择器的标题,微信小程序中仅安卓可用 |
169170
| mode | `keyof Mode` | `"selector"` || 选择器类型,默认是普通选择器 |
170171
| disabled | `boolean` | `false` || 是否禁用 |
171172
| onCancel | `CommonEventFunction` | || 取消选择或点遮罩层收起 picker 时触发 |
@@ -174,6 +175,7 @@ export default class PagePicker extends Component {
174175

175176
| API | 微信小程序 | H5 | React Native | Harmony |
176177
| :---: | :---: | :---: | :---: | :---: |
178+
| PickerStandardProps.headerText | ✔️ | | | |
177179
| PickerStandardProps.mode | ✔️ | ✔️ | ✔️ | |
178180
| PickerStandardProps.disabled | ✔️ | ✔️ | ✔️ | |
179181
| PickerStandardProps.onCancel | ✔️ | ✔️ | ✔️ | |

docs/components/page-meta.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,21 @@ function Index () {
110110

111111
### onResizeEventDetail
112112

113-
| 参数 | 类型 | 说明 |
114-
| --- | --- | --- |
115-
| size | `resizeType` | 窗口尺寸 |
113+
| 参数 | 类型 | 必填 | 说明 |
114+
| --- | --- | :---: | --- |
115+
| deviceOrientation | "portrait" or "landscape" || 设备方向 |
116+
| size | `resizeType` || 窗口尺寸 |
116117

117118
### resizeType
118119

119120
窗口尺寸类型
120121

121-
| 参数 | 类型 | 说明 |
122-
| --- | --- | --- |
123-
| windowWidth | `number` | 窗口宽度 |
124-
| windowHeight | `number` | 窗口高度 |
122+
| 参数 | 类型 | 必填 | 说明 |
123+
| --- | --- | :---: | --- |
124+
| windowWidth | `number` || 窗口宽度 |
125+
| windowHeight | `number` || 窗口高度 |
126+
| screenWidth | `number` || 屏幕宽度 |
127+
| screenHeight | `number` || 屏幕高度 |
125128

126129
### onScrollEventDetail
127130

packages/taro-components/types/PageMeta.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ interface PageMetaProps extends StandardProps {
6464
}
6565
declare namespace PageMetaProps {
6666
interface onResizeEventDetail {
67+
/** 设备方向 */
68+
deviceOrientation?: 'portrait' | 'landscape'
6769
/** 窗口尺寸 */
6870
size: resizeType
6971
}
@@ -73,6 +75,10 @@ declare namespace PageMetaProps {
7375
windowWidth: number
7476
/** 窗口高度 */
7577
windowHeight: number
78+
/** 屏幕宽度 */
79+
screenWidth?: number
80+
/** 屏幕高度 */
81+
screenHeight?: number
7682
}
7783
interface onScrollEventDetail {
7884
scrollTop: number

packages/taro-components/types/Picker.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ import { StyleProp, TextStyle, ViewStyle } from 'react-native'
33
import { StandardProps, CommonEventFunction, FormItemProps } from './common'
44
/** 选择器通用参数 */
55
interface PickerStandardProps extends StandardProps, FormItemProps {
6+
/**
7+
* 选择器的标题,微信小程序中仅安卓可用
8+
* @supported weapp
9+
*/
10+
headerText?: string
611
/**
712
* 选择器类型,默认是普通选择器
813
* @default "selector"

packages/taro/types/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,6 @@ declare namespace Taro {
191191
interface TaroStatic {}
192192
}
193193
declare global {
194-
const defineAppConfig: (config: Taro.Config) => Taro.Config
195-
const definePageConfig: (config: Taro.Config) => Taro.Config
194+
const defineAppConfig: (config: Taro.AppConfig) => Taro.AppConfig
195+
const definePageConfig: (config: Taro.PageConfig) => Taro.Config
196196
}

packages/taro/types/taro.config.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ declare module './index' {
3434
backgroundColor?: string
3535
/** 下拉背景字体、loading 图的样式,仅支持 dark/light
3636
* 当 app.json 中配置 darkmode 为 true 时可通过变量的形式配置
37-
* @see: https://developers.weixin.qq.com/miniprogram/dev/framework/ability/darkmode.html
37+
* @see: https://developers.weixin.qq.com/miniprogram/dev/framework/ability/darkmode.html
3838
* @default: "dark"
3939
*/
4040
backgroundTextStyle?: 'dark' | 'light' | string

packages/taro/types/taro.lifecycle.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,12 @@ declare module './index' {
5656
}
5757

5858
interface PageResizeObject {
59+
deviceOrientation?: 'portrait' | 'landscape'
5960
size: {
6061
windowWidth: number
6162
windowHeight: number
63+
screenWidth?: number
64+
screenHeight?: number
6265
}
6366
}
6467

0 commit comments

Comments
 (0)