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

fix: use default empty style #111

Merged
merged 1 commit into from
Jun 26, 2020
Merged

Conversation

jaulz
Copy link
Contributor

@jaulz jaulz commented Jun 26, 2020

Summary

If style prop is undefined, StyleSheet.flatten will also return undefined. The code will dump consequently when it tries to destructure flatStyle:

const {
margin = 0,
marginVertical = margin,
marginHorizontal = margin,
marginTop = marginVertical,
marginRight = marginHorizontal,
marginBottom = marginVertical,
marginLeft = marginHorizontal,
} = flatStyle;

This is what I observed when using react-native-web.

Test Plan

The following code should work with this PR:

  <SafeAreaView>
    <Text>test</Text>
  </SafeAreaView>

Copy link
Member

@janicduplessis janicduplessis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants