react-native-bottom-sheet icon indicating copy to clipboard operation
react-native-bottom-sheet copied to clipboard

fix: replace JSX with `React.createElement`in mock implementation

Open huextrat opened this issue 8 months ago • 1 comments

Motivation

Fixing mock from https://github.com/gorhom/react-native-bottom-sheet/pull/2265

Problem

The mock implementation in mock.js was using JSX syntax (<Content data={this.data} />), which caused a SyntaxError: Unexpected token '<' on some projects.

This forces users to add @gorhom/bottom-sheet to their Jest transformIgnorePatterns configuration to enable JSX transformation for the mock file:

transformIgnorePatterns: [
  "node_modules/(?!@gorhom/bottom-sheet|...other packages)"
]

Solution:

Replaced JSX syntax with React.createElement(Content, { data: this.data }) in the BottomSheetModal mock component.

This ensures the mock works in all JavaScript environments without requiring JSX transformation

huextrat avatar Jun 04 '25 06:06 huextrat

my bad, i missed this. cc @gorhom

gabimoncha avatar Jun 11 '25 23:06 gabimoncha

Up

AlixH avatar Jul 11 '25 14:07 AlixH

Easy fix. 🚀

jerone avatar Jul 27 '25 13:07 jerone

This works fine!

rokkoo avatar Aug 28 '25 14:08 rokkoo

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

github-actions[bot] avatar Sep 28 '25 09:09 github-actions[bot]

Still relevant. 👍

jerone avatar Sep 28 '25 14:09 jerone

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

github-actions[bot] avatar Oct 30 '25 09:10 github-actions[bot]

don't stale it, cc @gorhom this should be an ez merge

gabimoncha avatar Oct 30 '25 12:10 gabimoncha