Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty ids object and missing media queries in styles objects when creating the StyleSheet. #10

Closed
EricBorland opened this issue Jun 23, 2022 · 2 comments

Comments

@EricBorland
Copy link

Just getting started with this in iOS, after copying the code from the README.md

import StyleSheet from 'react-native-media-query';
    
const {ids, styles} = StyleSheet.create({
    example: {
        width: 100,
        height: 100,
        backgroundColor: 'green',
        '@media (max-width: 1600px) and (min-width: 800px)': {
            backgroundColor: 'red',
        },
        '@media (max-width: 800px)': {
            backgroundColor: 'blue',
        },
    }
});

console.log('RESULT: ', ids, styles);

And I see the following:

RESULT:  {} {"example": {"backgroundColor": "blue", "height": 100, "width": 100}}

What am I doing wrong?

Thanks.

@EricBorland
Copy link
Author

EricBorland commented Jun 23, 2022

And, ofc, accessing ids.example or styles.example returns undefined or the object without the media query respectively...

@EricBorland
Copy link
Author

Okay, sorry. Just found out that it was actually working properly, just didn't notice the styles being overwritten. My bad

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

No branches or pull requests

1 participant