Skip to content

Use .native.tsx instead of .web.tsx #579

Open

Description

@nandorojo

React web apps don't use the .web.tsx pattern. However, all native apps do use platform extensions.

I'd propose changing MarkdownTextInput.tsx to have the web code, and MarkdownTextInput.tsx to have the React Native code. This way, Web developers don't need additional config to install the library.

I'm happy to do this in a PR if you'd merge it.

Activity

  1. nandorojo commented on Dec 11, 2024

    @nandorojo
    ContributorAuthor

    Further: we should remove the usage of StyleSheet.create in the web file. Creating the style, and then subsequently flattening it, is unnecessarily expensive with React Native Web. It's better to just use an object and pass it to a flat style prop.

    This would also remove the dependency on react-native-web, making this far easier for Web developers to consume.

    I've maintained so many RNW libraries, and I encourage you to avoid the headache of using it under the hood unless it's actually necessary

  2. tomekzaw commented on Dec 11, 2024

    @tomekzaw
    Contributor

    @nandorojo Thanks for opening this issue. We're definitely open to such contribution, feel free to submit a PR.

    Just one more thing – let's introduce .native.tsx suffix and remove .web.tsx suffix in one PR and then remove the usage of StyleSheet in another PR so we can keep the changes atomic.

  3. added
    enhancement
    on Dec 11, 2024
  4. nandorojo commented on Dec 11, 2024

    @nandorojo
    ContributorAuthor

    PR opened here #582

  5. nandorojo commented on Dec 11, 2024

    @nandorojo
    ContributorAuthor

    Just one more thing – let's introduce .native.tsx suffix and remove .web.tsx suffix in one PR and then remove the usage of StyleSheet in another PR so we can keep the changes atomic.

    Damn it, just saw this lol. I'll revert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions