diff --git a/src/__tests__/native/components.test.tsx b/src/__tests__/native/components.test.tsx new file mode 100644 index 0000000..31fcb84 --- /dev/null +++ b/src/__tests__/native/components.test.tsx @@ -0,0 +1,56 @@ +import { Button as RNButton, type ButtonProps } from "react-native"; + +import { render } from "@testing-library/react-native"; +import { copyComponentProperties } from "react-native-css/components/copyComponentProperties"; +import { registerCSS, testID } from "react-native-css/jest"; +import { useCssElement } from "react-native-css/native"; +import type { + StyledConfiguration, + StyledProps, +} from "react-native-css/runtime.types"; + +test("Component preserves props when mapping specifies 'target: false'", () => { + registerCSS(`.sign-in { color: orange; }`); + + const mapping: StyledConfiguration = { + className: { + target: false, + nativeStyleMapping: { + color: "color", + }, + }, + }; + + const Button = copyComponentProperties( + RNButton, + (props: StyledProps) => { + return useCssElement(RNButton, props, mapping); + }, + ); + + const onPress = jest.fn(); + + const result = render( +