Skip to content

Commit

Permalink
Merge branch 'master' into bugfix-hjw-241220
Browse files Browse the repository at this point in the history
  • Loading branch information
hiyuki authored Dec 23, 2024
2 parents b6f616c + f9a64b4 commit e39567f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 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
5 changes: 3 additions & 2 deletions packages/core/src/platform/createApp.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,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 +191,8 @@ export default function createApp (option, config = {}) {
// 7.x替换headerBackTitleVisible
// headerBackButtonDisplayMode: 'minimal',
headerBackTitleVisible: false,
headerMode: 'float'
// 安卓上会出现初始化时闪现导航条的问题
headerShown: false
}
if (headerBackImageProps) {
navScreenOpts.headerBackImage = () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/platform/patch/getDefaultOptions.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as ReactNative from 'react-native'
import { ReactiveEffect } from '../../observer/effect'
import { watch } from '../../observer/watch'
import { reactive, set, del } from '../../observer/reactive'
import { hasOwn, isFunction, noop, isObject, isArray, getByPath, collectDataset, hump2dash, wrapMethodsWithErrorHandling } from '@mpxjs/utils'
import { hasOwn, isFunction, noop, isObject, isArray, getByPath, collectDataset, hump2dash, callWithErrorHandling, wrapMethodsWithErrorHandling } from '@mpxjs/utils'
import MpxProxy from '../../core/proxy'
import { BEFOREUPDATE, ONLOAD, UPDATED, ONSHOW, ONHIDE, ONRESIZE, REACTHOOKSEXEC } from '../../core/innerLifecycle'
import mergeOptions from '../../core/mergeOptions'
Expand Down Expand Up @@ -52,7 +52,7 @@ function createEffect (proxy, components) {
proxy.effect = new ReactiveEffect(() => {
// reset instance
proxy.target.__resetInstance()
return proxy.target.__injectedRender(innerCreateElement, getComponent)
return callWithErrorHandling(proxy.target.__injectedRender.bind(proxy.target), proxy, 'render function', [innerCreateElement, getComponent])
}, () => queueJob(update), proxy.scope)
// render effect允许自触发
proxy.toggleRecurse(true)
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/errorHandling.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function callWithErrorHandling (fn, instance, info, args) {
}

export function wrapMethodsWithErrorHandling (methods, instance) {
if (process.env.NODE_ENV === 'production') return methods
// if (process.env.NODE_ENV === 'production') return methods
const newMethods = {}
Object.keys(methods).forEach((key) => {
if (isFunction(methods[key])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type { AnimationProp } from './useAnimationHooks'
import { ExtendedViewStyle } from './types/common'
import useNodesRef, { HandlerRef } from './useNodesRef'
import { parseUrl, PERCENT_REGEX, splitStyle, splitProps, useTransformStyle, wrapChildren, useLayout, renderImage, pickStyle, extendObject } from './utils'
import { error } from '@mpxjs/utils'
import LinearGradient from 'react-native-linear-gradient'

export interface _ViewProps extends ViewProps {
Expand Down Expand Up @@ -716,7 +717,7 @@ const _View = forwardRef<HandlerRef<View, _ViewProps>, _ViewProps>((viewProps, r
enableBackground = enableBackground || !!backgroundStyle
const enableBackgroundRef = useRef(enableBackground)
if (enableBackgroundRef.current !== enableBackground) {
throw new Error('[Mpx runtime error]: background use should be stable in the component lifecycle, or you can set [enable-background] with true.')
error('[Mpx runtime error]: background use should be stable in the component lifecycle, or you can set [enable-background] with true.')
}

const nodeRef = useRef(null)
Expand Down Expand Up @@ -774,9 +775,9 @@ const _View = forwardRef<HandlerRef<View, _ViewProps>, _ViewProps>((viewProps, r
enableAnimation = enableAnimation || !!animation
const enableAnimationRef = useRef(enableAnimation)
if (enableAnimationRef.current !== enableAnimation) {
throw new Error('[Mpx runtime error]: animation use should be stable in the component lifecycle, or you can set [enable-animation] with true.')
error('[Mpx runtime error]: animation use should be stable in the component lifecycle, or you can set [enable-animation] with true.')
}
const finalStyle = enableAnimation
const finalStyle = enableAnimationRef.current
? [viewStyle, useAnimationHooks({
animation,
style: viewStyle
Expand Down

0 comments on commit e39567f

Please sign in to comment.