mirror of
https://github.com/zhigang1992/nativewind.git
synced 2026-06-20 03:48:31 +08:00
tests: add allow-modules-with-content
This commit is contained in:
16
__tests__/native-inline/allow-modules-with-content/code.tsx
Normal file
16
__tests__/native-inline/allow-modules-with-content/code.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { Text } from "react-native";
|
||||
import { TailwindProvider } from "tailwindcss-react-native";
|
||||
import { MotiText } from "moti";
|
||||
import {TestComponent} from "./test";
|
||||
|
||||
export function Test() {
|
||||
return (
|
||||
<TailwindProvider>
|
||||
<Text className="font-bold">Hello world!</Text>
|
||||
<MotiText className="font-bold">Should be the untransformed</MotiText>
|
||||
<TestComponent className="font-bold">
|
||||
Should be the untransformed
|
||||
</TestComponent>
|
||||
</TailwindProvider>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"allowModules": ["react-native"],
|
||||
"tailwindConfigPath": "./allow-modules-with-content/tailwind.config.js"
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
import { useTailwind } from "tailwindcss-react-native";
|
||||
import { Text } from "react-native";
|
||||
import { TailwindProvider } from "tailwindcss-react-native";
|
||||
import { MotiText } from "moti";
|
||||
import { TestComponent } from "./test";
|
||||
export function Test() {
|
||||
return (
|
||||
<TailwindProvider>
|
||||
<Text
|
||||
style={useTailwind("font-bold", {
|
||||
styles: __tailwindStyles,
|
||||
media: __tailwindMedia,
|
||||
})}
|
||||
>
|
||||
Hello world!
|
||||
</Text>
|
||||
<MotiText className="font-bold">Should be the untransformed</MotiText>
|
||||
<TestComponent className="font-bold">
|
||||
Should be the untransformed
|
||||
</TestComponent>
|
||||
</TailwindProvider>
|
||||
);
|
||||
}
|
||||
|
||||
const __tailwindStyles = StyleSheet.create({
|
||||
"font-bold": {
|
||||
fontWeight: "700",
|
||||
},
|
||||
});
|
||||
|
||||
const __tailwindMedia = {};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
content: [`${__dirname}/code.{js,ts,jsx,tsx}`],
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
import { Text, TextProps } from "react-native";
|
||||
|
||||
export function TestComponent(props: TextProps & { className?: string }) {
|
||||
return <Text {...props}>Hello world!</Text>;
|
||||
}
|
||||
Reference in New Issue
Block a user