RCTMaskedView.m 907 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #import "RCTMaskedView.h"
  8. #import <React/UIView+React.h>
  9. @implementation RCTMaskedView
  10. - (void)didUpdateReactSubviews
  11. {
  12. // RCTMaskedView expects that the first subview rendered is the mask.
  13. UIView *maskView = [self.reactSubviews firstObject];
  14. self.maskView = maskView;
  15. // Add the other subviews to the view hierarchy
  16. for (NSUInteger i = 1; i < self.reactSubviews.count; i++) {
  17. UIView *subview = [self.reactSubviews objectAtIndex:i];
  18. [self addSubview:subview];
  19. }
  20. }
  21. - (void)displayLayer:(__unused CALayer *)layer
  22. {
  23. // RCTView uses displayLayer to do border rendering.
  24. // We don't need to do that in RCTMaskedView, so we
  25. // stub this method and override the default implementation.
  26. }
  27. @end