RCTSurfaceHostingComponentState.mm 893 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 "RCTSurfaceHostingComponentState.h"
  8. @implementation RCTSurfaceHostingComponentState
  9. + (instancetype)newWithStage:(RCTSurfaceStage)stage
  10. intrinsicSize:(CGSize)intrinsicSize
  11. {
  12. return [[self alloc] initWithStage:stage intrinsicSize:intrinsicSize];
  13. }
  14. - (instancetype)initWithStage:(RCTSurfaceStage)stage
  15. intrinsicSize:(CGSize)intrinsicSize
  16. {
  17. if (self = [super init]) {
  18. _stage = stage;
  19. _intrinsicSize = intrinsicSize;
  20. }
  21. return self;
  22. }
  23. - (BOOL)isEqual:(RCTSurfaceHostingComponentState *)other
  24. {
  25. if (other == self) {
  26. return YES;
  27. }
  28. return
  29. _stage == other->_stage &&
  30. CGSizeEqualToSize(_intrinsicSize, other->_intrinsicSize);
  31. }
  32. @end