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: allow to array style prop #2189

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

heecheolman
Copy link

@heecheolman heecheolman commented Dec 5, 2023

Summary

  • Previously, styles in "Array" format were not being applied correctly.
  • Therefore, now ensure that styles in "Array" format are correctly applied using StyleSheet.flatten.

Before: The opacity attribute is not correctly applied in gStyle.

const gStyle = Object.assign({}, [{ opacity: 0.5 }]);
/* { 0: {opacity: 0.5 }} */

After: Now, the opacity attribute is correctly applied in gStyle.

const gStyle = Object.assign({}, StyleSheet.flatten([{ opacity: 0.5 }]));
/* { opacity: 0.5 } */
const gStyle = Object.assign({}, StyleSheet.flatten([{ opacity: 0.5 }, { backgroundColor: 'red' }]));
/* { opacity: 0.5, backgroundColor: 'red' } */

Test Plan

0 key is not allow to ViewStyle

What's required for testing (prerequisites)?

What are the steps to reproduce (after prerequisites)?

Compatibility

OS Implemented
iOS ✅❌
Android ✅❌

Checklist

  • I have tested this on a device and a simulator
  • I added documentation in README.md
  • I updated the typed files (typescript)
  • I added a test for the API in the __tests__ folder

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.

None yet

1 participant