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

Map Ordering does not produce a proper hash #359

Open
trueshot opened this issue Feb 11, 2019 · 0 comments
Open

Map Ordering does not produce a proper hash #359

trueshot opened this issue Feb 11, 2019 · 0 comments

Comments

@trueshot
Copy link

The Documentation says:

const styles = StyleSheet.create({
    ordered: new Map([
        ["margin", 0],
        ["marginLeft", 15],
    ]),
});

In the StyleSheet.create function this line causes a problem.

var stringVal = JSON.stringify(val);

It returns an empty object `{}' instead of the something that is related to the map.

The problem is the hash that represents the style is always the same. So if you try to create a new stylesheet (using the map option), you end up only updating the only stylesheet.

const styles = StyleSheet.create({
    ordered: new Map([
        ["margin", 0],
        ["marginLeft", 15],
    ]),
});
const styles1 = StyleSheet.create({
    foo: new Map([
        ["padding", 0],
        ["paddingLeft", 15],
    ]),
});

Both styles.ordered and styles1.foo refer to the same style (the hash the string '{}' is always '3hmsj'.

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