-
Notifications
You must be signed in to change notification settings - Fork 382
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
base: master
Are you sure you want to change the base?
Fix actionsheet 0106 #1803
Conversation
packages/api-proxy/@types/index.d.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
补充ts声明
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 切换Portal引用
- 补充list超过6条返回错误逻辑
- 修改bind事件方式,解决安卓点不动问题
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
切换Portal引用
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
解决连点多次执行问题
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 修改Portal引用
- 修正toast展示位置
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
配合路由跳转补充的监听事件
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修改引用为内部的Provider
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
portal用的到声明
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 修改portal引用
- 补充webview加载失败是兜底展示
- 之前合并title丢失代码fix
- 解决h5直接back回RN页面,没有走自己的回退逻辑(navigateBack这个除外)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
补充调用的声明
packages/webview-bridge/src/index.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- RN的调用和web分离
- 删掉了getLoadError, 微信小程序文档中没有提供给web该方法
} | ||
|
||
useEffect(() => { | ||
const navigation = getFocusedNavigation() |
There was a problem hiding this comment.
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 => { |
There was a problem hiding this comment.
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) | ||
} | ||
} | ||
/** |
There was a problem hiding this comment.
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 | ||
*/ |
There was a problem hiding this comment.
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', () => { |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不需要isMounted了,直接使用manager.current就可以了
No description provided.