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.

bug: IonContent's ref turns to null as soon as the component it is inside of rerenders

See original GitHub issue

Bug Report

Ionic version:

[ ] 4.x [x] 5.6.5

Current behavior:

If you have a React component that has an IonContent element in it and use the ref property to get access to the functions on the IonContent, the current value of that ref will change from a proper value to null as soon as anything causes the wrapping component to rerender.

Expected behavior:

The current value of the ref in the IonContent should always return the content object.

Steps to reproduce:

See example app here. The relevant code is in here. This is the basic tabs starter app. I’m rendering an IonContent inside the first tab and then set a timer that changes some state in the component. It’s constantly printing out the value of the ref, and you can see that as soon as the state is changed the ref turns to null.

This behavior began with version 5.6.5 and continues in 5.6.6 of the react project.

Related code:

https://github.com/withgrayce/ionic-ref-bug

Other information:

Ionic info:

Ionic:

   Ionic CLI       : 6.14.1 (/Users/aubrey/.nvm/versions/node/v15.13.0/lib/node_modules/@ionic/cli)
   Ionic Framework : @ionic/react 5.6.6

Capacitor:

   Capacitor CLI   : 2.4.7
   @capacitor/core : 2.4.7

Utility:

   cordova-res (update available: 0.15.3) : 0.15.1
   native-run (update available: 1.3.0)   : 1.0.0

System:

   NodeJS : v15.13.0 (/Users/aubrey/.nvm/versions/node/v15.13.0/bin/node)
   npm    : 7.7.6
   OS     : macOS Big Sur

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
aubcommented, May 11, 2021

@TuckerWhitehouse Yes, that fixes it.

0reactions
ionitron-bot[bot]commented, Jun 10, 2021

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Building Mobile Apps With Ionic And React for Beginners
IonContent : This component provides a content area, with methods to control the scrollable area and other things. You need only one content...
Read more >
React Archives - Page 9 of 12 - The Branding Store
Inside it, we imported React from react , and we deconstructed the item and channel props so that they can be used across...
Read more >
Full text of "Professional Angular JS BY Valeri Karpov & ...
The templateUrl option can reference a file that Angular loads and renders into the DOM. For this application, you will be storing templates...
Read more >
BRAVE | Bloch Representation Analysis and Visualization ...
Implement BRAVE with how-to, Q&A, fixes, code snippets. kandi ratings - Low support, No Bugs, 7 Vulnerabilities, Permissive License, Build not available.
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