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

React native web support #9

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

intergalacticspacehighway
Copy link

@intergalacticspacehighway intergalacticspacehighway commented Sep 30, 2021

Thanks for this coool plugin. This is something I didn't know I needed. 😆 🙏

I am not sure whether this should be merged but opening a PR here to add support for React native web in case someone finds it useful and can just copy-paste. I am adding some steps to make it work in React Native web.

Pass a plugin option {reactNativeWeb: true} to make it work.

// babel.config.js

module.exports = {
    plugins: [
      ['./babel-plugin-open-source/babel.js', { reactNativeWeb: true }],
    ],
  };

More details

React native web 0.13+ doesn't support data-attr syntax. Data attributes can be set using dataSet prop on components.
To set data-source, one needs to pass dataSet={{source: value}} as a prop.
More info here. https://necolas.github.io/react-native-web/docs/view/#props

Note

Needs react-native-web 0.14 or greater.

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.

1 participant