diff --git a/cxx/core/HostUnistyle.cpp b/cxx/core/HostUnistyle.cpp index ebbfe73d..04bf3845 100644 --- a/cxx/core/HostUnistyle.cpp +++ b/cxx/core/HostUnistyle.cpp @@ -52,11 +52,11 @@ jsi::Function HostUnistyle::createAddVariantsProxyFunction(jsi::Runtime& rt) { Variants variants = helpers::variantsToPairs(rt, arguments[0].asObject(rt)); helpers::enumerateJSIObject(rt, thisVal.asObject(rt), [this, &parser, &rt, &variants](const std::string& name, jsi::Value& value){ - auto unistyle = this->_stylesheet->unistyles[name]; - - if (unistyle == nullptr) { + if (name == helpers::ADD_VARIANTS_FN || !this->_stylesheet->unistyles.contains(name)) { return; } + + auto unistyle = this->_stylesheet->unistyles[name]; if (unistyle->dependsOn(UnistyleDependency::VARIANTS)) { parser.rebuildUnistyle(rt, unistyle, variants, std::nullopt); diff --git a/src/core/createUnistylesElement.native.tsx b/src/core/createUnistylesElement.native.tsx index 364bef0e..1cd2e5ff 100644 --- a/src/core/createUnistylesElement.native.tsx +++ b/src/core/createUnistylesElement.native.tsx @@ -19,7 +19,9 @@ export const createUnistylesElement = (Component: any) => React.forwardRef((prop ref={(ref: unknown) => { storedRef.current = ref passForwardedRef(props, ref, forwardedRef) - maybeWarnAboutMultipleUnistyles(props, Component.displayName) + + // @ts-ignore we don't know the type of the component + maybeWarnAboutMultipleUnistyles(props.style, Component.displayName) }} /> ) diff --git a/src/core/createUnistylesImageBackground.tsx b/src/core/createUnistylesImageBackground.tsx index 766cb587..70c617c3 100644 --- a/src/core/createUnistylesImageBackground.tsx +++ b/src/core/createUnistylesImageBackground.tsx @@ -19,6 +19,8 @@ export const createUnistylesImageBackground = (Component: typeof ImageBackground // @ts-expect-error we don't know the type of the component maybeWarnAboutMultipleUnistyles(props.style, 'ImageBackground') + // @ts-ignore we don't know the type of the component + maybeWarnAboutMultipleUnistyles(props.imageStyle, 'ImageBackground') return ( { const listensToTheme = dependencies.includes(UnistyleDependency.Theme) // @ts-expect-error - this is hidden from TS @@ -50,11 +55,6 @@ export const withUnistyles = { - // @ts-ignore - maybeWarnAboutMultipleUnistyles(narrowedProps.style, `withUnistyles(${Component.displayName ?? 'Unknown'})`) - // @ts-ignore - maybeWarnAboutMultipleUnistyles(narrowedProps.contentContainerStyle, `withUnistyles(${Component.displayName ?? 'Unknown'})`) - const styleSecrets = getSecrets(narrowedProps.style) const contentContainerStyleSecrets = getSecrets(narrowedProps.contentContainerStyle)