RCTSafeAreaShadowView.m 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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(
  15. [localData isKindOfClass:[RCTSafeAreaViewLocalData class]],
  16. @"Local data object for `RCTSafeAreaShadowView` must be `RCTSafeAreaViewLocalData` instance.");
  17. UIEdgeInsets insets = localData.insets;
  18. super.paddingLeft = (YGValue){insets.left, YGUnitPoint};
  19. super.paddingRight = (YGValue){insets.right, YGUnitPoint};
  20. super.paddingTop = (YGValue){insets.top, YGUnitPoint};
  21. super.paddingBottom = (YGValue){insets.bottom, YGUnitPoint};
  22. [self didSetProps:@[ @"paddingLeft", @"paddingRight", @"paddingTop", @"paddingBottom" ]];
  23. }
  24. /**
  25. * Removing support for setting padding from any outside code
  26. * to prevent interferring this with local data.
  27. */
  28. - (void)setPadding:(__unused YGValue)value
  29. {
  30. }
  31. - (void)setPaddingLeft:(__unused YGValue)value
  32. {
  33. }
  34. - (void)setPaddingRight:(__unused YGValue)value
  35. {
  36. }
  37. - (void)setPaddingTop:(__unused YGValue)value
  38. {
  39. }
  40. - (void)setPaddingBottom:(__unused YGValue)value
  41. {
  42. }
  43. @end