RCTSafeAreaShadowView.m 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 "RCTSafeAreaShadowView.h"
  8. #import <React/RCTAssert.h>
  9. #import <yoga/Yoga.h>
  10. #import "RCTSafeAreaViewLocalData.h"
  11. @implementation RCTSafeAreaShadowView
  12. - (void)setLocalData:(RCTSafeAreaViewLocalData *)localData
  13. {
  14. RCTAssert([localData isKindOfClass:[RCTSafeAreaViewLocalData class]],
  15. @"Local data object for `RCTSafeAreaShadowView` must be `RCTSafeAreaViewLocalData` instance.");
  16. UIEdgeInsets insets = localData.insets;
  17. super.paddingLeft = (YGValue){insets.left, YGUnitPoint};
  18. super.paddingRight = (YGValue){insets.right, YGUnitPoint};
  19. super.paddingTop = (YGValue){insets.top, YGUnitPoint};
  20. super.paddingBottom = (YGValue){insets.bottom, YGUnitPoint};
  21. [self didSetProps:@[@"paddingLeft", @"paddingRight", @"paddingTop", @"paddingBottom"]];
  22. }
  23. /**
  24. * Removing support for setting padding from any outside code
  25. * to prevent interferring this with local data.
  26. */
  27. - (void)setPadding:(YGValue)value {}
  28. - (void)setPaddingLeft:(YGValue)value {}
  29. - (void)setPaddingRight:(YGValue)value {}
  30. - (void)setPaddingTop:(YGValue)value {}
  31. - (void)setPaddingBottom:(YGValue)value {}
  32. @end