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

Various fixes to RCTView props #234

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Various fixes to RCTView props #234

wants to merge 11 commits into from

Conversation

aleclarson
Copy link
Collaborator

@aleclarson aleclarson commented Mar 18, 2019

Fixes #232

  • move [RCTViewManager checkLayerExists:] to [NSView ensureLayerExists]
  • enable edge antialiasing only for transforms with perspective
  • stop setting layer manually in [NSView ensureLayerExists] (let the layer getter call [NSView makeBackingLayer] instead)
  • never set layer.transform directly except in [RCTView displayLayer:]
  • call ensureLayerExists before setting any layer-related prop
  • call ensureLayerExists inside reactSetFrame: so layer props can be set
  • enforce position and anchorPoint by setting them in [RCTView displayLayer:]
  • fix [RCTView setBackgroundColor:] strangeness

And rename it to "ensureLayerExists"
We cannot set "layer.transform" directly except from the "displayLayer:" method, because AppKit often sets it without respecting explicit values. For example, the "setFrame:" method is one spot, but there are others.
This prevents a crash when a RCTViewManager represents a NSView subclass (instead of a RCTView subclass), which requires the subclass to implement its own "transform" property and override its "displayLayer:" method.
Ensure a layer exists before setting these props.
Otherwise, the anchor point won't be set.
Otherwise, the anchorPoint may be reverted to the top-left.
@aleclarson aleclarson added this to the 0.20.0 milestone Mar 18, 2019
@aleclarson aleclarson modified the milestones: 0.20.0, 0.19.3 Mar 18, 2019
The "setFrame:" method overrides our transform, so it needs to be reapplied.
- The "_backgroundColor" ivar was not being set when called with nil.

- The method assumed that the "layer" property could be nullified when "backgroundColor" is nil, which is definitely not the case.
@aleclarson aleclarson mentioned this pull request Mar 19, 2019
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.

UIExplorer: transforms not working with position
1 participant