@jobber/components-native 0.113.8 → 0.114.0

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.
@@ -13,6 +13,10 @@ import { tokens } from "@jobber/design";
13
13
  import { useStyles } from "./BottomSheet.style";
14
14
  import { BottomSheetOption } from "./components/BottomSheetOption";
15
15
  import { useBottomSheetBackHandler } from "./hooks/useBottomSheetBackHandler";
16
+ import {
17
+ AtlantisThemeContextProvider,
18
+ useAtlantisTheme,
19
+ } from "../AtlantisThemeContext";
16
20
  import { Divider } from "../Divider";
17
21
  import { Heading } from "../Heading";
18
22
  import { useIsScreenReaderEnabled } from "../hooks";
@@ -52,6 +56,7 @@ export interface BottomSheetRef {
52
56
  close: () => void;
53
57
  }
54
58
 
59
+ // eslint-disable-next-line max-statements
55
60
  export function BottomSheet({
56
61
  children,
57
62
  showCancel,
@@ -62,6 +67,7 @@ export function BottomSheet({
62
67
  ref,
63
68
  }: BottomSheetProps & { readonly ref?: React.Ref<BottomSheetRef> }) {
64
69
  const styles = useStyles();
70
+ const { effectiveTheme } = useAtlantisTheme();
65
71
  const isScreenReaderEnabled = useIsScreenReaderEnabled();
66
72
 
67
73
  const cancellable = (showCancel && !loading) || isScreenReaderEnabled;
@@ -116,18 +122,26 @@ export function BottomSheet({
116
122
  keyboardBlurBehavior="restore"
117
123
  handleStyle={styles.handle}
118
124
  >
119
- <BottomSheetView
120
- style={{
121
- paddingBottom: insets.bottom + tokens["space-small"],
122
- paddingTop: tokens["space-small"],
123
- }}
124
- >
125
- {heading && <Header heading={heading} styles={styles} />}
126
- {children}
127
- {cancellable && (
128
- <Footer styles={styles} close={close} cancelLabel={t("cancel")} />
129
- )}
130
- </BottomSheetView>
125
+ {/*
126
+ BottomSheetModal renders through a portal mounted outside this
127
+ component's subtree, so AtlantisThemeContext is lost. Re-apply the
128
+ active effective theme so descendants continue to resolve the correct
129
+ themed tokens.
130
+ */}
131
+ <AtlantisThemeContextProvider dangerouslyOverrideTheme={effectiveTheme}>
132
+ <BottomSheetView
133
+ style={{
134
+ paddingBottom: insets.bottom + tokens["space-small"],
135
+ paddingTop: tokens["space-small"],
136
+ }}
137
+ >
138
+ {heading && <Header heading={heading} styles={styles} />}
139
+ {children}
140
+ {cancellable && (
141
+ <Footer styles={styles} close={close} cancelLabel={t("cancel")} />
142
+ )}
143
+ </BottomSheetView>
144
+ </AtlantisThemeContextProvider>
131
145
  </BottomSheetModal>
132
146
  );
133
147
  }
@@ -99,7 +99,7 @@ export function ContentOverlay({
99
99
 
100
100
  const styles = useStyles();
101
101
  const { t } = useAtlantisI18n();
102
- const { theme, tokens } = useAtlantisTheme();
102
+ const { effectiveTheme, tokens } = useAtlantisTheme();
103
103
  const isScreenReaderEnabled = useIsScreenReaderEnabled();
104
104
 
105
105
  const behavior = computeContentOverlayBehavior(
@@ -327,7 +327,7 @@ export function ContentOverlay({
327
327
  the active theme here so descendants (e.g. the header title) resolve the
328
328
  correct themed tokens.
329
329
  */}
330
- <AtlantisThemeContextProvider dangerouslyOverrideTheme={theme}>
330
+ <AtlantisThemeContextProvider dangerouslyOverrideTheme={effectiveTheme}>
331
331
  <ContentOverlayKeyboardContext.Provider value={scrollEnabled}>
332
332
  {scrollEnabled ? (
333
333
  <BottomSheetKeyboardAwareScrollView