@bbearai/react-native 0.9.2 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -19215,6 +19215,10 @@ var import_react_native22 = require("react-native");
19215
19215
  var screenWidth = import_react_native22.Dimensions.get("window").width;
19216
19216
  var screenHeight = import_react_native22.Dimensions.get("window").height;
19217
19217
  var RUNNER_WIDTH = 280;
19218
+ var RUNNER_MARGIN = 16;
19219
+ var MIN_Y = 80;
19220
+ var BOTTOM_SAFE_PADDING = import_react_native22.Platform.OS === "ios" ? 34 : 24;
19221
+ var SAFE_MAX_Y = screenHeight - 200 - BOTTOM_SAFE_PADDING;
19218
19222
  function MiniTestRunner({ assignmentId, onExpand, onComplete, onAdvance, onNavigateToReport }) {
19219
19223
  const { client, assignments, refreshAssignments } = useBugBear();
19220
19224
  const assignment = assignments.find((a) => a.id === assignmentId);
@@ -19229,8 +19233,8 @@ function MiniTestRunner({ assignmentId, onExpand, onComplete, onAdvance, onNavig
19229
19233
  setCurrentStepIndex(0);
19230
19234
  }, [assignmentId]);
19231
19235
  const pan = (0, import_react23.useRef)(new import_react_native22.Animated.ValueXY({
19232
- x: screenWidth - RUNNER_WIDTH - 16,
19233
- y: screenHeight - 220
19236
+ x: screenWidth - RUNNER_WIDTH - RUNNER_MARGIN,
19237
+ y: SAFE_MAX_Y
19234
19238
  })).current;
19235
19239
  const panResponder = (0, import_react23.useRef)(
19236
19240
  import_react_native22.PanResponder.create({
@@ -19238,8 +19242,8 @@ function MiniTestRunner({ assignmentId, onExpand, onComplete, onAdvance, onNavig
19238
19242
  onMoveShouldSetPanResponder: (_, gs) => Math.abs(gs.dx) > 5 || Math.abs(gs.dy) > 5,
19239
19243
  onPanResponderGrant: () => {
19240
19244
  pan.setOffset({
19241
- x: getAnimatedValue(pan.x),
19242
- y: getAnimatedValue(pan.y)
19245
+ x: Math.max(RUNNER_MARGIN, Math.min(getAnimatedValue(pan.x), screenWidth - RUNNER_WIDTH - RUNNER_MARGIN)),
19246
+ y: Math.max(MIN_Y, Math.min(getAnimatedValue(pan.y), SAFE_MAX_Y))
19243
19247
  });
19244
19248
  pan.setValue({ x: 0, y: 0 });
19245
19249
  },
@@ -19251,8 +19255,8 @@ function MiniTestRunner({ assignmentId, onExpand, onComplete, onAdvance, onNavig
19251
19255
  pan.flattenOffset();
19252
19256
  const currentX = getAnimatedValue(pan.x);
19253
19257
  const currentY = getAnimatedValue(pan.y);
19254
- const snapX = currentX < screenWidth / 2 ? 16 : screenWidth - RUNNER_WIDTH - 16;
19255
- const snapY = Math.max(80, Math.min(currentY, screenHeight - 200));
19258
+ const snapX = currentX < screenWidth / 2 ? RUNNER_MARGIN : screenWidth - RUNNER_WIDTH - RUNNER_MARGIN;
19259
+ const snapY = Math.max(MIN_Y, Math.min(currentY, SAFE_MAX_Y));
19256
19260
  import_react_native22.Animated.spring(pan, {
19257
19261
  toValue: { x: snapX, y: snapY },
19258
19262
  useNativeDriver: false,
@@ -19481,6 +19485,7 @@ var styles4 = import_react_native22.StyleSheet.create({
19481
19485
  // src/BugBearButton.tsx
19482
19486
  var screenWidth2 = import_react_native23.Dimensions.get("window").width;
19483
19487
  var screenHeight2 = import_react_native23.Dimensions.get("window").height;
19488
+ var BOTTOM_SAFE_PADDING2 = import_react_native23.Platform.OS === "ios" ? 34 : 24;
19484
19489
  function BugBearButton({
19485
19490
  position = "bottom-right",
19486
19491
  buttonStyle,
@@ -19520,14 +19525,15 @@ function BugBearButton({
19520
19525
  setViewMode("closed");
19521
19526
  });
19522
19527
  };
19528
+ const buttonSize = 56;
19529
+ const margin = 16;
19530
+ const safeMaxY = screenHeight2 - maxYOffset - BOTTOM_SAFE_PADDING2;
19523
19531
  const getInitialPosition = () => {
19524
- const buttonSize = 56;
19525
- const margin = 16;
19526
19532
  if (initialX !== void 0 && initialY !== void 0) {
19527
19533
  return { x: initialX, y: initialY };
19528
19534
  }
19529
19535
  const x = position === "bottom-right" ? screenWidth2 - buttonSize - margin : margin;
19530
- const y = screenHeight2 - 160;
19536
+ const y = screenHeight2 - maxYOffset - BOTTOM_SAFE_PADDING2;
19531
19537
  return { x, y };
19532
19538
  };
19533
19539
  const initialPos = getInitialPosition();
@@ -19540,8 +19546,8 @@ function BugBearButton({
19540
19546
  onPanResponderGrant: () => {
19541
19547
  isDragging.current = false;
19542
19548
  pan.setOffset({
19543
- x: getAnimatedValue(pan.x),
19544
- y: getAnimatedValue(pan.y)
19549
+ x: Math.max(margin, Math.min(getAnimatedValue(pan.x), screenWidth2 - buttonSize - margin)),
19550
+ y: Math.max(minY, Math.min(getAnimatedValue(pan.y), safeMaxY))
19545
19551
  });
19546
19552
  pan.setValue({ x: 0, y: 0 });
19547
19553
  },
@@ -19558,10 +19564,8 @@ function BugBearButton({
19558
19564
  pan.flattenOffset();
19559
19565
  const currentX = getAnimatedValue(pan.x);
19560
19566
  const currentY = getAnimatedValue(pan.y);
19561
- const buttonSize = 56;
19562
- const margin = 16;
19563
19567
  const snapX = currentX < screenWidth2 / 2 ? margin : screenWidth2 - buttonSize - margin;
19564
- const snapY = Math.max(minY, Math.min(currentY, screenHeight2 - maxYOffset));
19568
+ const snapY = Math.max(minY, Math.min(currentY, safeMaxY));
19565
19569
  import_react_native23.Animated.spring(pan, {
19566
19570
  toValue: { x: snapX, y: snapY },
19567
19571
  useNativeDriver: false,
package/dist/index.mjs CHANGED
@@ -15172,7 +15172,7 @@ import {
15172
15172
  StyleSheet as StyleSheet22,
15173
15173
  Dimensions as Dimensions3,
15174
15174
  KeyboardAvoidingView,
15175
- Platform as Platform5,
15175
+ Platform as Platform6,
15176
15176
  PanResponder as PanResponder2,
15177
15177
  Animated as Animated4,
15178
15178
  ActivityIndicator as ActivityIndicator3,
@@ -19193,10 +19193,14 @@ function createStyles15() {
19193
19193
 
19194
19194
  // src/widget/MiniTestRunner.tsx
19195
19195
  import React21, { useState as useState18, useEffect as useEffect12, useCallback as useCallback6, useRef as useRef7 } from "react";
19196
- import { View as View21, Text as Text19, TouchableOpacity as TouchableOpacity18, StyleSheet as StyleSheet21, Animated as Animated3, PanResponder, Dimensions as Dimensions2 } from "react-native";
19196
+ import { View as View21, Text as Text19, TouchableOpacity as TouchableOpacity18, StyleSheet as StyleSheet21, Animated as Animated3, PanResponder, Dimensions as Dimensions2, Platform as Platform5 } from "react-native";
19197
19197
  var screenWidth = Dimensions2.get("window").width;
19198
19198
  var screenHeight = Dimensions2.get("window").height;
19199
19199
  var RUNNER_WIDTH = 280;
19200
+ var RUNNER_MARGIN = 16;
19201
+ var MIN_Y = 80;
19202
+ var BOTTOM_SAFE_PADDING = Platform5.OS === "ios" ? 34 : 24;
19203
+ var SAFE_MAX_Y = screenHeight - 200 - BOTTOM_SAFE_PADDING;
19200
19204
  function MiniTestRunner({ assignmentId, onExpand, onComplete, onAdvance, onNavigateToReport }) {
19201
19205
  const { client, assignments, refreshAssignments } = useBugBear();
19202
19206
  const assignment = assignments.find((a) => a.id === assignmentId);
@@ -19211,8 +19215,8 @@ function MiniTestRunner({ assignmentId, onExpand, onComplete, onAdvance, onNavig
19211
19215
  setCurrentStepIndex(0);
19212
19216
  }, [assignmentId]);
19213
19217
  const pan = useRef7(new Animated3.ValueXY({
19214
- x: screenWidth - RUNNER_WIDTH - 16,
19215
- y: screenHeight - 220
19218
+ x: screenWidth - RUNNER_WIDTH - RUNNER_MARGIN,
19219
+ y: SAFE_MAX_Y
19216
19220
  })).current;
19217
19221
  const panResponder = useRef7(
19218
19222
  PanResponder.create({
@@ -19220,8 +19224,8 @@ function MiniTestRunner({ assignmentId, onExpand, onComplete, onAdvance, onNavig
19220
19224
  onMoveShouldSetPanResponder: (_, gs) => Math.abs(gs.dx) > 5 || Math.abs(gs.dy) > 5,
19221
19225
  onPanResponderGrant: () => {
19222
19226
  pan.setOffset({
19223
- x: getAnimatedValue(pan.x),
19224
- y: getAnimatedValue(pan.y)
19227
+ x: Math.max(RUNNER_MARGIN, Math.min(getAnimatedValue(pan.x), screenWidth - RUNNER_WIDTH - RUNNER_MARGIN)),
19228
+ y: Math.max(MIN_Y, Math.min(getAnimatedValue(pan.y), SAFE_MAX_Y))
19225
19229
  });
19226
19230
  pan.setValue({ x: 0, y: 0 });
19227
19231
  },
@@ -19233,8 +19237,8 @@ function MiniTestRunner({ assignmentId, onExpand, onComplete, onAdvance, onNavig
19233
19237
  pan.flattenOffset();
19234
19238
  const currentX = getAnimatedValue(pan.x);
19235
19239
  const currentY = getAnimatedValue(pan.y);
19236
- const snapX = currentX < screenWidth / 2 ? 16 : screenWidth - RUNNER_WIDTH - 16;
19237
- const snapY = Math.max(80, Math.min(currentY, screenHeight - 200));
19240
+ const snapX = currentX < screenWidth / 2 ? RUNNER_MARGIN : screenWidth - RUNNER_WIDTH - RUNNER_MARGIN;
19241
+ const snapY = Math.max(MIN_Y, Math.min(currentY, SAFE_MAX_Y));
19238
19242
  Animated3.spring(pan, {
19239
19243
  toValue: { x: snapX, y: snapY },
19240
19244
  useNativeDriver: false,
@@ -19463,6 +19467,7 @@ var styles4 = StyleSheet21.create({
19463
19467
  // src/BugBearButton.tsx
19464
19468
  var screenWidth2 = Dimensions3.get("window").width;
19465
19469
  var screenHeight2 = Dimensions3.get("window").height;
19470
+ var BOTTOM_SAFE_PADDING2 = Platform6.OS === "ios" ? 34 : 24;
19466
19471
  function BugBearButton({
19467
19472
  position = "bottom-right",
19468
19473
  buttonStyle,
@@ -19502,14 +19507,15 @@ function BugBearButton({
19502
19507
  setViewMode("closed");
19503
19508
  });
19504
19509
  };
19510
+ const buttonSize = 56;
19511
+ const margin = 16;
19512
+ const safeMaxY = screenHeight2 - maxYOffset - BOTTOM_SAFE_PADDING2;
19505
19513
  const getInitialPosition = () => {
19506
- const buttonSize = 56;
19507
- const margin = 16;
19508
19514
  if (initialX !== void 0 && initialY !== void 0) {
19509
19515
  return { x: initialX, y: initialY };
19510
19516
  }
19511
19517
  const x = position === "bottom-right" ? screenWidth2 - buttonSize - margin : margin;
19512
- const y = screenHeight2 - 160;
19518
+ const y = screenHeight2 - maxYOffset - BOTTOM_SAFE_PADDING2;
19513
19519
  return { x, y };
19514
19520
  };
19515
19521
  const initialPos = getInitialPosition();
@@ -19522,8 +19528,8 @@ function BugBearButton({
19522
19528
  onPanResponderGrant: () => {
19523
19529
  isDragging.current = false;
19524
19530
  pan.setOffset({
19525
- x: getAnimatedValue(pan.x),
19526
- y: getAnimatedValue(pan.y)
19531
+ x: Math.max(margin, Math.min(getAnimatedValue(pan.x), screenWidth2 - buttonSize - margin)),
19532
+ y: Math.max(minY, Math.min(getAnimatedValue(pan.y), safeMaxY))
19527
19533
  });
19528
19534
  pan.setValue({ x: 0, y: 0 });
19529
19535
  },
@@ -19540,10 +19546,8 @@ function BugBearButton({
19540
19546
  pan.flattenOffset();
19541
19547
  const currentX = getAnimatedValue(pan.x);
19542
19548
  const currentY = getAnimatedValue(pan.y);
19543
- const buttonSize = 56;
19544
- const margin = 16;
19545
19549
  const snapX = currentX < screenWidth2 / 2 ? margin : screenWidth2 - buttonSize - margin;
19546
- const snapY = Math.max(minY, Math.min(currentY, screenHeight2 - maxYOffset));
19550
+ const snapY = Math.max(minY, Math.min(currentY, safeMaxY));
19547
19551
  Animated4.spring(pan, {
19548
19552
  toValue: { x: snapX, y: snapY },
19549
19553
  useNativeDriver: false,
@@ -19560,7 +19564,7 @@ function BugBearButton({
19560
19564
  const pendingTests = widgetMode === "qa" ? assignments.filter((a) => a.status === "pending" || a.status === "in_progress").length : 0;
19561
19565
  const badgeCount = pendingTests + unreadCount;
19562
19566
  useEffect13(() => {
19563
- if (!panelVisible || Platform5.OS !== "android") return;
19567
+ if (!panelVisible || Platform6.OS !== "android") return;
19564
19568
  const handler = BackHandler.addEventListener("hardwareBackPress", () => {
19565
19569
  if (canGoBack) {
19566
19570
  Keyboard4.dismiss();
@@ -19756,7 +19760,7 @@ function BugBearButton({
19756
19760
  ), viewMode === "panel" && /* @__PURE__ */ React22.createElement(View22, { style: styles6.panelWrapper, pointerEvents: "box-none" }, /* @__PURE__ */ React22.createElement(
19757
19761
  KeyboardAvoidingView,
19758
19762
  {
19759
- behavior: Platform5.OS === "ios" ? "padding" : "height",
19763
+ behavior: Platform6.OS === "ios" ? "padding" : "height",
19760
19764
  style: styles6.panelKeyboardAvoid,
19761
19765
  pointerEvents: "box-none"
19762
19766
  },
@@ -19950,7 +19954,7 @@ function createStyles16() {
19950
19954
  },
19951
19955
  contentContainer: {
19952
19956
  padding: 16,
19953
- paddingBottom: Platform5.OS === "ios" ? 50 : 28
19957
+ paddingBottom: Platform6.OS === "ios" ? 50 : 28
19954
19958
  },
19955
19959
  // Loading
19956
19960
  loadingContainer: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbearai/react-native",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "BugBear React Native components for mobile apps",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",