Skip to content

Commit 0595213

Browse files
committed
feat: switch to new jsx runtime
1 parent c30fd49 commit 0595213

File tree

7 files changed

+15
-10
lines changed

7 files changed

+15
-10
lines changed

.github/workflows/build-templates.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,6 @@ jobs:
200200
working-directory: ${{ env.work_dir }}
201201
run: |
202202
yarn typecheck
203-
# FIXME: Remove this once we fix the typecheck errors
204-
continue-on-error: true
205203
206204
- name: Test library
207205
working-directory: ${{ env.work_dir }}

packages/create-react-native-library/templates/common-example/example/src/App.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import * as React from 'react';
2-
31
<% if (project.view) { -%>
42
import { StyleSheet, View } from 'react-native';
53
import { <%- project.name -%>View } from '<%- project.slug -%>';
64
<% } else { -%>
5+
<% if (project.arch !== 'new') { -%>
6+
import { useState, useEffect } from 'react';
7+
<% } -%>
78
import { StyleSheet, View, Text } from 'react-native';
89
import { multiply } from '<%- project.slug -%>';
910
<% } -%>
@@ -28,9 +29,9 @@ export default function App() {
2829
}
2930
<% } else { -%>
3031
export default function App() {
31-
const [result, setResult] = React.useState<number | undefined>();
32+
const [result, setResult] = useState<number | undefined>();
3233

33-
React.useEffect(() => {
34+
useEffect(() => {
3435
multiply(3, 7).then(setResult);
3536
}, []);
3637

packages/create-react-native-library/templates/common/$package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
"prettier"
130130
],
131131
"rules": {
132+
"react/react-in-jsx-scope": "off",
132133
"prettier/prettier": [
133134
"error",
134135
{

packages/create-react-native-library/templates/common/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"allowUnusedLabels": false,
99
"esModuleInterop": true,
1010
"forceConsistentCasingInFileNames": true,
11-
"jsx": "react",
11+
"jsx": "react-jsx",
1212
"lib": ["esnext"],
1313
"module": "esnext",
1414
"moduleResolution": "node",

packages/react-native-builder-bob/babel-preset.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ module.exports = function (api, options, cwd) {
2727
modules: options.modules || false,
2828
},
2929
],
30-
require.resolve('@babel/preset-react'),
30+
[
31+
require.resolve('@babel/preset-react'),
32+
{
33+
runtime: 'automatic',
34+
},
35+
],
3136
require.resolve('@babel/preset-typescript'),
3237
require.resolve('@babel/preset-flow'),
3338
],

packages/react-native-builder-bob/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ yargs
179179
allowUnusedLabels: false,
180180
esModuleInterop: true,
181181
forceConsistentCasingInFileNames: true,
182-
jsx: 'react',
182+
jsx: 'react-jsx',
183183
lib: ['esnext'],
184184
module: 'esnext',
185185
moduleResolution: 'node',

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"allowUnusedLabels": false,
1313
"esModuleInterop": true,
1414
"forceConsistentCasingInFileNames": true,
15-
"jsx": "react",
15+
"jsx": "react-jsx",
1616
"lib": ["esnext", "dom"],
1717
"module": "esnext",
1818
"moduleResolution": "node",

0 commit comments

Comments
 (0)