Skip to content

Commit 1676906

Browse files
authored
feat: 增加支付宝小程序 Page.events useKeyboardHeight (#18260)
* feat: 增加支付宝小程序 Page.events useKeyboardHeight * test: 在多个快照测试中添加 useKeyboardHeight 函数 * fix: 更新 PageInstance 接口,添加 events 属性以支持支付宝小程序事件
1 parent 4a44051 commit 1676906

File tree

31 files changed

+85
-6
lines changed

31 files changed

+85
-6
lines changed

examples/mini-program-example/src/pages/api/taro/hooks/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ export default class Index extends React.Component {
9696
id: 'useOptionMenuClick',
9797
func: null,
9898
},
99+
{
100+
id: 'useKeyboardHeight',
101+
func: null,
102+
},
99103
{
100104
id: 'usePullIntercept',
101105
func: null,

packages/shared/src/runtime-hooks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ const defaultMiniLifecycle: MiniLifecycle = {
9595
'defer:onTabItemTap', // defer: 需要等页面组件挂载后再调用
9696
'onTitleClick',
9797
'onOptionMenuClick',
98+
'events:onKeyboardHeight', // events: 支付宝平台需要挂载到 config.events 上
9899
'onPopMenuClick',
99100
'onPullIntercept',
100101
'onAddToFavorites'

packages/taro-framework-react/src/api-loader.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export default function (str: string) {
77
useLaunch,
88
useLoad,
99
useOptionMenuClick,
10+
useKeyboardHeight,
1011
usePageNotFound,
1112
usePageScroll,
1213
usePullDownRefresh,
@@ -33,6 +34,7 @@ taro.useError = useError
3334
taro.useLaunch = useLaunch
3435
taro.useLoad = useLoad
3536
taro.useOptionMenuClick = useOptionMenuClick
37+
taro.useKeyboardHeight = useKeyboardHeight
3638
taro.usePageNotFound = usePageNotFound
3739
taro.usePageScroll = usePageScroll
3840
taro.usePullDownRefresh = usePullDownRefresh
@@ -58,6 +60,7 @@ export {
5860
useLaunch,
5961
useLoad,
6062
useOptionMenuClick,
63+
useKeyboardHeight,
6164
usePageNotFound,
6265
usePageScroll,
6366
usePullDownRefresh,

packages/taro-framework-react/src/runtime/hooks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export const useUnload = createTaroHook('onUnload')
7878
/** Mini-Program */
7979
export const useAddToFavorites = createTaroHook('onAddToFavorites')
8080
export const useOptionMenuClick = createTaroHook('onOptionMenuClick')
81+
export const useKeyboardHeight = createTaroHook('onKeyboardHeight')
8182
export const useSaveExitState = createTaroHook('onSaveExitState')
8283
export const useShareAppMessage = createTaroHook('onShareAppMessage')
8384
export const useShareTimeline = createTaroHook('onShareTimeline')

packages/taro-framework-solid/src/api-loader.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export default function (str: string) {
77
useLaunch,
88
useLoad,
99
useOptionMenuClick,
10+
useKeyboardHeight,
1011
usePageNotFound,
1112
usePageScroll,
1213
usePullDownRefresh,
@@ -33,6 +34,7 @@ taro.useError = useError
3334
taro.useLaunch = useLaunch
3435
taro.useLoad = useLoad
3536
taro.useOptionMenuClick = useOptionMenuClick
37+
taro.useKeyboardHeight = useKeyboardHeight
3638
taro.usePageNotFound = usePageNotFound
3739
taro.usePageScroll = usePageScroll
3840
taro.usePullDownRefresh = usePullDownRefresh
@@ -58,6 +60,7 @@ export {
5860
useLaunch,
5961
useLoad,
6062
useOptionMenuClick,
63+
useKeyboardHeight,
6164
usePageNotFound,
6265
usePageScroll,
6366
usePullDownRefresh,

packages/taro-framework-solid/src/runtime/hooks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export const useUnload = createTaroHook('onUnload')
7979
/** Mini-Program */
8080
export const useAddToFavorites = createTaroHook('onAddToFavorites')
8181
export const useOptionMenuClick = createTaroHook('onOptionMenuClick')
82+
export const useKeyboardHeight = createTaroHook('onKeyboardHeight')
8283
export const useSaveExitState = createTaroHook('onSaveExitState')
8384
export const useShareAppMessage = createTaroHook('onShareAppMessage')
8485
export const useShareTimeline = createTaroHook('onShareTimeline')

packages/taro-framework-vue3/src/api-loader.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export default function (str: string) {
88
useLaunch,
99
useLoad,
1010
useOptionMenuClick,
11+
useKeyboardHeight,
1112
usePageNotFound,
1213
usePageScroll,
1314
usePullDownRefresh,
@@ -35,6 +36,7 @@ taro.useLaunch = useLaunch
3536
taro.setGlobalDataPlugin = setGlobalDataPlugin
3637
taro.useLoad = useLoad
3738
taro.useOptionMenuClick = useOptionMenuClick
39+
taro.useKeyboardHeight = useKeyboardHeight
3840
taro.usePageNotFound = usePageNotFound
3941
taro.usePageScroll = usePageScroll
4042
taro.usePullDownRefresh = usePullDownRefresh
@@ -60,6 +62,7 @@ export {
6062
useLaunch,
6163
useLoad,
6264
useOptionMenuClick,
65+
useKeyboardHeight,
6366
usePageNotFound,
6467
usePageScroll,
6568
usePullDownRefresh,

packages/taro-framework-vue3/src/runtime/composition-functions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export const useUnload = createTaroHook('onUnload')
8181
/** Mini-Program */
8282
export const useAddToFavorites = createTaroHook('onAddToFavorites')
8383
export const useOptionMenuClick = createTaroHook('onOptionMenuClick')
84+
export const useKeyboardHeight = createTaroHook('onKeyboardHeight')
8485
export const useSaveExitState = createTaroHook('onSaveExitState')
8586
export const useShareAppMessage = createTaroHook('onShareAppMessage')
8687
export const useShareTimeline = createTaroHook('onShareTimeline')

packages/taro-platform-harmony-cpp/src/runtime/framework/hooks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export const useUnload = createTaroHook('onUnload')
8383
/** Mini-Program */
8484
export const useAddToFavorites = createTaroHook('onAddToFavorites')
8585
export const useOptionMenuClick = createTaroHook('onOptionMenuClick')
86+
export const useKeyboardHeight = createTaroHook('onKeyboardHeight')
8687
export const useSaveExitState = createTaroHook('onSaveExitState')
8788
export const useShareAppMessage = createTaroHook('onShareAppMessage')
8889
export const useShareTimeline = createTaroHook('onShareTimeline')

packages/taro-platform-harmony/src/runtime-framework/react/hooks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export const useUnload = createTaroHook('onUnload')
8484
/** Mini-Program */
8585
export const useAddToFavorites = createTaroHook('onAddToFavorites')
8686
export const useOptionMenuClick = createTaroHook('onOptionMenuClick')
87+
export const useKeyboardHeight = createTaroHook('onKeyboardHeight')
8788
export const useSaveExitState = createTaroHook('onSaveExitState')
8889
export const useShareAppMessage = createTaroHook('onShareAppMessage')
8990
export const useShareTimeline = createTaroHook('onShareTimeline')

0 commit comments

Comments
 (0)