question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ref inside modal not working anymore on Expo SDK19

See original GitHub issue

Hello 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 refs 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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
anpcommented, Jul 26, 2017

@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.

0reactions
wiloke1commented, May 14, 2018

PLEASE HELP ME expo 26.0.0 this._imageLightBox // undefined screenshot 2018-05-14 15 52 57

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found