@dubsdotapp/expo 0.2.76 → 0.2.77

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
@@ -2536,11 +2536,23 @@ var DICEBEAR_STYLES = [
2536
2536
  "big-smile",
2537
2537
  "thumbs"
2538
2538
  ];
2539
+ var BG_COLORS = [
2540
+ "1a1a2e",
2541
+ "f43f5e",
2542
+ "f97316",
2543
+ "eab308",
2544
+ "22c55e",
2545
+ "3b82f6",
2546
+ "8b5cf6",
2547
+ "ec4899",
2548
+ "06b6d4",
2549
+ "64748b"
2550
+ ];
2539
2551
  function generateSeed() {
2540
2552
  return Math.random().toString(36).slice(2, 10);
2541
2553
  }
2542
- function getAvatarUrl(style, seed, size = 256) {
2543
- return `https://api.dicebear.com/9.x/${style}/png?seed=${seed}&size=${size}`;
2554
+ function getAvatarUrl(style, seed, bg = "1a1a2e", size = 256) {
2555
+ return `https://api.dicebear.com/9.x/${style}/png?seed=${seed}&backgroundColor=${bg}&size=${size}`;
2544
2556
  }
2545
2557
  function AuthGate({
2546
2558
  children,
@@ -2720,6 +2732,7 @@ function DefaultRegistrationScreen({
2720
2732
  const [step, setStep] = (0, import_react17.useState)(0);
2721
2733
  const [avatarSeed, setAvatarSeed] = (0, import_react17.useState)(generateSeed);
2722
2734
  const [avatarStyle, setAvatarStyle] = (0, import_react17.useState)("adventurer");
2735
+ const [avatarBg, setAvatarBg] = (0, import_react17.useState)("1a1a2e");
2723
2736
  const [showStyles, setShowStyles] = (0, import_react17.useState)(false);
2724
2737
  const [username, setUsername] = (0, import_react17.useState)("");
2725
2738
  const [referralCode, setReferralCode] = (0, import_react17.useState)("");
@@ -2728,7 +2741,7 @@ function DefaultRegistrationScreen({
2728
2741
  const debounceRef = (0, import_react17.useRef)(null);
2729
2742
  const fadeAnim = (0, import_react17.useRef)(new import_react_native7.Animated.Value(1)).current;
2730
2743
  const slideAnim = (0, import_react17.useRef)(new import_react_native7.Animated.Value(0)).current;
2731
- const avatarUrl = getAvatarUrl(avatarStyle, avatarSeed);
2744
+ const avatarUrl = getAvatarUrl(avatarStyle, avatarSeed, avatarBg);
2732
2745
  (0, import_react17.useEffect)(() => {
2733
2746
  if (debounceRef.current) clearTimeout(debounceRef.current);
2734
2747
  const trimmed = username.trim();
@@ -2801,15 +2814,30 @@ function DefaultRegistrationScreen({
2801
2814
  }
2802
2815
  )
2803
2816
  ] }),
2804
- showStyles && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, style: s.styleScroll, children: DICEBEAR_STYLES.map((st) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2805
- import_react_native7.TouchableOpacity,
2806
- {
2807
- onPress: () => setAvatarStyle(st),
2808
- style: [s.styleThumbWrap, { borderColor: st === avatarStyle ? accent : t.border }],
2809
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Image, { source: { uri: getAvatarUrl(st, avatarSeed, 80) }, style: s.styleThumb })
2810
- },
2811
- st
2812
- )) })
2817
+ showStyles && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
2818
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, style: s.styleScroll, children: DICEBEAR_STYLES.map((st) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2819
+ import_react_native7.TouchableOpacity,
2820
+ {
2821
+ onPress: () => setAvatarStyle(st),
2822
+ style: [s.styleThumbWrap, { borderColor: st === avatarStyle ? accent : t.border }],
2823
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Image, { source: { uri: getAvatarUrl(st, avatarSeed, avatarBg, 80) }, style: s.styleThumb })
2824
+ },
2825
+ st
2826
+ )) }),
2827
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.subtitle, { color: t.textMuted, marginTop: 8 }], children: "Background Color" }),
2828
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, style: s.styleScroll, children: BG_COLORS.map((color) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2829
+ import_react_native7.TouchableOpacity,
2830
+ {
2831
+ onPress: () => setAvatarBg(color),
2832
+ style: [
2833
+ s.colorSwatch,
2834
+ { backgroundColor: `#${color}` },
2835
+ color === avatarBg && { borderColor: accent, borderWidth: 2.5 }
2836
+ ]
2837
+ },
2838
+ color
2839
+ )) })
2840
+ ] })
2813
2841
  ] }),
2814
2842
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: s.bottomRow, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2815
2843
  import_react_native7.TouchableOpacity,
@@ -3120,6 +3148,7 @@ var s = import_react_native7.StyleSheet.create({
3120
3148
  styleScroll: { paddingHorizontal: 24, marginTop: 4 },
3121
3149
  styleThumbWrap: { borderWidth: 2, borderRadius: 12, padding: 3, marginRight: 10 },
3122
3150
  styleThumb: { width: 52, height: 52, borderRadius: 10, backgroundColor: "#E5E5EA" },
3151
+ colorSwatch: { width: 32, height: 32, borderRadius: 16, borderWidth: 1.5, borderColor: "rgba(255,255,255,0.15)", marginRight: 10 },
3123
3152
  // Input
3124
3153
  inputGroup: { paddingHorizontal: 24, gap: 6 },
3125
3154
  inputLabel: { fontSize: 15, fontWeight: "600" },
@@ -3568,20 +3597,35 @@ var DICEBEAR_STYLES2 = [
3568
3597
  "big-smile",
3569
3598
  "thumbs"
3570
3599
  ];
3600
+ var BG_COLORS2 = [
3601
+ "1a1a2e",
3602
+ "f43f5e",
3603
+ "f97316",
3604
+ "eab308",
3605
+ "22c55e",
3606
+ "3b82f6",
3607
+ "8b5cf6",
3608
+ "ec4899",
3609
+ "06b6d4",
3610
+ "64748b"
3611
+ ];
3571
3612
  function generateSeed2() {
3572
3613
  return Math.random().toString(36).slice(2, 10);
3573
3614
  }
3574
- function getAvatarUrl2(style, seed, size = 256) {
3575
- return `https://api.dicebear.com/9.x/${style}/png?seed=${seed}&size=${size}`;
3615
+ function getAvatarUrl2(style, seed, bg = "1a1a2e", size = 256) {
3616
+ return `https://api.dicebear.com/9.x/${style}/png?seed=${seed}&backgroundColor=${bg}&size=${size}`;
3576
3617
  }
3577
3618
  function parseAvatarUrl(url) {
3578
- if (!url) return { style: "adventurer", seed: generateSeed2() };
3619
+ if (!url) return { style: "adventurer", seed: generateSeed2(), bg: "1a1a2e" };
3579
3620
  try {
3580
3621
  const match = url.match(/\/\d+\.x\/([^/]+)\/(?:png|svg)\?seed=([^&]+)/);
3581
- if (match) return { style: match[1], seed: match[2] };
3622
+ if (match) {
3623
+ const bgMatch = url.match(/backgroundColor=([^&]+)/);
3624
+ return { style: match[1], seed: match[2], bg: bgMatch?.[1] || "1a1a2e" };
3625
+ }
3582
3626
  } catch {
3583
3627
  }
3584
- return { style: "adventurer", seed: generateSeed2() };
3628
+ return { style: "adventurer", seed: generateSeed2(), bg: "1a1a2e" };
3585
3629
  }
3586
3630
  function truncateAddress3(address, chars = 4) {
3587
3631
  if (address.length <= chars * 2 + 3) return address;
@@ -3601,12 +3645,14 @@ function UserProfileSheet({
3601
3645
  const parsed = (0, import_react20.useMemo)(() => parseAvatarUrl(user.avatar), [user.avatar]);
3602
3646
  const [avatarStyle, setAvatarStyle] = (0, import_react20.useState)(parsed.style);
3603
3647
  const [avatarSeed, setAvatarSeed] = (0, import_react20.useState)(parsed.seed);
3648
+ const [bgColor, setBgColor] = (0, import_react20.useState)(parsed.bg);
3604
3649
  const [saving, setSaving] = (0, import_react20.useState)(false);
3605
3650
  const [error, setError] = (0, import_react20.useState)(null);
3606
3651
  (0, import_react20.useEffect)(() => {
3607
3652
  const p = parseAvatarUrl(user.avatar);
3608
3653
  setAvatarStyle(p.style);
3609
3654
  setAvatarSeed(p.seed);
3655
+ setBgColor(p.bg);
3610
3656
  }, [user.avatar]);
3611
3657
  (0, import_react20.useEffect)(() => {
3612
3658
  import_react_native10.Animated.timing(overlayOpacity, {
@@ -3618,28 +3664,8 @@ function UserProfileSheet({
3618
3664
  (0, import_react20.useEffect)(() => {
3619
3665
  if (visible) setError(null);
3620
3666
  }, [visible]);
3621
- const currentAvatarUrl = getAvatarUrl2(avatarStyle, avatarSeed);
3622
- const handleSelectStyle = (0, import_react20.useCallback)(
3623
- async (style) => {
3624
- const newUrl = getAvatarUrl2(style, avatarSeed);
3625
- setAvatarStyle(style);
3626
- setSaving(true);
3627
- setError(null);
3628
- try {
3629
- await client.updateProfile({ avatar: newUrl });
3630
- onAvatarUpdated?.(newUrl);
3631
- } catch (err) {
3632
- setError(err instanceof Error ? err.message : "Failed to update avatar");
3633
- } finally {
3634
- setSaving(false);
3635
- }
3636
- },
3637
- [avatarSeed, client, onAvatarUpdated]
3638
- );
3639
- const handleShuffle = (0, import_react20.useCallback)(async () => {
3640
- const newSeed = generateSeed2();
3641
- const newUrl = getAvatarUrl2(avatarStyle, newSeed);
3642
- setAvatarSeed(newSeed);
3667
+ const currentAvatarUrl = getAvatarUrl2(avatarStyle, avatarSeed, bgColor);
3668
+ const saveAvatar = (0, import_react20.useCallback)(async (newUrl) => {
3643
3669
  setSaving(true);
3644
3670
  setError(null);
3645
3671
  try {
@@ -3650,7 +3676,26 @@ function UserProfileSheet({
3650
3676
  } finally {
3651
3677
  setSaving(false);
3652
3678
  }
3653
- }, [avatarStyle, client, onAvatarUpdated]);
3679
+ }, [client, onAvatarUpdated]);
3680
+ const handleSelectStyle = (0, import_react20.useCallback)(
3681
+ (style) => {
3682
+ setAvatarStyle(style);
3683
+ saveAvatar(getAvatarUrl2(style, avatarSeed, bgColor));
3684
+ },
3685
+ [avatarSeed, bgColor, saveAvatar]
3686
+ );
3687
+ const handleShuffle = (0, import_react20.useCallback)(() => {
3688
+ const newSeed = generateSeed2();
3689
+ setAvatarSeed(newSeed);
3690
+ saveAvatar(getAvatarUrl2(avatarStyle, newSeed, bgColor));
3691
+ }, [avatarStyle, bgColor, saveAvatar]);
3692
+ const handleSelectBgColor = (0, import_react20.useCallback)(
3693
+ (color) => {
3694
+ setBgColor(color);
3695
+ saveAvatar(getAvatarUrl2(avatarStyle, avatarSeed, color));
3696
+ },
3697
+ [avatarStyle, avatarSeed, saveAvatar]
3698
+ );
3654
3699
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
3655
3700
  import_react_native10.Modal,
3656
3701
  {
@@ -3731,7 +3776,7 @@ function UserProfileSheet({
3731
3776
  children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3732
3777
  import_react_native10.Image,
3733
3778
  {
3734
- source: { uri: getAvatarUrl2(style, avatarSeed, 80) },
3779
+ source: { uri: getAvatarUrl2(style, avatarSeed, bgColor, 80) },
3735
3780
  style: styles4.styleTileImage
3736
3781
  }
3737
3782
  )
@@ -3740,6 +3785,32 @@ function UserProfileSheet({
3740
3785
  );
3741
3786
  })
3742
3787
  }
3788
+ ),
3789
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native10.Text, { style: [styles4.sectionLabel, { color: t.textSecondary, marginTop: 4 }], children: "Background Color" }),
3790
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3791
+ import_react_native10.ScrollView,
3792
+ {
3793
+ horizontal: true,
3794
+ showsHorizontalScrollIndicator: false,
3795
+ contentContainerStyle: styles4.colorPickerContent,
3796
+ children: BG_COLORS2.map((color) => {
3797
+ const isSelected = color === bgColor;
3798
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3799
+ import_react_native10.TouchableOpacity,
3800
+ {
3801
+ onPress: () => handleSelectBgColor(color),
3802
+ activeOpacity: 0.7,
3803
+ disabled: saving,
3804
+ style: [
3805
+ styles4.colorSwatch,
3806
+ { backgroundColor: `#${color}` },
3807
+ isSelected && { borderColor: t.accent, borderWidth: 2.5 }
3808
+ ]
3809
+ },
3810
+ color
3811
+ );
3812
+ })
3813
+ }
3743
3814
  )
3744
3815
  ] }),
3745
3816
  error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native10.View, { style: [styles4.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native10.Text, { style: [styles4.errorText, { color: t.errorText }], children: error }) }) : null,
@@ -3901,6 +3972,16 @@ var styles4 = import_react_native10.StyleSheet.create({
3901
3972
  stylePickerContent: {
3902
3973
  gap: 10
3903
3974
  },
3975
+ colorPickerContent: {
3976
+ gap: 8
3977
+ },
3978
+ colorSwatch: {
3979
+ width: 32,
3980
+ height: 32,
3981
+ borderRadius: 16,
3982
+ borderWidth: 1.5,
3983
+ borderColor: "rgba(255,255,255,0.15)"
3984
+ },
3904
3985
  styleTile: {
3905
3986
  width: 72,
3906
3987
  height: 72,