Skip to content

fix: update workaround preventing React Native from hiding frozen screens to work with RN 0.78 #2778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/components/Screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
viewConfig: {
validAttributes: {
style: {
display: boolean;
display: boolean | null;
};
};
};
_viewConfig: {
validAttributes: {
style: {
display: boolean;
display: boolean | null;
};
};
};
Expand Down Expand Up @@ -165,7 +165,7 @@
React.useImperativeHandle(ref, () => innerRef.current!, []);
const prevActivityState = usePrevious(props.activityState);

const setRef = (ref: ViewConfig) => {

Check warning on line 168 in src/components/Screen.tsx

View workflow job for this annotation

GitHub Actions / install-and-lint

'ref' is already declared in the upper scope on line 163 column 31
innerRef.current = ref;
props.onComponentRef?.(ref);
};
Expand Down Expand Up @@ -234,7 +234,7 @@
gestureResponseDistance,
onGestureCancel,
style,
...props

Check warning on line 237 in src/components/Screen.tsx

View workflow job for this annotation

GitHub Actions / install-and-lint

'props' is already declared in the upper scope on line 163 column 24
} = rest;

if (active !== undefined && activityState === undefined) {
Expand All @@ -256,17 +256,19 @@
}
}

const handleRef = (ref: ViewConfig) => {

Check warning on line 259 in src/components/Screen.tsx

View workflow job for this annotation

GitHub Actions / install-and-lint

'ref' is already declared in the upper scope on line 163 column 31
// Workaround is necessary to prevent React Native from hiding frozen screens.
// See this PR: https://github.com/grahammendick/navigation/pull/860
if (ref?.viewConfig?.validAttributes?.style) {
ref.viewConfig.validAttributes.style = {
...ref.viewConfig.validAttributes.style,
display: false,
display: null,
};
setRef(ref);
} else if (ref?._viewConfig?.validAttributes?.style) {
ref._viewConfig.validAttributes.style = {
...ref._viewConfig.validAttributes.style,
display: false,
display: null,
};
setRef(ref);
}
Expand Down Expand Up @@ -357,7 +359,7 @@
style,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
onComponentRef,
...props

Check warning on line 362 in src/components/Screen.tsx

View workflow job for this annotation

GitHub Actions / install-and-lint

'props' is already declared in the upper scope on line 163 column 24
} = rest;

if (active !== undefined && activityState === undefined) {
Expand All @@ -365,7 +367,7 @@
}
return (
<Animated.View
style={[style, { display: activityState !== 0 ? 'flex' : 'none' }]}

Check warning on line 370 in src/components/Screen.tsx

View workflow job for this annotation

GitHub Actions / install-and-lint

Inline style: { display: "activityState !== 0 ? 'flex' : 'none'" }
ref={setRef}
{...props}
/>
Expand Down
Loading