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

Support jsx value of 'react' for TypeScript #34

Closed
dpux opened this issue Jan 3, 2020 · 2 comments
Closed

Support jsx value of 'react' for TypeScript #34

dpux opened this issue Jan 3, 2020 · 2 comments

Comments

@dpux
Copy link

dpux commented Jan 3, 2020

From the typescript setup docs:

Make sure that jsx property is set to react-native in Typescript's compilerOptions

I am trying to setup a react-native-web project with typescript support. Have been using jsx option 'react' as recommended in pretty much all the sample code I have been reading. On switching to 'react-native', module parser throws errors like these:

ERROR in ../src/index.tsx 10:12
Module parse failed: Unexpected token (10:12)
File was processed with these loaders:
../node_modules/ts-loader/index.js
You may need an additional loader to handle the result of these loaders.
| const { height } = react_native_1.Dimensions.get('screen');
| const App = () => {
return (<react_native_1.View>
| <react_native_1.View>
| <react_native_1.Text>hello</react_native_1.Text>
@ ../index.web.tsx 8:30-46

Is there a way to support 'react'? Or an example of react-native-web setup that uses jsx option of 'react-native' with css-loader? I am using the following versions:

"react-native": "0.61.5",
"react-native-web": "^0.11.7",
"typescript": "^3.7.4",
"css-loader": "^3.4.0"

@dpux dpux changed the title [typescript] Support jsx value of 'react' for TypeScript Support jsx value of 'react' for TypeScript Jan 3, 2020
@kristerkari
Copy link
Owner

hmm... is this related to react-native-css-modules? Looks like not.

Do you have a sample repository somewhere with the code?

@kristerkari
Copy link
Owner

Closing this as inactive. Let's reopen if something new comes up.

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

No branches or pull requests

2 participants