Skip to content
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

Move the hooks implementation to its own HOC and re-implement withStyles with context as a class component #225

Merged
merged 11 commits into from
Aug 29, 2019

Conversation

noratarano
Copy link
Collaborator

@noratarano noratarano commented Aug 29, 2019

Summary

  • Move the functional hooks-based implementation from Remove singletons in favor of React context (hooks-based implementation)(backward compatible with all versions of react) #221 to its own HOC, withStylesFunctional
  • Re-implement withStyles with context as a class component to make a more equivalent API swap to continue supporting implied and legacy refs on the HOC.
  • Adds direction to the WithStylesContext so we can use contextType, and provide a WithStylesDirectionAdapter as a helper to take the direction provided by react-with-direction and add it to WithStylesContext. Also adds helper providers to amend the values in context for the other values.

Testing

  1. See tests.
  2. I'm also testings locally in other repos:
    • react-dates
    • rheostat
    • dls-web

Followup

  • Update README in separate PR

Reviewers

@ahuth @TaeKimJR @ljharb @indiesquidge

Nora Tarano added 10 commits August 28, 2019 20:23
Also restore the caching of stylesFn(theme) results per component and
add direction to the WithStylesContext.
- Theme and Interface providers help with amending the existing context
  with new values
- Direction adapter helps provide the direction provided by
  react-with-direction
Have to remove the contextType the withDirection component hoists because
it's using an old version of hoist-non-react-statics that copies it over
@noratarano noratarano force-pushed the nora--with-styles-with-context branch from 3eca4d7 to 86598fb Compare August 29, 2019 03:14
Copy link
Collaborator

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

Since the deleted filenames were never published, there's no breaking change from deleting them.

@noratarano noratarano merged commit ec2ac77 into master Aug 29, 2019
@noratarano noratarano deleted the nora--with-styles-with-context branch August 29, 2019 18:54
@noratarano noratarano mentioned this pull request Sep 4, 2019
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.

None yet

2 participants