Skip to content

Feat api adapt iphone duo - #2603

Open
wangxiaokou wants to merge 23 commits into
masterfrom
feat-api-adapt-iphone-duo
Open

wangxiaokou wants to merge 23 commits into
masterfrom
feat-api-adapt-iphone-duo

Conversation

@wangxiaokou

@wangxiaokou wangxiaokou commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

iphone duo下 api-proxy的组件和getWindowInfo适配

- 使用实例 `getPageId()` 获取页面身份;框架不再将内部 pageId 注入页面 id props,节点 id 与页面身份分离。
- 应用内 Screen 提前挂载外层容器,先初始化窗口信息再触发 App 启动回调;页面内部仅保留实例和生命周期,不调用外层 HOC,也不通过 Context 判断是否重复包裹。

## 单组件窗口布局适配 {#standalone-component-layout}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这不是包含在上面的独立页面包裹里了么?


页面身份通过实例的 `getPageId()` 获取;框架不再把内部 `pageId` 注入页面的 `id` props。`id` 仍表示调用方传入的节点标识,不能作为内部页面身份使用。

## 单组件输出的窗口布局适配 {#standalone-component-layout}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

统一走pageWrapperHOC,不需要自己又弄局部方案

const initialWindowMetricsInset = initialWindowMetrics?.insets || {}
const navigationInsets = navigation.insets || {}
const insets = Object.assign({}, initialWindowMetricsInset, navigationInsets)
const bottom = insets.bottom || 0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

不应该走这个,应该走useInsets获取

const { width, height } = Dimensions.get('window')

const showModal = function (options = {}) {
const { width, height } = Dimensions.get('window')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

走customDimension


function showToast (options = {}) {
const dimensionsScreen = Dimensions.get('screen')
const dimensionsWindow = Dimensions.get('window')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

走customDimension

// 计算胶囊按钮的位置
const top = statusBarHeight + MARGIN_TOP
const right = screenWidth - MARGIN_RIGHT
const right = (__mpx_mode__ === 'ios' ? windowWidth : screenWidth) - MARGIN_RIGHT

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

不要给ios写特殊逻辑

callbacks.forEach(cb => cb(result))
}
subscription = __mpx_mode__ === 'ios'
? DeviceEventEmitter.addListener('mpxWindowResize', listener)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

移除这个特殊逻辑,另外返回的window也统一走customDimension

navigation.layout = getLayoutData(headerHeight)
})
return () => dimensionListener?.remove()
const insetsListener = __mpx_mode__ === 'ios' && ReactNative.DeviceEventEmitter.addListener('mpxSafeAreaInsetsChange', metrics => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

移除这些特殊逻辑

)
)
if (__mpx_mode__ === 'ios') {
return createElement('RNCSafeAreaProvider', {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

你这为啥能work???

function getLayoutData (headerHeight) {
const screenDimensions = ReactNative.Dimensions.get('screen')
const windowDimensions = ReactNative.Dimensions.get('window')
const layoutDimensions = ReactNative.Platform.OS === 'ios' ? windowDimensions : screenDimensions

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

不要加特殊逻辑。。。。

@wangxiaokou wangxiaokou reopened this Nov 17, 2026

This branch has not been deployed

No deployments
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.

3 participants