Skip to content

Commit

Permalink
refactor(types): sync components types (#242)
Browse files Browse the repository at this point in the history
Co-authored-by: ZakaryCode <[email protected]>
  • Loading branch information
github-actions[bot] and ZakaryCode authored Feb 18, 2024
1 parent cf02ce1 commit 3da153f
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 10 deletions.
2 changes: 2 additions & 0 deletions docs/components/forms/picker.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export default class PagePicker extends Component {

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

| API | 微信小程序 | H5 | React Native | Harmony |
| :---: | :---: | :---: | :---: | :---: |
| PickerStandardProps.headerText | ✔️ | | | |
| PickerStandardProps.mode | ✔️ | ✔️ | ✔️ | |
| PickerStandardProps.disabled | ✔️ | ✔️ | ✔️ | |
| PickerStandardProps.onCancel | ✔️ | ✔️ | ✔️ | |
Expand Down
17 changes: 10 additions & 7 deletions docs/components/page-meta.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,21 @@ function Index () {

### onResizeEventDetail

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

### resizeType

窗口尺寸类型

| 参数 | 类型 | 说明 |
| --- | --- | --- |
| windowWidth | `number` | 窗口宽度 |
| windowHeight | `number` | 窗口高度 |
| 参数 | 类型 | 必填 | 说明 |
| --- | --- | :---: | --- |
| windowWidth | `number` || 窗口宽度 |
| windowHeight | `number` || 窗口高度 |
| screenWidth | `number` || 屏幕宽度 |
| screenHeight | `number` || 屏幕高度 |

### onScrollEventDetail

Expand Down
6 changes: 6 additions & 0 deletions packages/taro-components/types/PageMeta.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ interface PageMetaProps extends StandardProps {
}
declare namespace PageMetaProps {
interface onResizeEventDetail {
/** 设备方向 */
deviceOrientation?: 'portrait' | 'landscape'
/** 窗口尺寸 */
size: resizeType
}
Expand All @@ -73,6 +75,10 @@ declare namespace PageMetaProps {
windowWidth: number
/** 窗口高度 */
windowHeight: number
/** 屏幕宽度 */
screenWidth?: number
/** 屏幕高度 */
screenHeight?: number
}
interface onScrollEventDetail {
scrollTop: number
Expand Down
5 changes: 5 additions & 0 deletions packages/taro-components/types/Picker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import { StyleProp, TextStyle, ViewStyle } from 'react-native'
import { StandardProps, CommonEventFunction, FormItemProps } from './common'
/** 选择器通用参数 */
interface PickerStandardProps extends StandardProps, FormItemProps {
/**
* 选择器的标题,微信小程序中仅安卓可用
* @supported weapp
*/
headerText?: string
/**
* 选择器类型,默认是普通选择器
* @default "selector"
Expand Down
4 changes: 2 additions & 2 deletions packages/taro/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,6 @@ declare namespace Taro {
interface TaroStatic {}
}
declare global {
const defineAppConfig: (config: Taro.Config) => Taro.Config
const definePageConfig: (config: Taro.Config) => Taro.Config
const defineAppConfig: (config: Taro.AppConfig) => Taro.AppConfig
const definePageConfig: (config: Taro.PageConfig) => Taro.Config
}
2 changes: 1 addition & 1 deletion packages/taro/types/taro.config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ declare module './index' {
backgroundColor?: string
/** 下拉背景字体、loading 图的样式,仅支持 dark/light
* 当 app.json 中配置 darkmode 为 true 时可通过变量的形式配置
* @see: https://developers.weixin.qq.com/miniprogram/dev/framework/ability/darkmode.html
* @see: https://developers.weixin.qq.com/miniprogram/dev/framework/ability/darkmode.html
* @default: "dark"
*/
backgroundTextStyle?: 'dark' | 'light' | string
Expand Down
3 changes: 3 additions & 0 deletions packages/taro/types/taro.lifecycle.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ declare module './index' {
}

interface PageResizeObject {
deviceOrientation?: 'portrait' | 'landscape'
size: {
windowWidth: number
windowHeight: number
screenWidth?: number
screenHeight?: number
}
}

Expand Down

0 comments on commit 3da153f

Please sign in to comment.