-
-
Notifications
You must be signed in to change notification settings - Fork 533
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
Unresponsive modal when RefreshControl used with iOS modal and header hidden #2586
Comments
Confirming the issue, thanks for the report! |
I do not understand the error mechanism yet, nor do I understand why setting Following patch to diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm
index 3a5679ea5dd..f9bad6c23c2 100644
--- a/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm
+++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm
@@ -148,9 +148,13 @@ using namespace facebook::react;
{
[super didMoveToWindow];
if (self.window) {
- [self _attach];
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0), dispatch_get_main_queue(), ^{
+ [self _attach];
+ });
} else {
- [self _detach];
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0), dispatch_get_main_queue(), ^{
+ [self _detach];
+ });
}
} @chvanlennep in case it's urgent, you can patch react-native, you build this code anyway. |
New finding: this also affects standard react-native modal with |
New finding: it affects bare RN app without react-native-screens or react-navigation. Minimal repro: import React from 'react';
import { StyleSheet, View, ScrollView, RefreshControl, Button as RNButton, Modal, Text } from 'react-native';
export function Home() {
const [modalVisible, setModalVisible] = React.useState(false);
return (
<View style={styles.container}>
<Text>Home Screen</Text>
<Text>Open up 'src/App.tsx' to start working on your app!</Text>
<RNButton title='Toggle modal' onPress={() => setModalVisible(true)} />
<Modal visible={modalVisible} presentationStyle='formSheet' animationType='slide' >
<Settings closeModal={() => setModalVisible(false)}/>
</Modal>
</View>
);
}
export function Settings({ closeModal }: { closeModal?: () => void }) {
return (
<View style={styles.container}>
<ScrollView
refreshControl={
<RefreshControl refreshing={false} onRefresh={() => {}} />
}
>
<Text style={styles.text}>Empty List</Text>
<RNButton title="Press me" onPress={() => console.log('Pressed!')} />
{closeModal && (
<RNButton title='Close modal' onPress={closeModal} />
)}
</ScrollView>
</View>
);
}
export default function BareReactNativeApp() {
return <Home />;
} |
I think the best way to proceed now would be to open an issue on I'll close this ticket once I move the issue there & suggest my patch as a fix. |
Opened issue on RN repo: facebook/react-native#48579 |
Description
When displaying a native iOS modal using
react-navigation/native-stack
, if the screen contains aRefreshControl
component in a scrollable component andheaderShown: false
is set on the screen options, the modal is unresponsive on mount. Backgrounding the app and returning fixes the issue.This happens on simulators and real devices
Link to same issue on react navigation repo: https://github.com/react-navigation/react-navigation/issues/12355
Steps to reproduce
RefreshControl
component withpresentation: modal
andheaderShown: false
set in screen optionsSnack or a link to a repository
https://github.com/chvanlennep/RefreshControlExample
Screens version
4.1.0
React Native version
0.76.3
Platforms
iOS
JavaScript runtime
Hermes
Workflow
Expo bare workflow
Architecture
Fabric (New Architecture)
Build type
Debug mode
Device
iOS simulator
Device model
No response
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: