Skip to content

Commit

Permalink
Move [RCTConvert RCTTransformOrigin:] out of UIAccessibilityTraits …
Browse files Browse the repository at this point in the history
…category (#39758)

Summary:
5f40f08 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: #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
  • Loading branch information
Saadnajmi authored and facebook-github-bot committed Oct 4, 2023
1 parent 452bf0f commit c7aa395
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 24 deletions.
3 changes: 3 additions & 0 deletions packages/react-native/React/Views/RCTConvert+Transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
*/

#import "RCTConvert.h"
#import "UIView+React.h"

@interface RCTConvert (Transform)

+ (CATransform3D)CATransform3D:(id)json;

+ (RCTTransformOrigin)RCTTransformOrigin:(id)json;

@end
7 changes: 7 additions & 0 deletions packages/react-native/React/Views/RCTConvert+Transform.m
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,11 @@ + (CATransform3D)CATransform3D:(id)json
return transform;
}

+ (RCTTransformOrigin)RCTTransformOrigin:(id)json
{
RCTTransformOrigin transformOrigin = {
[RCTConvert YGValue:json[0]], [RCTConvert YGValue:json[1]], [RCTConvert CGFloat:json[2]]};
return transformOrigin;
}

@end
15 changes: 0 additions & 15 deletions packages/react-native/React/Views/RCTTransformOrigin.h

This file was deleted.

8 changes: 0 additions & 8 deletions packages/react-native/React/Views/RCTViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -122,13 +121,6 @@ @implementation RCTConvert (UIAccessibilityTraits)
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
Expand Down
8 changes: 7 additions & 1 deletion packages/react-native/React/Views/UIView+React.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>

/**
Expand Down

0 comments on commit c7aa395

Please sign in to comment.