Conversation
Collaborator
Blackgan3
commented
Mar 29, 2025
- 抽离公共PageWrapper组件,提供给独立组件输出使用
- global navigationHelper改为运行时注入
hiyuki
reviewed
Mar 31, 2025
hiyuki
reviewed
Mar 31, 2025
| import { IntersectionObserverContext, RouteContext, KeyboardAvoidContext } from '@mpxjs/webpack-plugin/lib/runtime/components/react/dist/context' | ||
| import KeyboardAvoidingView from '@mpxjs/webpack-plugin/lib/runtime/components/react/dist/KeyboardAvoidingView' | ||
| import { IntersectionObserverContext, RouteContext } from '@mpxjs/webpack-plugin/lib/runtime/components/react/dist/context' | ||
| import PageWrapper from './pageWrapper' |
Collaborator
There was a problem hiding this comment.
不用迁移出去,就留在当前模块内作为一个named export就可以
hiyuki
reviewed
Mar 31, 2025
|
|
||
| if (type === 'page') { | ||
| const { PortalHost, useSafeAreaInsets, GestureHandlerRootView, useHeaderHeight } = global.__navigationHelper | ||
| const pageConfig = Object.assign({}, global.__mpxPageConfig, currentInject.pageConfig) |
Collaborator
There was a problem hiding this comment.
global.__mpxPageConfig的合入放在pageWrapper中
hiyuki
reviewed
Mar 31, 2025
| return ({ navigation, route }) => createElement( | ||
| PageWrapper, { | ||
| pageConfig, | ||
| pageStatusMap, |
hiyuki
reviewed
Apr 1, 2025
| pageId: currentPageId | ||
| }) | ||
|
|
||
| if (navigation) { |
hiyuki
reviewed
Apr 1, 2025
| createElement(PortalHost, | ||
| null, | ||
| // 组件单独使用时传递children可能为 element 元素 | ||
| isValidElement(children) |
hiyuki
reviewed
Apr 1, 2025
| import { SafeAreaProvider, useSafeAreaInsets } from 'react-native-safe-area-context' | ||
| import { GestureHandlerRootView } from 'react-native-gesture-handler' | ||
|
|
||
| export { |
Collaborator
There was a problem hiding this comment.
放到env/navigationHelper.ios/android.js里去吧
# Conflicts: # packages/core/src/platform/patch/getDefaultOptions.ios.js
# Conflicts: # packages/core/src/platform/patch/getDefaultOptions.ios.js
hiyuki
reviewed
Apr 8, 2025
| )) | ||
| } | ||
| } | ||
|
|
Collaborator
There was a problem hiding this comment.
const pageWrapper = (component)=>{
return (props)=>{
createElement(component, {...props, navigation, route,id})
}
}
const page = (props)=>{
return ...
}
const page2 =pageWrapper(page)
hiyuki
reviewed
Apr 8, 2025
| // todo custom portal host for active route | ||
| } | ||
| return Page | ||
| currentInjectPageConfig = currentInject.pageConfig |
hiyuki
reviewed
Apr 8, 2025
| const currentPageConfig = Object.assign({}, global.__mpxPageConfig, currentInjectPageConfig, pageConfig) | ||
| if (!navigation || !route) { | ||
| // 独立组件使用时要求传递navigation | ||
| error('Using pageWrapper requires passing navigation and route') |
hiyuki
approved these changes
Apr 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.