Skip to content

Commit

Permalink
fix: ios nativestack
Browse files Browse the repository at this point in the history
  • Loading branch information
human committed Jan 14, 2025
1 parent e186b2b commit 48f480f
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions packages/core/src/platform/patch/getDefaultOptions.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,17 +529,13 @@ export function getDefaultOptions ({ type, rawOptions = {}, currentInject }) {
}, [])

const rootRef = useRef(null)

useEffect(() => {
const unsubscribe = navigation.addListener('transitionEnd', (e) => {
setTimeout(() => {
rootRef.current?.measureInWindow((x, y, width, height) => {
navigation.layout = { x, y, width, height }
})
}, 200)
});
return unsubscribe;
}, [navigation]);
const onLayout = useCallback(() => {
setTimeout(() => {
rootRef.current?.measureInWindow((x, y, width, height) => {
navigation.layout = { x, y, width, height }
})
}, 200)
}, [])

const withKeyboardAvoidingView = (element) => {
if (__mpx_mode__ === 'ios') {
Expand Down Expand Up @@ -588,7 +584,8 @@ export function getDefaultOptions ({ type, rawOptions = {}, currentInject }) {
flex: 1,
backgroundColor: pageConfig.backgroundColor || '#ffffff'
},
ref: rootRef
ref: rootRef,
onLayout
},
createElement(RouteContext.Provider,
{
Expand Down

0 comments on commit 48f480f

Please sign in to comment.