Skip to content

Commit 9d7191f

Browse files
committed
add onFrame callback
1 parent 317714c commit 9d7191f

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
@@ -166,6 +166,7 @@ ARKit.propTypes = {
166166
planeDetection: PropTypes.bool,
167167
lightEstimation: PropTypes.bool,
168168
onPlaneDetected: PropTypes.func,
169+
onFrameUpdate: PropTypes.func,
169170
onPlaneUpdate: PropTypes.func,
170171
onTrackingState: PropTypes.func,
171172
onTapOnPlaneUsingExtent: PropTypes.func,

ios/RCTARKit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
@property (nonatomic, assign) BOOL lightEstimation;
3636

3737
@property (nonatomic, copy) RCTBubblingEventBlock onPlaneDetected;
38+
@property (nonatomic, copy) RCTBubblingEventBlock onFrameUpdate;
3839
@property (nonatomic, copy) RCTBubblingEventBlock onPlaneUpdate;
3940
@property (nonatomic, copy) RCTBubblingEventBlock onTrackingState;
4041
@property (nonatomic, copy) RCTBubblingEventBlock onTapOnPlaneUsingExtent;

ios/RCTARKit.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,11 @@ - (void)session:(ARSession *)session didUpdateFrame:(ARFrame *)frame {
378378
[sessionDelegate session:session didUpdateFrame:frame];
379379
}
380380
}
381+
if (self.onFrameUpdate) {
382+
dispatch_async(dispatch_get_main_queue(), ^{
383+
self.onFrameUpdate(@{});
384+
});
385+
}
381386
}
382387

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

ios/RCTARKitManager.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ - (NSDictionary *)constantsToExport
3737
RCT_EXPORT_VIEW_PROPERTY(onPlaneDetected, RCTBubblingEventBlock)
3838
RCT_EXPORT_VIEW_PROPERTY(onPlaneUpdate, RCTBubblingEventBlock)
3939
RCT_EXPORT_VIEW_PROPERTY(onTrackingState, RCTBubblingEventBlock)
40+
RCT_EXPORT_VIEW_PROPERTY(onFrameUpdate, RCTBubblingEventBlock)
4041
RCT_EXPORT_VIEW_PROPERTY(onEvent, RCTBubblingEventBlock)
4142

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

0 commit comments

Comments
 (0)