Skip to content

fix: replace JSX with React.createElementin mock implementation #2302

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

huextrat
Copy link

@huextrat huextrat commented Jun 4, 2025

Motivation

Fixing mock from #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 huextrat changed the title Fix: replace JSX with React.createElementin mock implementation fix: replace JSX with React.createElementin mock implementation Jun 4, 2025
@gabimoncha
Copy link
Contributor

my bad, i missed this. cc @gorhom

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.

2 participants