Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/didi/mpx into feat-hover-…
Browse files Browse the repository at this point in the history
…style
  • Loading branch information
shangqunfeng committed Dec 24, 2024
2 parents 1446743 + e8627f1 commit f50320c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class RNIntersectionObserver {

const windowRect = {
top: navigationLayout.y + this.margins.top,
left: navigationLayout.x + this.margins.left,
left: this.margins.left,
right: navigationLayout.width - this.margins.right,
bottom: navigationLayout.y + navigationLayout.height - this.margins.bottom
}
Expand Down
19 changes: 8 additions & 11 deletions packages/core/src/platform/createApp.ios.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import transferOptions from '../core/transferOptions'
import builtInKeysMap from './patch/builtInKeysMap'
import { makeMap, spreadProp, parseUrlQuery, getFocusedNavigation, hasOwn, extend } from '@mpxjs/utils'
import { makeMap, spreadProp, getFocusedNavigation, hasOwn, extend } from '@mpxjs/utils'
import { mergeLifecycle } from '../convertor/mergeLifecycle'
import { LIFECYCLE } from '../platform/patch/lifecycle/index'
import Mpx from '../index'
Expand Down Expand Up @@ -96,14 +96,10 @@ export default function createApp (option, config = {}) {
})

if (!global.__mpxAppLaunched) {
const parsed = Mpx.config.rnConfig.parseAppProps?.(props) || {}
if (parsed.url) {
const { path, queryObj } = parseUrlQuery(parsed.url)
Object.assign(initialRouteRef.current, {
initialRouteName: path.startsWith('/') ? path.slice(1) : path,
initialParams: queryObj
})
}
const { initialRouteName, initialParams } = Mpx.config.rnConfig.parseAppProps?.(props) || {}
initialRouteRef.current.initialRouteName = initialRouteName || initialRouteRef.current.initialRouteName
initialRouteRef.current.initialParams = initialParams || initialRouteRef.current.initialParams

global.__mpxAppOnLaunch = (navigation) => {
global.__mpxAppLaunched = true
const state = navigation.getState()
Expand Down Expand Up @@ -156,7 +152,7 @@ export default function createApp (option, config = {}) {
if (navigation && hasOwn(global.__mpxPageStatusMap, navigation.pageId)) {
global.__mpxPageStatusMap[navigation.pageId] = 'show'
}
} else if (currentState === 'inactive') {
} else if (currentState === 'inactive' || currentState === 'background') {
global.__mpxAppCbs.hide.forEach((cb) => {
cb()
})
Expand Down Expand Up @@ -191,7 +187,8 @@ export default function createApp (option, config = {}) {
// 7.x替换headerBackTitleVisible
// headerBackButtonDisplayMode: 'minimal',
headerBackTitleVisible: false,
headerMode: 'float'
// 安卓上会出现初始化时闪现导航条的问题
headerShown: false
}
if (headerBackImageProps) {
navScreenOpts.headerBackImage = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ const useInnerProps = (
const eventConfig: { [key: string]: string[] } = {}
const config = rawConfig || {
layoutRef: { current: {} },
disableTouch: false,
disableTap: false
}
const removeProps = [
Expand Down Expand Up @@ -317,11 +316,10 @@ const useInnerProps = (
}
}

if (!rawEventKeys.length || config.disableTouch) {
return omit(propsRef.current, removeProps)
}

const events = useMemo(() => {
if (!rawEventKeys.length) {
return {}
}
const transformedEventKeys = rawEventKeys.reduce((acc: string[], key) => {
if (propsRef.current[key]) {
return acc.concat(eventConfig[key])
Expand Down

0 comments on commit f50320c

Please sign in to comment.