Skip to content

Commit a7545ad

Browse files
committed
Fixes for clock and 'defined' node
1 parent d104e50 commit a7545ad

File tree

6 files changed

+7
-6
lines changed

6 files changed

+7
-6
lines changed

Example/ios/GestureHandler.xcodeproj/xcshareddata/xcschemes/GestureHandler.xcscheme

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
buildConfiguration = "Debug"
5555
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5656
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57-
language = ""
5857
shouldUseLaunchSchemeArgsEnv = "YES">
5958
<Testables>
6059
<TestableReference
@@ -84,7 +83,6 @@
8483
buildConfiguration = "Debug"
8584
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
8685
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
87-
language = ""
8886
launchStyle = "0"
8987
useCustomWorkingDirectory = "NO"
9088
ignoresPersistentStateOnLaunch = "NO"

Example/ios/GestureHandler/NativeAnimation/Nodes/REAClockNodes.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ - (void)start
3030

3131
weak_animationClb = animationClb = ^(CADisplayLink *displayLink) {
3232
if (!weakSelf.isRunning) return;
33-
weakSelf.lastTimestampMs = @(displayLink.timestamp * 1000.);
3433
[weakSelf markUpdated];
3534
[weakSelf.nodesManager postOnAnimation:weak_animationClb];
3635
};
@@ -45,7 +44,7 @@ - (void)stop
4544

4645
- (id)evaluate
4746
{
48-
return _lastTimestampMs;
47+
return @(self.nodesManager.currentAnimationTimestamp * 1000.);
4948
}
5049

5150
@end

Example/ios/GestureHandler/NativeAnimation/Nodes/REAOperatorNode.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ - (instancetype)initWithID:(REANodeID)nodeID config:(NSDictionary<NSString *,id>
6464
@"not": REA_SINGLE(!a),
6565
@"defined": ^(NSArray<REANode *> *inputNodes) {
6666
id val = [inputNodes[0] value];
67-
return @(val != nil && isnan([val doubleValue]));
67+
id res = @(val != nil && !isnan([val doubleValue]));
68+
return res;
6869
},
6970

7071
// comparing

Example/ios/GestureHandler/NativeAnimation/Nodes/REAValueNode.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ - (instancetype)initWithID:(REANodeID)nodeID
1616
- (void)setValue:(NSNumber *)value
1717
{
1818
_value = value;
19-
[self markUpdated];
19+
[self forceUpdateMemoizedValue:value];
2020
}
2121

2222
- (id)evaluate

Example/ios/GestureHandler/NativeAnimation/REANodesManager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ typedef void (^REAAfterAnimationCallback)();
1313

1414
@property (nonatomic, weak, nullable) RCTUIManager *uiManager;
1515
@property (nonatomic, weak, nullable) REAModule *reanimatedModule;
16+
@property (nonatomic, readonly) CFTimeInterval currentAnimationTimestamp;
1617

1718
- (nonnull instancetype)initWithModule:(REAModule *)reanimatedModule
1819
uiManager:(nonnull RCTUIManager *)uiManager;

Example/ios/GestureHandler/NativeAnimation/REANodesManager.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ - (void)stopUpdatingOnAnimationFrame
8181

8282
- (void)onAnimationFrame:(CADisplayLink *)displayLink
8383
{
84+
_currentAnimationTimestamp = displayLink.timestamp;
85+
8486
// We process all enqueued events first
8587
for (NSUInteger i = 0; i < _eventQueue.count; i++) {
8688
id<RCTEvent> event = _eventQueue[i];

0 commit comments

Comments
 (0)