Skip to content

Commit eee0b83

Browse files
committed
✨ Add feature to change the video recording floating button position
1 parent 1e6b223 commit eee0b83

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

index.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,19 @@ module.exports = {
801801
}
802802
},
803803

804+
/**
805+
* Sets the default position at which the Instabug screen recording button will be shown. Different orientations are already handled.
806+
*
807+
* (Default for `position` is `bottomRight`)
808+
*
809+
* @param position `topLeft` to show on the top left of screen , or `bottomRight` to show on the bottom right of scrren.
810+
*/
811+
setVideoRecordingFloatingButtonPosition: function(position) {
812+
if(Platform.OS === 'ios') {
813+
Instabug.setVideoRecordingFloatingButtonPosition(position);
814+
}
815+
},
816+
804817
/**
805818
* The event used to invoke the feedback form
806819
* @readonly
@@ -892,6 +905,18 @@ module.exports = {
892905
right: Instabug.rectMaxXEdge,
893906
},
894907

908+
/**
909+
* Instabug floating buttons positions.
910+
* @readonly
911+
* @enum {number}
912+
*/
913+
IBGPosition: {
914+
bottomRight: Instabug.bottomRight,
915+
topRight: Instabug.topRight,
916+
bottomLeft: Instabug.bottomLeft,
917+
topLeft: Instabug.topLeft
918+
},
919+
895920
/**
896921
* Instabug strings
897922
* @readonly

ios/RNInstabug/InstabugReactBridge.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,10 @@ - (dispatch_queue_t)methodQueue {
331331
[Instabug setViewHierarchyEnabled:viewHirearchyEnabled];
332332
}
333333

334+
RCT_EXPORT_METHOD(setVideoRecordingFloatingButtonPosition:(IBGPosition)position) {
335+
[Instabug setVideoRecordingFloatingButtonPosition:position];
336+
}
337+
334338
RCT_EXPORT_METHOD(isRunningLive:(RCTResponseSenderBlock)callback) {
335339
BOOL result = NO;
336340
#if TARGET_OS_SIMULATOR
@@ -374,6 +378,11 @@ - (NSDictionary *)constantsToExport
374378
@"rectMaxXEdge": @(CGRectMaxXEdge),
375379
@"rectMaxYEdge": @(CGRectMaxYEdge),
376380

381+
@"bottomRight": @(IBGPositionBottomRight),
382+
@"topRight": @(IBGPositionTopRight),
383+
@"bottomLeft": @(IBGPositionBottomLeft),
384+
@"topLeft": @(IBGPositionTopLeft),
385+
377386
@"localeArabic": @(IBGLocaleArabic),
378387
@"localeChineseSimplified": @(IBGLocaleChineseSimplified),
379388
@"localeChineseTraditional": @(IBGLocaleChineseTraditional),

ios/RNInstabug/RCTConvert+InstabugEnums.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88

99
#import "RCTConvert+InstabugEnums.h"
10-
#import <Instabug/IBGTypes.h>
10+
#import <InstabugCore/IBGTypes.h>
1111

1212
@implementation RCTConvert (InstabugEnums)
1313

@@ -71,6 +71,13 @@ @implementation RCTConvert (InstabugEnums)
7171
@"colorThemeDark": @(IBGColorThemeDark)
7272
}), IBGColorThemeLight, integerValue);
7373

74+
RCT_ENUM_CONVERTER(IBGPosition, (@{
75+
@"bottomRight": @(IBGPositionBottomRight),
76+
@"topRight": @(IBGPositionTopRight),
77+
@"bottomLeft": @(IBGPositionBottomLeft),
78+
@"topLeft": @(IBGPositionTopLeft)
79+
}), IBGPositionBottomRight, integerValue);
80+
7481
RCT_ENUM_CONVERTER(IBGString, (@{
7582
@"shakeHint": @(IBGStringShakeHint),
7683
@"swipeHint": @(IBGStringSwipeHint),

0 commit comments

Comments
 (0)