Ref inside modal not working anymore on Expo SDK19
See original GitHub issueHello there, I’m the maintainer of react-community/react-native-modal which since Expo SDK19 doesn’t work correctly anymore.
I never used Expo SDK before, but I debugged the issue a bit and created a super-minimal case of it.
Basically the issue is that the ref
s of the components inside a React-Native’s Modal don’t work at all since Expo SDK19.
They worked perfectly before this release and they’re still working on the last version of React-Native (0.46).
Maybe the Expo component is overriding the React Native’s original Modal behavior in some way?
import React from 'react';
import { Modal, StyleSheet, Text, View } from 'react-native';
export default class App extends React.Component {
componentDidMount() {
console.log('ref outside the modal: ', this.textOutsideModalRef);
console.log('ref inside the modal: ', this.textInsideModalRef);
}
render() {
return (
<View>
<Text ref={ref => (this.textOutsideModalRef = ref)}>
{'Hello, I am a Text outside of a Modal and I have a ref'}
</Text>
<Modal>
<Text ref={ref => (this.textInsideModalRef = ref)} visible={true}>
{'Hello, I am a Text inside a Modal and I should have a ref too :('}
</Text>
</Modal>
</View>
);
}
}
Thank you in advance and keep up with the good work!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:8 (1 by maintainers)
Top Results From Across the Web
this.refs is not working on bootstrap modal giving null when ...
useRef hook will not work in modals as the component will mount but the jsx will not render until you make show prop...
Read more >Bootstrap 4 Modals
Bootstrap 4 Modal. The Modal component is a dialog box/popup window that is displayed on top of the current page: Open modal ......
Read more ><Modal/> Component - React-Bootstrap
A modal with header, body, and set of actions in the footer. Use <Modal/> in combination with other components to show or hide...
Read more >Considerations for Styling a Modal
It's tempting to use an overflow value right on the .modal itself, but there are two problems with that: We might want some...
Read more >Modal · Bootstrap v4.6
Whenever possible, place your modal HTML in a top-level position to avoid potential interference from other elements. You'll likely run into issues when...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@mmazzarolo can you paste the package.json from your repro case? I think this bug was fixed in the 19.0.1 release of the
expo
npm package.PLEASE HELP ME expo 26.0.0 this._imageLightBox // undefined