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

automatically strip play functions for react-native runtime #570

Closed
wants to merge 1 commit into from

Conversation

awinograd
Copy link

Issue:

What I did

Play functions are not supported on native. Instead of requiring consumers to guard their play functions with platform checks, we automatically strip any stories of their play functions for them.

How to test

This PR doesn't fully make writing play functions compatible with @storybook/react-native. See https://discord.com/channels/486522875931656193/490822534233849873/1233464353907540081.

I've worked around the build issue with the following metro config for now which is a bit hacky

      resolveRequest: function (context, moduleName, platform) {
        if (moduleName === 'os' || moduleName === 'tty') {
          return context.resolveRequest(context, 'lodash/noop', platform);
        }

I don't think it yet makes sense to add an example test showing that the play function is stripped from a story.

Please explain how to test your changes and consider the following questions.

  • Does this need a new example in examples/expo-example? No
  • Does this need an update to the documentation? No

If your answer is yes to any of these, please make sure to include it in your PR.

@awinograd awinograd requested a review from dannyhw as a code owner April 26, 2024 18:52
@dannyhw
Copy link
Member

dannyhw commented Apr 26, 2024

@awinograd thanks for the contribution, seems to me like a reasonable solution. Don't have the time right now to test but will do soon.

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.

None yet

2 participants