Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Suggestion: Modify ResponsiveStyleSheet to behave like Platform.select #33

Closed
agenthunt opened this issue May 14, 2018 · 5 comments
Closed

Comments

@agenthunt
Copy link

From

    get style() {
        return ResponsiveStyleSheet.select([
        {
            query: { orientation: "landscape" },
            style: {
                btns: {
                    flexDirection: "row"
                },
                btn: {
                    flex: 1
                }
            }
        },
        {
            query: { orientation: "portrait" },
            style: {
                btns: {
                    alignSelf: "stretch"
                },
                btn: {
                    flex: 0
                }
            }
        }
        ]);
    }

to

    get style() {
        return {
            btns: {
               flexDirection: "row",
               ResponsiveStyleSheet.select([
                 {
                    query: { orientation: "landscape" }
                    style: {
                      alignSelf: 'stretch'
                    } 
                 }
            }
        }
    }

The benefit being, it can apply a set of base styles and then override based on MediaQuery match.

@wcandillon
Copy link
Collaborator

That makes a lot of sense, I will try to implement this.

@wcandillon
Copy link
Collaborator

Should be fixed now, let me know :)

@agenthunt
Copy link
Author

Awesome. Thank you!!!

@JaEdmuva
Copy link

How is this working? can we please have a clearer example? This is nothing like what is documented.

@crutchcorn
Copy link
Member

Closing in favor of #88, which suggests an API with the benefits of the Platform.select method proposed here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants