Skip to content

StyleSheet.flatten usage and its impact on styling libraries #2556

@Brentlok

Description

@Brentlok

First of all, thank you for the great work on this library.

I noticed that StyleSheet.flatten is used in several places, and I wanted to ask about the rationale behind it and share a couple of compatibility issues I've run into:

{
    $$css: true,
    myClassName: 'bottom-sheet-cotainer',
    // react-native-bottom-sheet-styles:
    top: 0,
    left: 0,
    right: 0,
    bottom: 0
}

RNW then logs an error, seemingly because it tries to interpret numeric values (e.g., 0) as class names. Screenshot for reference:
Image

For context, Reanimated previously had a similar issue and addressed it by avoiding style flattening:
software-mansion/react-native-reanimated#7021

I'm curious is style flattening used here primarily for performance, or is there another reason (e.g., normalization, merging logic) that makes it necessary?

Thanks again for your time and for maintaining this project!
gorhom.dev

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions