Skip to content

Conversation

@marcshilling
Copy link
Contributor

Motivation

My team was attempting to attach a ref to one of our custom components that is wrapped with the withTheme higher order component, but it wasn't working. Upon digging into the HOC, I quickly noticed that react-native-elements is only doing ref forwarding for class components, but seemingly not for functional components. I don't see any reason for this, and after patching this change locally everything works fine for us and we are now able to use refs on our components wrapped with withTheme.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Jest Unit Test
  • Checked with example app

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation using yarn docs-build-api
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@codecov
Copy link

codecov bot commented Dec 13, 2022

Codecov Report

Merging #3708 (644fa21) into next (8af8b09) will decrease coverage by 0.05%.
The diff coverage is 100.00%.

❗ Current head 644fa21 differs from pull request most recent head d3a3b8a. Consider uploading reports for the commit d3a3b8a to get more accurate results

@@            Coverage Diff             @@
##             next    #3708      +/-   ##
==========================================
- Coverage   79.44%   79.39%   -0.05%     
==========================================
  Files          87       87              
  Lines        1824     1820       -4     
  Branches      796      810      +14     
==========================================
- Hits         1449     1445       -4     
  Misses        370      370              
  Partials        5        5              
Impacted Files Coverage Δ
packages/themed/src/config/withTheme.tsx 84.84% <100.00%> (-1.64%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@arpitBhalla arpitBhalla changed the title fix: refs on functional components wrapped with withTheme HOC fix(withTheme): refs on functional components wrapped Mar 2, 2023
Copy link
Member

@pranshuchittora pranshuchittora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me. Haven't run the changes locally. Merge it, if you have tested this.
Also can we write some updated tests for this, probably some snapshot tests.

@netlify
Copy link

netlify bot commented Mar 20, 2023

Deploy Preview for react-native-elements ready!

Name Link
🔨 Latest commit d3a3b8a
🔍 Latest deploy log https://app.netlify.com/sites/react-native-elements/deploys/641811e52958750008a8f965
😎 Deploy Preview https://deploy-preview-3708--react-native-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@arpitBhalla arpitBhalla merged commit a8e5327 into react-native-elements:next Mar 21, 2023
github-actions bot pushed a commit that referenced this pull request Mar 21, 2023
Co-authored-by: Marc Shilling <marc.shilling@stadiumgoods.com>
github-actions bot pushed a commit that referenced this pull request Mar 21, 2023
Co-authored-by: Marc Shilling <marc.shilling@stadiumgoods.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants