fix: allow className and style props to coexist when properties differ (#223)
* fix: allow className and style props to coexist when properties differ Previously, when both className and style props were provided, className-derived styles would be completely overwritten by inline styles due to Object.assign() behavior in deepMergeConfig(). This refined solution: - Only creates style arrays when className and inline styles have non-overlapping properties - Maintains CSS precedence rules (inline styles override className for same properties) - Preserves backward compatibility with existing behavior - Passes all existing tests while enabling the new functionality Enables combining NativeWind className styling with React Native Reanimated animated styles when they target different CSS properties. Fixes issue where className was ignored when style prop was also present, while preserving expected CSS specificity behavior. * perf: optimize style merging performance and readability Address code review feedback by improving the style merging logic: - Remove Set creation and array spreading for better performance - Add early exit when finding non-overlapping properties - Simplify logic flow making it more readable and maintainable - Maintain identical functionality while reducing computational overhead Performance improvements are especially beneficial for components with many style properties, reducing unnecessary object iterations.
T
Ty Rauber committed
2c6839629691d480d7311e7776d69433b8eb083d
Parent: 8a01f75
Committed by GitHub <noreply@github.com>
on 10/31/2025, 11:49:27 PM