Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix actionsheet 0106 #1803

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open

Fix actionsheet 0106 #1803

wants to merge 38 commits into from

Conversation

wangxiaokou
Copy link
Collaborator

No description provided.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

补充ts声明

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 切换Portal引用
  2. 补充list超过6条返回错误逻辑
  3. 修改bind事件方式,解决安卓点不动问题

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

切换Portal引用

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

解决连点多次执行问题

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 修改Portal引用
  2. 修正toast展示位置

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

配合路由跳转补充的监听事件

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修改引用为内部的Provider

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

portal用的到声明

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 修改portal引用
  2. 补充webview加载失败是兜底展示
  3. 之前合并title丢失代码fix
  4. 解决h5直接back回RN页面,没有走自己的回退逻辑(navigateBack这个除外)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

补充调用的声明

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. RN的调用和web分离
  2. 删掉了getLoadError, 微信小程序文档中没有提供给web该方法

}

useEffect(() => {
const navigation = getFocusedNavigation()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const focusState = useRef(true)
navigation.addListener('focus', ()=>{focusState.current = true})
navigation.addListener('blur', ()=>{focusState.current = false})

_mount(){
if(!focusState.current) return
}

*/
export const portal = new PortalGuard()

const PortalHost = ({ children } :PortalHostProps): JSX.Element => {
Copy link
Collaborator

@hiyuki hiyuki Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const pageId = props.pageId
const isMounted = useRef(false)
const queue=useRef([])
useMemo(()=>{
addEventListener(addType, ({id})=>{
if(id!==pageId) return
if(!isMounted){
queue.push({type:addType})
} else {
manager.add(...)
}
})

addEventListener(removeType, ()=>{
if(!isMounted){
queue.push({type:removeType})
} else {
manager.add(...)
}
})
}, [])

useEffect(()=>{
if(queue.length){
flushQueue(queue)
}

return ()=>{
removeListener(addType)
removeListener(removeType)
}

}, [])

TopViewEventEmitter.emit(updateType, key, e)
}
}
/**
Copy link
Collaborator

@hiyuki hiyuki Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// apiProxy中toast之类需要加的逻辑
function show(){

const currentInstance=getCurrentInstance()
const navigation = getFocusedNavigation()
const id = currentInstance?currentInstance.getPageId():navigation?navigation.pageId:null
if(id === null) {
error('no id')
return
}

portalHost.add({id})
}

}
/**
* portal
*/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

portalHost 的props中传递pageId

manager.current.unmount(operation.key)
}
}
const focusSubscription = navigation.addListener('focus', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不需要了

const navigation = useNavigation()
const pageId = navigation?.pageId
return (
<PortalContext.Consumer>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改成useContext

}
}

const mount = (children: ReactNode, _key?: number) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mount直接使用_mount就可以

const _mount = (children: ReactNode, _key?: number, id?: number) => {
if (id !== pageId) return
const key = _key || _nextKey.current++
if (!isMounted.current) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不需要isMounted了,直接使用manager.current就可以了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants