Skip to content

Commit

Permalink
refactor: move apple files
Browse files Browse the repository at this point in the history
  • Loading branch information
tjzel committed Aug 1, 2024
1 parent 04548ba commit 5289682
Show file tree
Hide file tree
Showing 51 changed files with 5,906 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifdef RCT_NEW_ARCH_ENABLED

#import <RNReanimated/REAModule.h>
#import <React/RCTFabricSurface.h>

@interface REAInitializerRCTFabricSurface : RCTFabricSurface

@property REAModule *reaModule;

@end

#endif // RCT_NEW_ARCH_ENABLED
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#ifdef RCT_NEW_ARCH_ENABLED

#import <React/RCTSurface.h>
#import <React/RCTSurfaceView.h>
#import <memory>

#import <RNReanimated/REAInitializerRCTFabricSurface.h>
#import <RNReanimated/REAModule.h>

@implementation REAInitializerRCTFabricSurface {
std::shared_ptr<facebook::react::SurfaceHandler> _surfaceHandler;
int _tag;
RCTSurface *_surface;
}

- (instancetype)init
{
if (self = [super init]) {
_tag = -1;
_surface = [[RCTSurface alloc] init];
_surfaceHandler = std::make_shared<facebook::react::SurfaceHandler>("REASurface", _tag);
}
return self;
}

- (NSNumber *)rootViewTag
{
return @(_tag);
}

- (NSInteger)rootTag
{
return (NSInteger)_tag;
}

- (void)start
{
// this is only needed method, the rest of them is just for prevent null pointer exceptions
[_reaModule installReanimatedAfterReload];
}

- (facebook::react::SurfaceHandler const &)surfaceHandler
{
return *_surfaceHandler.get();
}

- (void)setMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximumSize
{
}

- (void)setMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximumSize viewportOffset:(CGPoint)viewportOffset
{
}

- (void)stop
{
}

- (CGSize)sizeThatFitsMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximumSize
{
CGSize size{0, 0};
return size;
}

- (nonnull RCTSurfaceView *)view
{
// This method should never be called.
react_native_assert(false);
return nullptr;
}

@end

#endif // RCT_NEW_ARCH_ENABLED
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#import <Foundation/Foundation.h>
#import <RNReanimated/LayoutAnimationType.h>
#import <RNReanimated/REANodesManager.h>
#import <RNReanimated/REASnapshot.h>
#import <RNReanimated/REAUIKit.h>
#import <React/RCTUIManager.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, ViewState) {
Inactive,
Appearing,
Disappearing,
Layout,
ToRemove,
};

typedef BOOL (^REAHasAnimationBlock)(NSNumber *_Nonnull tag, LayoutAnimationType type);
typedef BOOL (^REAShouldAnimateExitingBlock)(NSNumber *_Nonnull tag, BOOL shouldAnimate);
typedef void (
^REAAnimationStartingBlock)(NSNumber *_Nonnull tag, LayoutAnimationType type, NSDictionary *_Nonnull yogaValues);
typedef void (^REAAnimationRemovingBlock)(NSNumber *_Nonnull tag);
typedef void (^REASharedTransitionRemovingBlock)(NSNumber *_Nonnull tag);
#ifndef NDEBUG
typedef void (^REACheckDuplicateSharedTagBlock)(REAUIView *view, NSNumber *_Nonnull viewTag);
#endif
typedef void (^REACancelAnimationBlock)(NSNumber *_Nonnull tag);
typedef NSNumber *_Nullable (^REAFindPrecedingViewTagForTransitionBlock)(NSNumber *_Nonnull tag);
typedef NSArray<NSNumber *> *_Nullable (^REAGetSharedGroupBlock)(NSNumber *_Nonnull tag);
typedef int (^REATreeVisitor)(id<RCTComponent>);
BOOL REANodeFind(id<RCTComponent> view, int (^block)(id<RCTComponent>));

@interface REAAnimationsManager : NSObject

- (instancetype)initWithUIManager:(RCTUIManager *)uiManager;
- (void)setAnimationStartingBlock:(REAAnimationStartingBlock)startAnimation;
- (void)setHasAnimationBlock:(REAHasAnimationBlock)hasAnimation;
- (void)setShouldAnimateExitingBlock:(REAShouldAnimateExitingBlock)shouldAnimateExiting;
- (void)setAnimationRemovingBlock:(REAAnimationRemovingBlock)clearAnimation;
- (void)setSharedTransitionRemovingBlock:(REASharedTransitionRemovingBlock)clearSharedTransition;
#ifndef NDEBUG
- (void)setCheckDuplicateSharedTagBlock:(REACheckDuplicateSharedTagBlock)checkDuplicateSharedTag;
#endif
- (void)progressLayoutAnimationWithStyle:(NSDictionary *_Nonnull)newStyle
forTag:(NSNumber *_Nonnull)tag
isSharedTransition:(BOOL)isSharedTransition;
- (void)setFindPrecedingViewTagForTransitionBlock:
(REAFindPrecedingViewTagForTransitionBlock)findPrecedingViewTagForTransition;
- (void)setGetSharedGroupBlock:(REAGetSharedGroupBlock)getSharedGroupBlock;
- (void)setCancelAnimationBlock:(REACancelAnimationBlock)animationCancellingBlock;
- (void)endLayoutAnimationForTag:(NSNumber *_Nonnull)tag removeView:(BOOL)removeView;
- (void)endAnimationsRecursive:(REAUIView *)view;
- (void)invalidate;
- (void)viewDidMount:(REAUIView *)view withBeforeSnapshot:(REASnapshot *)snapshot withNewFrame:(CGRect)frame;
- (REASnapshot *)prepareSnapshotBeforeMountForView:(REAUIView *)view;
- (void)removeAnimationsFromSubtree:(REAUIView *)view;
- (void)reattachAnimatedChildren:(NSArray<id<RCTComponent>> *)children
toContainer:(id<RCTComponent>)container
atIndices:(NSArray<NSNumber *> *)indices;
- (void)onViewCreate:(REAUIView *)view after:(REASnapshot *)after;
- (void)onViewUpdate:(REAUIView *)view before:(REASnapshot *)before after:(REASnapshot *)after;
- (void)viewsDidLayout;
- (NSMutableDictionary *)prepareDataForLayoutAnimatingWorklet:(NSMutableDictionary *)currentValues
targetValues:(NSMutableDictionary *)targetValues;
- (REAUIView *)viewForTag:(NSNumber *)tag;
- (BOOL)hasAnimationForTag:(NSNumber *)tag type:(LayoutAnimationType)type;
- (void)clearAnimationConfigForTag:(NSNumber *)tag;
- (void)clearSharedTransitionConfigForTag:(NSNumber *)tag;
- (void)startAnimationForTag:(NSNumber *)tag type:(LayoutAnimationType)type yogaValues:(NSDictionary *)yogaValues;
- (void)onScreenRemoval:(REAUIView *)screen stack:(REAUIView *)stack;

@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit 5289682

Please sign in to comment.