You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/babel-plugin-rn-stylename-inline/__tests__/__snapshots__/index.spec.js.snap
+120Lines changed: 120 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1080,6 +1080,126 @@ export default function Card({ ready, pad }) {
1080
1080
}
1081
1081
1082
1082
1083
+
`;
1084
+
1085
+
exports[`@cssxjs/babel-plugin-rn-stylename-inline Reachable local css interpolation after early return. Should error: Reachable local css interpolation after early return. Should error 1`] =`
1086
+
1087
+
import React from 'react'
1088
+
import {css} from 'cssxjs'
1089
+
import {View} from 'react-native'
1090
+
import {useThemeColor} from './theme'
1091
+
1092
+
export default function Card ({ready}) {
1093
+
if (!ready) return <ViewstyleName='loader' />
1094
+
constcolor=useThemeColor('primary')
1095
+
1096
+
css\`
1097
+
.root {
1098
+
color: \${color};
1099
+
}
1100
+
\`
1101
+
1102
+
return <ViewstyleName='root' />
1103
+
}
1104
+
1105
+
↓ ↓ ↓ ↓ ↓ ↓
1106
+
1107
+
SyntaxError: unknown file: [@cssxjs/babel-plugin-rn-stylename-inline] Local css/styl templates must be declared before the first return, unless they are trailing CSSX style blocks at the end of the component.
1108
+
Move this template before the first return, or place it after all returns as the final component statement.
1109
+
8 | const color = useThemeColor('primary')
1110
+
9 |
1111
+
> 10 | css\`
1112
+
| ^
1113
+
11 | .root {
1114
+
12|color: \${color};
1115
+
13|}
1116
+
1117
+
`;
1118
+
1119
+
exports[`@cssxjs/babel-plugin-rn-stylename-inline Reachable local css interpolation before return: Reachable local css interpolation before return 1`] =`
'[@cssxjs/babel-plugin-rn-stylename-inline] Local css/styl templates must be declared before the first return, unless they are trailing CSSX style blocks at the end of the component.',
146
+
'Move this template before the first return, or place it after all returns as the final component statement.'
0 commit comments