Skip to content

globalClassNamePolyfill removes properties #192

@doits

Description

@doits

Before submitting a new issue

  • I tested using the latest version of the library, as the bug might be already fixed.
  • I tested using a supported version of react native.
  • I checked for possible duplicate issues, with possible answers.

Bug summary

When using globalClassNamePolyfill: true, due to the way it works, properties get lost. For example Image has a resolveAssetPath function as a property which gets lost.

Without the polyfill enabled you can do this and it imports the function:

import { resolveAssetPath } from Image

With the polyfill enabled, it doesn't work anymore (the above returns undefined).

I think the solution might be to do a Object.assign:

export function Image(props: StyledProps<ImageProps, typeof mapping>) {
  return useCssElement(RNImage, props, mapping);
}

Object.assign(Image, RNImage)

Library version

3.0.0

Environment info

Not relevant

Steps to reproduce

See above

Reproducible example repository

Not provided

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions