@mpxjs/core 2.9.69-beta.7 → 2.9.69-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -178,18 +178,23 @@ export default function createApp (options) {
|
|
|
178
178
|
|
|
179
179
|
const { initialRouteName, initialParams } = initialRouteRef.current
|
|
180
180
|
const headerBackImageProps = Mpx.config.rnConfig.headerBackImageProps || null
|
|
181
|
+
const headerBackImageSource = Mpx.config.rnConfig.headerBackImageSource || null
|
|
181
182
|
const navScreenOpts = {
|
|
182
183
|
// 7.x替换headerBackTitleVisible
|
|
183
184
|
// headerBackButtonDisplayMode: 'minimal',
|
|
184
185
|
headerBackTitleVisible: false,
|
|
185
186
|
// 安卓上会出现初始化时闪现导航条的问题
|
|
186
|
-
headerShown: false
|
|
187
|
+
headerShown: false,
|
|
188
|
+
headerShadowVisible: false
|
|
187
189
|
}
|
|
188
190
|
if (headerBackImageProps) {
|
|
189
191
|
navScreenOpts.headerBackImage = () => {
|
|
190
192
|
return createElement(Image, headerBackImageProps)
|
|
191
193
|
}
|
|
192
194
|
}
|
|
195
|
+
if (headerBackImageSource) {
|
|
196
|
+
navScreenOpts.headerBackImageSource = headerBackImageSource
|
|
197
|
+
}
|
|
193
198
|
return createElement(SafeAreaProvider,
|
|
194
199
|
null,
|
|
195
200
|
createElement(NavigationContainer,
|
|
@@ -491,7 +491,7 @@ export function getDefaultOptions ({ type, rawOptions = {}, currentInject }) {
|
|
|
491
491
|
}
|
|
492
492
|
|
|
493
493
|
if (type === 'page') {
|
|
494
|
-
const { Provider, useSafeAreaInsets, GestureHandlerRootView } = global.__navigationHelper
|
|
494
|
+
const { Provider, useSafeAreaInsets, GestureHandlerRootView, useHeaderHeight } = global.__navigationHelper
|
|
495
495
|
const pageConfig = Object.assign({}, global.__mpxPageConfig, currentInject.pageConfig)
|
|
496
496
|
const Page = ({ navigation, route }) => {
|
|
497
497
|
const [enabled, setEnabled] = useState(false)
|
|
@@ -530,17 +530,13 @@ export function getDefaultOptions ({ type, rawOptions = {}, currentInject }) {
|
|
|
530
530
|
}, [])
|
|
531
531
|
|
|
532
532
|
const rootRef = useRef(null)
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
}, 200)
|
|
541
|
-
});
|
|
542
|
-
return unsubscribe;
|
|
543
|
-
}, [navigation]);
|
|
533
|
+
const onLayout = useCallback(() => {
|
|
534
|
+
setTimeout(() => {
|
|
535
|
+
rootRef.current?.measureInWindow((x, y, width, height) => {
|
|
536
|
+
navigation.layout = { x, y, width, height }
|
|
537
|
+
})
|
|
538
|
+
}, 200)
|
|
539
|
+
}, [])
|
|
544
540
|
|
|
545
541
|
const withKeyboardAvoidingView = (element) => {
|
|
546
542
|
if (__mpx_mode__ === 'ios') {
|
|
@@ -575,10 +571,12 @@ export function getDefaultOptions ({ type, rawOptions = {}, currentInject }) {
|
|
|
575
571
|
if (setStateRef.current !== setState) {
|
|
576
572
|
setStateRef.current = setState
|
|
577
573
|
}
|
|
578
|
-
|
|
579
574
|
return createElement(GestureHandlerRootView,
|
|
580
575
|
{
|
|
581
|
-
|
|
576
|
+
// https://github.com/software-mansion/react-native-reanimated/issues/6639 因存在此问题,iOS在页面上进行定宽来暂时规避
|
|
577
|
+
style: __mpx_mode__ === 'ios' && pageConfig.navigationStyle !== 'custom' ? {
|
|
578
|
+
height: ReactNative.Dimensions.get('screen').height - useHeaderHeight()
|
|
579
|
+
} : {
|
|
582
580
|
flex: 1
|
|
583
581
|
}
|
|
584
582
|
},
|
|
@@ -589,7 +587,8 @@ export function getDefaultOptions ({ type, rawOptions = {}, currentInject }) {
|
|
|
589
587
|
flex: 1,
|
|
590
588
|
backgroundColor: pageConfig.backgroundColor || '#ffffff'
|
|
591
589
|
},
|
|
592
|
-
ref: rootRef
|
|
590
|
+
ref: rootRef,
|
|
591
|
+
onLayout
|
|
593
592
|
},
|
|
594
593
|
createElement(RouteContext.Provider,
|
|
595
594
|
{
|