2018-01-12 02:34:34 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2018-01-12 02:34:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
|
|
|
|
#import "RCTSurfaceSizeMeasureMode.h"
|
|
|
|
|
|
|
|
void RCTSurfaceMinimumSizeAndMaximumSizeFromSizeAndSizeMeasureMode(
|
|
|
|
CGSize size,
|
|
|
|
RCTSurfaceSizeMeasureMode sizeMeasureMode,
|
2018-04-09 05:57:49 +00:00
|
|
|
CGSize *minimumSize,
|
|
|
|
CGSize *maximumSize
|
2018-01-12 02:34:34 +00:00
|
|
|
) {
|
2018-04-09 05:57:49 +00:00
|
|
|
*minimumSize = CGSizeZero;
|
|
|
|
*maximumSize = CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX);
|
2018-01-12 02:34:34 +00:00
|
|
|
|
|
|
|
if (sizeMeasureMode & RCTSurfaceSizeMeasureModeWidthExact) {
|
2018-04-09 05:57:49 +00:00
|
|
|
minimumSize->width = size.width;
|
|
|
|
maximumSize->width = size.width;
|
2018-01-12 02:34:34 +00:00
|
|
|
}
|
|
|
|
else if (sizeMeasureMode & RCTSurfaceSizeMeasureModeWidthAtMost) {
|
2018-04-09 05:57:49 +00:00
|
|
|
maximumSize->width = size.width;
|
2018-01-12 02:34:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (sizeMeasureMode & RCTSurfaceSizeMeasureModeHeightExact) {
|
2018-04-09 05:57:49 +00:00
|
|
|
minimumSize->height = size.height;
|
|
|
|
maximumSize->height = size.height;
|
2018-01-12 02:34:34 +00:00
|
|
|
}
|
|
|
|
else if (sizeMeasureMode & RCTSurfaceSizeMeasureModeHeightAtMost) {
|
2018-04-09 05:57:49 +00:00
|
|
|
maximumSize->height = size.height;
|
2018-01-12 02:34:34 +00:00
|
|
|
}
|
|
|
|
}
|