Move `[RCTConvert RCTTransformOrigin:]` out of UIAccessibilityTraits category (#39758)

Summary:
5f40f0800e added a new prop and corresponding RCTConvert method for transformOrigin. Strangely, it added the RCTConvertMethod to a `RCTConvert+UIAccessibilityTraits` category.. which feels like the wrong spot for it. Let's just add it to the existing `RCTConvert+Transform` category. This also means we can get rid of the header if we move the `RCTTransformOrigin` struct into UIView+React (where it is used).

## Changelog:

[IOS][CHANGED] - Move `[RCTConvert  RCTTransformOrigin:]` out of UIAccessibilityTraits category

Pull Request resolved: https://github.com/facebook/react-native/pull/39758

Test Plan:
Transform Origin example still works.
<img width="559" alt="Screenshot 2023-10-02 at 11 26 17 AM" src="https://github.com/facebook/react-native/assets/6722175/c7b863cc-3595-430d-8579-f8ce8e73c4f4">

Reviewed By: javache

Differential Revision: D49867993

Pulled By: NickGerleman

fbshipit-source-id: 1b2d5a9d08f0231040e7449f2eb75860f08bafa5
This commit is contained in:
Saad Najmi 2023-10-04 06:42:17 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 452bf0ff06
Коммит c7aa3954e3
5 изменённых файлов: 17 добавлений и 24 удалений

Просмотреть файл

@ -6,9 +6,12 @@
*/
#import "RCTConvert.h"
#import "UIView+React.h"
@interface RCTConvert (Transform)
+ (CATransform3D)CATransform3D:(id)json;
+ (RCTTransformOrigin)RCTTransformOrigin:(id)json;
@end

Просмотреть файл

@ -144,4 +144,11 @@ static const NSUInteger kMatrixArrayLength = 4 * 4;
return transform;
}
+ (RCTTransformOrigin)RCTTransformOrigin:(id)json
{
RCTTransformOrigin transformOrigin = {
[RCTConvert YGValue:json[0]], [RCTConvert YGValue:json[1]], [RCTConvert CGFloat:json[2]]};
return transformOrigin;
}
@end

Просмотреть файл

@ -1,15 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
#import <yoga/Yoga.h>
typedef struct {
YGValue x;
YGValue y;
CGFloat z;
} RCTTransformOrigin;

Просмотреть файл

@ -15,7 +15,6 @@
#import "RCTConvert.h"
#import "RCTLog.h"
#import "RCTShadowView.h"
#import "RCTTransformOrigin.h"
#import "RCTUIManager.h"
#import "RCTUIManagerUtils.h"
#import "RCTUtils.h"
@ -122,13 +121,6 @@ RCT_MULTI_ENUM_CONVERTER(
UIAccessibilityTraitNone,
unsignedLongLongValue)
+ (RCTTransformOrigin)RCTTransformOrigin:(id)json
{
RCTTransformOrigin transformOrigin = {
[RCTConvert YGValue:json[0]], [RCTConvert YGValue:json[1]], [RCTConvert CGFloat:json[2]]};
return transformOrigin;
}
@end
@implementation RCTViewManager

Просмотреть файл

@ -8,11 +8,17 @@
#import <UIKit/UIKit.h>
#import <React/RCTComponent.h>
#import <React/RCTTransformOrigin.h>
#import <React/RCTConvert.h>
#import <yoga/YGEnums.h>
@class RCTShadowView;
typedef struct {
YGValue x;
YGValue y;
CGFloat z;
} RCTTransformOrigin;
@interface UIView (React) <RCTComponent>
/**