Skip to content

Comments in-line with JSX elements cause Invariant Violation error #22120

Description

@kernel-sanders

Environment

React Native Environment Info:

 System:
OS: macOS 10.14.1
CPU: x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Memory: 3.58 GB / 32.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.7.0 - /usr/local/bin/node
npm: 6.4.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
IDEs:
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.0-alpha.8af6728 => 16.6.0-alpha.8af6728
react-native: 0.57.4 => 0.57.4
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
react-native-vector-icons: 4.6.0

Description

In line comments break react-native 56+, as shown in the code and repo below. Removing "This comment breaks the app" allows the app to run. Comments on lines by themselves seem to be ok.

exportdefaultclassAppextendsComponent<Props>{render(){return(<Viewstyle={styles.container}>{/* This comment is ok */}<Textstyle={styles.welcome}>Welcome to React Native!</Text>{/* This comment breaks the app */}<Textstyle={styles.instructions}>To get started, edit App.js</Text><Textstyle={styles.instructions}>{instructions}</Text></View>);}}

Possibly linked to: #20084

Reproducible Demo

https://github.com/kernel-sanders/ReactNative56TextBug

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions