Skip to content

Commit ba1f505

Browse files
committed
Merge branch 'onFrame-callback' into feature-points
2 parents 13be97c + b8b5ca7 commit ba1f505

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

ARKit.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ ARKit.propTypes = {
175175
planeDetection: PropTypes.bool,
176176
lightEstimation: PropTypes.bool,
177177
onPlaneDetected: PropTypes.func,
178+
onFrameUpdate: PropTypes.func,
178179
onPlaneUpdate: PropTypes.func,
179180
onTrackingState: PropTypes.func,
180181
onTapOnPlaneUsingExtent: PropTypes.func,

ios/RCTARKit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ typedef void (^RCTARKitReject)(NSString *code, NSString *message, NSError *error
3838
@property (nonatomic, assign) BOOL lightEstimation;
3939

4040
@property (nonatomic, copy) RCTBubblingEventBlock onPlaneDetected;
41+
@property (nonatomic, copy) RCTBubblingEventBlock onFrameUpdate;
4142
@property (nonatomic, copy) RCTBubblingEventBlock onPlaneUpdate;
4243
@property (nonatomic, copy) RCTBubblingEventBlock onTrackingState;
4344
@property (nonatomic, copy) RCTBubblingEventBlock onTapOnPlaneUsingExtent;

ios/RCTARKit.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,11 @@ - (void)session:(ARSession *)session didUpdateFrame:(ARFrame *)frame {
433433
[sessionDelegate session:session didUpdateFrame:frame];
434434
}
435435
}
436+
if (self.onFrameUpdate) {
437+
dispatch_async(dispatch_get_main_queue(), ^{
438+
self.onFrameUpdate(@{});
439+
});
440+
}
436441
}
437442

438443
- (void)session:(ARSession *)session cameraDidChangeTrackingState:(ARCamera *)camera {

ios/RCTARKitManager.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ - (NSDictionary *)constantsToExport
6262
RCT_EXPORT_VIEW_PROPERTY(onPlaneDetected, RCTBubblingEventBlock)
6363
RCT_EXPORT_VIEW_PROPERTY(onPlaneUpdate, RCTBubblingEventBlock)
6464
RCT_EXPORT_VIEW_PROPERTY(onTrackingState, RCTBubblingEventBlock)
65+
RCT_EXPORT_VIEW_PROPERTY(onFrameUpdate, RCTBubblingEventBlock)
6566
RCT_EXPORT_VIEW_PROPERTY(onEvent, RCTBubblingEventBlock)
6667

6768
RCT_EXPORT_METHOD(pause:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {

0 commit comments

Comments
 (0)