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

refactor: Refactor class components in addons to function components #248

Conversation

lauriharpf
Copy link
Contributor

@lauriharpf lauriharpf commented Aug 5, 2021

Issue: #235

What I did

Fixes #235 by refactoring the class components in all ondevice addons to function components. Note the exceptions mentioned in the comments of commit b671dd6

How to test

Run the example app at examples/native and experiment with the addons.

  • Does this need a new example in examples/native? no, not in my opinion
  • Does this need an update to the documentation? no, not in my opinion

Copy link
Member

@dannyhw dannyhw left a comment

Choose a reason for hiding this comment

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

Not able to test this right now since I'm away without my laptop for a while. However from what I can tell it looks good to me.

Nice job 👍

typeof value === 'object' &&
!Array.isArray(value) &&
Object.keys(value).length)) ? (
<Button
Copy link
Member

Choose a reason for hiding this comment

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

Not necessary for this pr I guess but it might be good to replace this button with a custom touchable opacity or pressable to improve the UI for the Android version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea! Didn't do that yet, but we could tackle it either in this PR or as a separate PR.

@lauriharpf lauriharpf changed the title refactor: Refactor class components in ondevice-actions to function components refactor: Refactor class components in ondevice-actions and ondevice-backgrounds to function components Aug 6, 2021
…n components. Omissions:

* ondevice-controls/src/GroupTabs.tsx: Not refactored, as the component is currently unused. Let's take it into use before refactoring or remove it (see storybookjs#182 (comment))
* ondevice-controls/src/components/color-picker/*: Let's try to get the fixes PR'd and merged to the original library (so we can remove this code) or try to find a color picker that doesn't need custom modifications
…omponents. As the last ondevice-addon to refactor, this fixes storybookjs#235
@lauriharpf lauriharpf changed the title refactor: Refactor class components in ondevice-actions and ondevice-backgrounds to function components refactor: Refactor class components in addons to function components Aug 6, 2021
@lauriharpf lauriharpf merged commit 4d238d6 into storybookjs:next-6.0 Aug 8, 2021
@lauriharpf lauriharpf deleted the refactor/ondevice-actions-to-function-components branch August 8, 2021 12:47
lauriharpf added a commit to lauriharpf/react-native that referenced this pull request Aug 8, 2021
dannyhw pushed a commit to raychanks/react-native that referenced this pull request Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[6.0] Refactor addons to use function components
2 participants