feat:rename animator to animate
This commit is contained in:
10
iOS/Pod/Classes/Plugin/DoricAnimatePlugin.h
Normal file
10
iOS/Pod/Classes/Plugin/DoricAnimatePlugin.h
Normal file
@@ -0,0 +1,10 @@
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/11/29.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "DoricNativePlugin.h"
|
||||
|
||||
@interface DoricAnimatePlugin : DoricNativePlugin
|
||||
@end
|
33
iOS/Pod/Classes/Plugin/DoricAnimatePlugin.m
Normal file
33
iOS/Pod/Classes/Plugin/DoricAnimatePlugin.m
Normal file
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/11/29.
|
||||
//
|
||||
|
||||
#import "DoricAnimatePlugin.h"
|
||||
#import "DoricRootNode.h"
|
||||
|
||||
@implementation DoricAnimatePlugin
|
||||
|
||||
- (void)submit:(NSDictionary *)args withPromise:(DoricPromise *)promise {
|
||||
[promise resolve:nil];
|
||||
}
|
||||
|
||||
- (void)animateRender:(NSDictionary *)args withPromise:(DoricPromise *)promise {
|
||||
NSNumber *duration = args[@"duration"];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
NSString *viewId = args[@"id"];
|
||||
[UIView animateWithDuration:[duration floatValue] / 1000
|
||||
animations:^{
|
||||
if (self.doricContext.rootNode.viewId == nil) {
|
||||
self.doricContext.rootNode.viewId = viewId;
|
||||
[self.doricContext.rootNode blend:args[@"props"]];
|
||||
} else {
|
||||
DoricViewNode *viewNode = [self.doricContext targetViewNode:viewId];
|
||||
[viewNode blend:args[@"props"]];
|
||||
}
|
||||
}
|
||||
completion:^(BOOL finished) {
|
||||
[promise resolve:nil];
|
||||
}];
|
||||
});
|
||||
}
|
||||
@end
|
@@ -140,27 +140,4 @@ - (id)findClass:(Class)clz target:(id)target method:(NSString *)name promise:(Do
|
||||
return ret;
|
||||
}
|
||||
|
||||
- (void)animator:(NSDictionary *)args withPromise:(DoricPromise *)promise {
|
||||
[promise resolve:nil];
|
||||
}
|
||||
|
||||
- (void)animateRender:(NSDictionary *)args withPromise:(DoricPromise *)promise {
|
||||
NSNumber *duration = args[@"duration"];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
NSString *viewId = args[@"id"];
|
||||
[UIView animateWithDuration:[duration floatValue] / 1000
|
||||
animations:^{
|
||||
if (self.doricContext.rootNode.viewId == nil) {
|
||||
self.doricContext.rootNode.viewId = viewId;
|
||||
[self.doricContext.rootNode blend:args[@"props"]];
|
||||
} else {
|
||||
DoricViewNode *viewNode = [self.doricContext targetViewNode:viewId];
|
||||
[viewNode blend:args[@"props"]];
|
||||
}
|
||||
}
|
||||
completion:^(BOOL finished) {
|
||||
[promise resolve:nil];
|
||||
}];
|
||||
});
|
||||
}
|
||||
@end
|
||||
|
Reference in New Issue
Block a user