Skip to content

Commit

Permalink
fix(message): 移除 show 回调
Browse files Browse the repository at this point in the history
taro 3.0.0-beta.3 不允许重复出现(link) @tarojs/runtime, 因此删除唯一一处对 runtime 的依赖.
  • Loading branch information
cncolder committed Apr 9, 2020
1 parent 2723d7f commit 327df4a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Message.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useRef, useState, useCallback, useEffect } from 'react'
import Taro, { useDidShow, useDidHide } from '@tarojs/taro'
import React, { useRef, useState, useEffect } from 'react'
import Taro from '@tarojs/taro'
import classNames from 'classnames'
import { View } from '@tarojs/components'

Expand Down Expand Up @@ -39,13 +39,13 @@ export const Message: React.FC<MessageProps> = props => {
return () => Taro.eventCenter.off('atMessage', atMessageHandler)
}, [])

useDidShow(() => {
Taro.eventCenter.on('atMessage', atMessageHandler)
})

useDidHide(() => {
Taro.eventCenter.off('atMessage', atMessageHandler)
})
// TODO taro 3.0.0-beta.3 不允许子包中出现 @tarojs/runtime, link 后 runtime 中提供的 hooks 全部失效.
// useDidShow(() => {
// Taro.eventCenter.on('atMessage', atMessageHandler)
// })
// useDidHide(() => {
// Taro.eventCenter.off('atMessage', atMessageHandler)
// })

return (
<View
Expand Down

0 comments on commit 327df4a

Please sign in to comment.