@bigbinary/neeto-commons-rn 2.0.3 → 2.2.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.
Files changed (91) hide show
  1. package/align-deps-preset.js +84 -0
  2. package/lib/typescript/api/app_version.d.ts.map +1 -1
  3. package/lib/typescript/components/AppVersion.d.ts.map +1 -1
  4. package/lib/typescript/components/DevToolsBridge.d.ts +8 -0
  5. package/lib/typescript/components/DevToolsBridge.d.ts.map +1 -0
  6. package/lib/typescript/components/Header.d.ts.map +1 -1
  7. package/lib/typescript/components/ToggleSwitch.d.ts.map +1 -1
  8. package/lib/typescript/components/constants.d.ts +1 -0
  9. package/lib/typescript/components/constants.d.ts.map +1 -1
  10. package/lib/typescript/config/axios/constants.d.ts +1 -0
  11. package/lib/typescript/config/axios/constants.d.ts.map +1 -1
  12. package/lib/typescript/config/axios/groupingKey.d.ts +12 -0
  13. package/lib/typescript/config/axios/groupingKey.d.ts.map +1 -0
  14. package/lib/typescript/config/axios/index.d.ts.map +1 -1
  15. package/lib/typescript/config/bugsnag.d.ts +1 -1
  16. package/lib/typescript/config/bugsnag.d.ts.map +1 -1
  17. package/lib/typescript/constants/index.d.ts +10 -0
  18. package/lib/typescript/constants/index.d.ts.map +1 -1
  19. package/lib/typescript/helpers/notifications/firebaseMessaging.android.d.ts +10 -0
  20. package/lib/typescript/helpers/notifications/firebaseMessaging.android.d.ts.map +1 -0
  21. package/lib/typescript/helpers/notifications/firebaseMessaging.d.ts +24 -0
  22. package/lib/typescript/helpers/notifications/firebaseMessaging.d.ts.map +1 -0
  23. package/lib/typescript/helpers/notifications/getDeviceToken.d.ts.map +1 -1
  24. package/lib/typescript/helpers/notifications/index.d.ts +1 -0
  25. package/lib/typescript/helpers/notifications/index.d.ts.map +1 -1
  26. package/lib/typescript/helpers/scale.d.ts +10 -0
  27. package/lib/typescript/helpers/scale.d.ts.map +1 -1
  28. package/lib/typescript/helpers/utils.d.ts.map +1 -1
  29. package/lib/typescript/hooks/query/useAppVersionApi.d.ts.map +1 -1
  30. package/lib/typescript/hooks/query/useRolesApi.d.ts.map +1 -1
  31. package/lib/typescript/initializers/constants.d.ts +4 -0
  32. package/lib/typescript/initializers/constants.d.ts.map +1 -0
  33. package/lib/typescript/initializers/index.d.ts +2 -2
  34. package/lib/typescript/initializers/index.d.ts.map +1 -1
  35. package/lib/typescript/initializers/logRocket.d.ts +11 -1
  36. package/lib/typescript/initializers/logRocket.d.ts.map +1 -1
  37. package/lib/typescript/providers/NeetoCommonsRNProvider.d.ts +8 -1
  38. package/lib/typescript/providers/NeetoCommonsRNProvider.d.ts.map +1 -1
  39. package/lib/typescript/screens/authentication/LoginScreen.d.ts.map +1 -1
  40. package/lib/typescript/screens/authentication/OTPVerificationScreen.d.ts.map +1 -1
  41. package/lib/typescript/screens/authentication/Organization.d.ts.map +1 -1
  42. package/lib/typescript/screens/authentication/SubDomainScreen.d.ts.map +1 -1
  43. package/lib/typescript/screens/profile/ProfileScreen.d.ts.map +1 -1
  44. package/lib/typescript/screens/team_members/ProductSelect.d.ts.map +1 -1
  45. package/lib/typescript/screens/team_members/index.d.ts.map +1 -1
  46. package/lib/typescript/screens/team_members/utils.d.ts.map +1 -1
  47. package/lib/typescript/store/index.d.ts +3 -2
  48. package/lib/typescript/store/index.d.ts.map +1 -1
  49. package/lib/typescript/utils/apiHelpers.d.ts.map +1 -1
  50. package/metro-devtools.js +48 -0
  51. package/package.json +485 -16
  52. package/src/api/app_version.ts +42 -2
  53. package/src/components/AppVersion.ts +46 -30
  54. package/src/components/DevToolsBridge.ts +40 -0
  55. package/src/components/Header.tsx +3 -1
  56. package/src/components/NotificationIcon.tsx +1 -1
  57. package/src/components/ToggleSwitch.tsx +2 -1
  58. package/src/components/WorkspaceSwitcherPane.tsx +1 -1
  59. package/src/components/constants.ts +4 -0
  60. package/src/config/axios/constants.ts +3 -0
  61. package/src/config/axios/groupingKey.ts +25 -0
  62. package/src/config/axios/index.ts +7 -4
  63. package/src/config/bugsnag.ts +17 -1
  64. package/src/constants/index.ts +13 -0
  65. package/src/contexts/localization.tsx +1 -1
  66. package/src/helpers/notifications/firebaseMessaging.android.ts +21 -0
  67. package/src/helpers/notifications/firebaseMessaging.ts +37 -0
  68. package/src/helpers/notifications/getDeviceToken.ts +1 -2
  69. package/src/helpers/notifications/index.ts +1 -0
  70. package/src/helpers/notifications/registerBackgroundHandlers.ts +1 -1
  71. package/src/helpers/notifications/usePushNotification.ts +1 -1
  72. package/src/helpers/scale.ts +21 -3
  73. package/src/helpers/utils.ts +2 -1
  74. package/src/hooks/query/useAppVersionApi.ts +9 -0
  75. package/src/hooks/query/useRolesApi.ts +3 -1
  76. package/src/initializers/constants.ts +3 -0
  77. package/src/initializers/index.ts +12 -2
  78. package/src/initializers/logRocket.ts +111 -20
  79. package/src/providers/NeetoCommonsRNProvider.tsx +23 -0
  80. package/src/screens/authentication/IncompleteOnboardingInfo.tsx +2 -2
  81. package/src/screens/authentication/LoginScreen.tsx +50 -39
  82. package/src/screens/authentication/OTPVerificationScreen.tsx +17 -41
  83. package/src/screens/authentication/Organization.tsx +2 -6
  84. package/src/screens/authentication/SubDomainScreen.tsx +38 -70
  85. package/src/screens/profile/ProfileScreen.tsx +2 -1
  86. package/src/screens/team_members/Card.tsx +1 -1
  87. package/src/screens/team_members/ProductSelect.tsx +6 -7
  88. package/src/screens/team_members/index.tsx +2 -1
  89. package/src/screens/team_members/utils.ts +3 -1
  90. package/src/store/index.ts +68 -1
  91. package/src/utils/apiHelpers.ts +4 -1
@@ -1,25 +1,116 @@
1
1
  import LogRocket from "@logrocket/react-native";
2
2
  import Config from "react-native-config";
3
3
 
4
- import { Store } from "../store";
5
-
6
- export const logRocket = () => {
7
- if (!Config.LOG_ROCKET_API_KEY || __DEV__) return;
8
-
9
- const { isLoggedIn, userId, name, email, subdomain } = Store.getState().auth;
10
-
11
- LogRocket.init(Config.LOG_ROCKET_API_KEY);
12
-
13
- if (!isLoggedIn) {
14
- //End the current session gracefully during logout
15
- LogRocket.shutdown();
16
- // Reinitialize LogRocket to capture the login screen after logout
17
- LogRocket.init(Config.LOG_ROCKET_API_KEY);
18
- } else {
19
- LogRocket.identify(userId, {
20
- name,
21
- email,
22
- organization: subdomain,
23
- });
4
+ import {
5
+ DEFAULT_SAMPLE_RATE,
6
+ SAMPLE_DECISION_TTL_MS,
7
+ SAMPLE_STORAGE_KEY,
8
+ } from "./constants";
9
+
10
+ import { getItem, setItem } from "../helpers/asyncStore";
11
+
12
+ interface SampleDecision {
13
+ sampled: boolean;
14
+ rate: number;
15
+ rolledAt: number;
16
+ }
17
+
18
+ interface LogRocketUser {
19
+ userId: string;
20
+ name: string;
21
+ email: string;
22
+ subdomain: string;
23
+ }
24
+
25
+ let initialized = false;
26
+ let initPromise: Promise<void> | null = null;
27
+ let sessionURL: string | null = null;
28
+ // Bumped by shutdownLogRocket so an init still awaiting the sampling roll
29
+ // knows it was cancelled and must not start recording.
30
+ let generation = 0;
31
+
32
+ // Null until LogRocket's backend accepts the session (1-5s after init), and
33
+ // null on unsampled devices — callers must handle the absence.
34
+ export const getLogRocketSessionURL = () => sessionURL;
35
+
36
+ // 0 falls back to the default: turning recording off is done by removing or
37
+ // rotating the API key, never through the sample rate.
38
+ const getSampleRate = () =>
39
+ parseInt(Config.LOG_ROCKET_SAMPLE_RATE ?? "", 10) || DEFAULT_SAMPLE_RATE;
40
+
41
+ // A device keeps its decision until the TTL passes or the rate changes, so
42
+ // the sampled population rotates instead of locking in the first 10% forever.
43
+ const shouldSample = async () => {
44
+ const rate = getSampleRate();
45
+ const stored = await getItem<SampleDecision>(SAMPLE_STORAGE_KEY);
46
+
47
+ const isCurrent =
48
+ stored !== null &&
49
+ stored.rate === rate &&
50
+ Date.now() - stored.rolledAt < SAMPLE_DECISION_TTL_MS;
51
+
52
+ if (isCurrent) return stored.sampled;
53
+
54
+ const sampled = Math.random() * 100 < rate;
55
+ await setItem(SAMPLE_STORAGE_KEY, { sampled, rate, rolledAt: Date.now() });
56
+
57
+ return sampled;
58
+ };
59
+
60
+ export const initLogRocket = async () => {
61
+ const apiKey = Config.LOG_ROCKET_API_KEY;
62
+ if (initialized || __DEV__ || !apiKey) return;
63
+
64
+ initPromise ??= (async () => {
65
+ try {
66
+ const startedAs = generation;
67
+ if (!(await shouldSample()) || startedAs !== generation) return;
68
+
69
+ LogRocket.init(apiKey);
70
+ initialized = true;
71
+ LogRocket.getSessionURL(url => {
72
+ // The backend accepts the session 1-5s after init; by then a logout
73
+ // may have ended it, and its URL must not resurface.
74
+ if (startedAs === generation) {
75
+ sessionURL = url;
76
+ }
77
+ });
78
+ } catch {
79
+ // Recording is expendable; a LogRocket failure must never reject the
80
+ // promise that initLogRocket and identifyLogRocketUser await.
81
+ }
82
+ })();
83
+
84
+ await initPromise;
85
+ };
86
+
87
+ export const identifyLogRocketUser = async ({
88
+ userId,
89
+ name,
90
+ email,
91
+ subdomain,
92
+ }: LogRocketUser) => {
93
+ // Callers invoke this right after initLogRocket(), often in the same tick;
94
+ // waiting on the pending init keeps that pattern from dropping the identity.
95
+ if (initPromise) await initPromise;
96
+
97
+ if (!initialized) return;
98
+
99
+ try {
100
+ LogRocket.identify(userId, { name, email, organization: subdomain });
101
+ } catch {
102
+ // Fire-and-forget callers must never see a rejection from LogRocket.
24
103
  }
25
104
  };
105
+
106
+ export const shutdownLogRocket = () => {
107
+ generation += 1;
108
+ initPromise = null;
109
+ // The replay ends here, so an error after logout must not link to it.
110
+ sessionURL = null;
111
+
112
+ if (!initialized) return;
113
+
114
+ LogRocket.shutdown();
115
+ initialized = false;
116
+ };
@@ -6,6 +6,7 @@ import React, {
6
6
  } from "react";
7
7
 
8
8
  import { type NavigationContainerRef } from "@react-navigation/native";
9
+ import { type QueryClient } from "@tanstack/react-query";
9
10
  import { Provider } from "react-redux";
10
11
  import { type Reducer } from "redux";
11
12
  import { PersistGate } from "redux-persist/integration/react";
@@ -25,6 +26,20 @@ import { updateRootReducer } from "../store/utils";
25
26
 
26
27
  initializeConfigs();
27
28
 
29
+ // Same module-level __DEV__ gate as the store's Rozenite enhancer: metro
30
+ // inlines __DEV__ and strips the require — and the plugin packages behind
31
+ // it — from release bundles before dependency collection. The try/catch
32
+ // keeps hosts working if the plugins are ever absent.
33
+ let DevToolsBridge: React.ComponentType<{ queryClient?: QueryClient }> | null =
34
+ null;
35
+ if (__DEV__) {
36
+ try {
37
+ DevToolsBridge = require("../components/DevToolsBridge").default;
38
+ } catch {
39
+ DevToolsBridge = null;
40
+ }
41
+ }
42
+
28
43
  export interface NeetoCommonsRNProviderProps {
29
44
  appName: string;
30
45
  hostNavigationRef?: React.RefObject<NavigationContainerRef<
@@ -33,6 +48,12 @@ export interface NeetoCommonsRNProviderProps {
33
48
  hostStrings?: HostStrings;
34
49
  hostRootReducer: Record<string, Reducer>;
35
50
  blacklistedReducers?: string[];
51
+ /**
52
+ * The host app's react-query client. Dev-only: when provided, the
53
+ * Rozenite TanStack Query DevTools panel streams this client's cache.
54
+ * Network and Storage panels work without it.
55
+ */
56
+ queryClient?: QueryClient;
36
57
  children?: ReactNode;
37
58
  }
38
59
 
@@ -42,6 +63,7 @@ export const NeetoCommonsRNProvider = ({
42
63
  hostStrings,
43
64
  hostRootReducer,
44
65
  blacklistedReducers,
66
+ queryClient,
45
67
  children,
46
68
  }: NeetoCommonsRNProviderProps) => {
47
69
  const prevReducersRef = useRef<Record<string, Reducer> | null>(null);
@@ -69,6 +91,7 @@ export const NeetoCommonsRNProvider = ({
69
91
  <Provider store={Store}>
70
92
  <PersistGate loading={null} persistor={Persistor}>
71
93
  <LocalizationProvider hostStrings={hostStrings}>
94
+ {DevToolsBridge ? <DevToolsBridge queryClient={queryClient} /> : null}
72
95
  {children}
73
96
  </LocalizationProvider>
74
97
  </PersistGate>
@@ -1,6 +1,7 @@
1
1
  import React, { useCallback } from "react";
2
2
  import { Linking, StyleSheet } from "react-native";
3
3
 
4
+ import Left from "@bigbinary/neeto-icons-rn/icons/Left";
4
5
  import {
5
6
  Container,
6
7
  ParentView,
@@ -9,7 +10,6 @@ import {
9
10
  lightTheme,
10
11
  } from "@bigbinary/neetoui-rn";
11
12
  import Config from "react-native-config";
12
- import Icon from "react-native-remix-icon";
13
13
 
14
14
  import { HyperlinkText } from "../../components/HyperlinkText";
15
15
  import { useLocalization } from "../../contexts/localization";
@@ -64,7 +64,7 @@ export const IncompleteOnboardingInfo = ({
64
64
  style={styles.backButton}
65
65
  onPress={onBackPress}
66
66
  >
67
- <Icon name="arrow-left-s-line" size={moderateScale(24)} />
67
+ <Left size={moderateScale(24)} />
68
68
  </Touchable>
69
69
  </Container>
70
70
  <Container style={styles.body}>
@@ -5,6 +5,7 @@ import {
5
5
  Container,
6
6
  Input,
7
7
  ParentView,
8
+ ScrollView,
8
9
  Toast,
9
10
  Typography,
10
11
  lightTheme,
@@ -37,7 +38,6 @@ const styles = StyleSheet.create({
37
38
  flex: 1,
38
39
  },
39
40
  body: {
40
- flex: 1,
41
41
  marginHorizontal: 16,
42
42
  },
43
43
  inputWrapper: {
@@ -45,11 +45,15 @@ const styles = StyleSheet.create({
45
45
  marginBottom: 32,
46
46
  marginTop: 18,
47
47
  },
48
+ // `marginTop: auto` inside the grow-to-fill scroll content parks this at
49
+ // the bottom whenever the screen has slack, and lets it flow below the
50
+ // auth buttons when it does not. Absolute positioning used to pin it 50dp
51
+ // from the bottom, which landscape turned into an overlay across the
52
+ // middle of the form.
48
53
  versionText: {
49
- position: "absolute",
50
- left: 0,
51
- right: 0,
52
- bottom: moderateScale(50),
54
+ marginBottom: moderateScale(24),
55
+ marginTop: "auto",
56
+ paddingTop: moderateScale(24),
53
57
  textAlign: "center",
54
58
  },
55
59
  androidVersionText: {
@@ -129,42 +133,49 @@ export const LoginScreen = () => {
129
133
  barStyle="dark-content"
130
134
  style={styles.screen}
131
135
  >
132
- <Container style={styles.body}>
133
- {/*
134
- The v2 `lineHeight` override has no v3 counterpart: ScreenHeader
135
- takes only `title` and a container `style`, and sets the title's
136
- line height itself on Android.
137
- */}
138
- <ScreenHeader title={strings.commons.headers.login} />
139
- <Container style={styles.inputWrapper}>
140
- <Input
141
- autoCapitalize="none"
142
- error={touched?.email ? errors?.email : ""}
143
- keyboardType="email-address"
144
- label={strings.commons.labels.Email}
145
- value={email}
146
- onBlur={() => setFieldValue("email", email.toLowerCase())}
147
- onChangeText={handleChange("email")}
136
+ {/*
137
+ Landscape (and any small viewport with the keyboard up) leaves the
138
+ auth buttons taller than the screen, so the content scrolls instead
139
+ of being clipped.
140
+ */}
141
+ <ScrollView>
142
+ <Container style={styles.body}>
143
+ {/*
144
+ The v2 `lineHeight` override has no v3 counterpart: ScreenHeader
145
+ takes only `title` and a container `style`, and sets the title's
146
+ line height itself on Android.
147
+ */}
148
+ <ScreenHeader title={strings.commons.headers.login} />
149
+ <Container style={styles.inputWrapper}>
150
+ <Input
151
+ autoCapitalize="none"
152
+ error={touched?.email ? errors?.email : ""}
153
+ keyboardType="email-address"
154
+ label={strings.commons.labels.Email}
155
+ value={email}
156
+ onBlur={() => setFieldValue("email", email.toLowerCase())}
157
+ onChangeText={handleChange("email")}
158
+ />
159
+ </Container>
160
+ <AuthOptions
161
+ buttonLoading={isGeneratingOTP}
162
+ handleSubmit={handleSubmit}
148
163
  />
149
164
  </Container>
150
- <AuthOptions
151
- buttonLoading={isGeneratingOTP}
152
- handleSubmit={handleSubmit}
153
- />
154
- </Container>
155
- <Typography
156
- color={lightTheme.colors.palette.grey600}
157
- size="xs"
158
- weight="regular"
159
- style={StyleSheet.flatten([
160
- styles.versionText,
161
- Platform.OS === "android" && styles.androidVersionText,
162
- ])}
163
- >
164
- {Config.APP_DISPLAY_NAME}
165
- {strings.commons.common.version}
166
- {DeviceInfo.getVersion()}
167
- </Typography>
165
+ <Typography
166
+ color={lightTheme.colors.palette.grey600}
167
+ size="xs"
168
+ weight="regular"
169
+ style={StyleSheet.flatten([
170
+ styles.versionText,
171
+ Platform.OS === "android" && styles.androidVersionText,
172
+ ])}
173
+ >
174
+ {Config.APP_DISPLAY_NAME}
175
+ {strings.commons.common.version}
176
+ {DeviceInfo.getVersion()}
177
+ </Typography>
178
+ </ScrollView>
168
179
  </ParentView>
169
180
  );
170
181
  };
@@ -4,15 +4,14 @@ import { StyleSheet } from "react-native";
4
4
  import {
5
5
  Button,
6
6
  Container,
7
+ Header,
7
8
  Input,
8
9
  ParentView,
9
10
  Toast,
10
- Touchable,
11
11
  Typography,
12
12
  lightTheme,
13
13
  } from "@bigbinary/neetoui-rn";
14
14
  import { useFocusEffect } from "@react-navigation/native";
15
- import Icon from "react-native-remix-icon";
16
15
 
17
16
  import { useLocalization } from "../../contexts/localization";
18
17
  import { useAuth } from "../../hooks/query/useAuth";
@@ -20,7 +19,6 @@ import { type CommonsScreenProps } from "../../navigation/types";
20
19
 
21
20
  // eslint-disable-next-line @bigbinary/neeto/no-dangling-constants
22
21
  const RESEND_TIMER = 30;
23
- let interval: ReturnType<typeof setInterval> | null = null;
24
22
 
25
23
  export const OTPVerificationScreen = ({
26
24
  navigation,
@@ -31,6 +29,7 @@ export const OTPVerificationScreen = ({
31
29
  const [startTimer, setStartTimer] = useState(false);
32
30
 
33
31
  const isSubmittingRef = useRef(false);
32
+ const intervalRef = useRef<ReturnType<typeof setInterval> | null>(null);
34
33
 
35
34
  const { email, userId } = params;
36
35
  const { strings } = useLocalization();
@@ -80,10 +79,12 @@ export const OTPVerificationScreen = ({
80
79
 
81
80
  useEffect(() => {
82
81
  if (startTimer) {
83
- interval = setInterval(() => {
82
+ intervalRef.current = setInterval(() => {
84
83
  setResendTimer(prev => {
85
84
  if (prev === 1) {
86
- clearInterval(interval as ReturnType<typeof setInterval>);
85
+ clearInterval(
86
+ intervalRef.current as ReturnType<typeof setInterval>
87
+ );
87
88
  }
88
89
 
89
90
  return prev - 1;
@@ -91,9 +92,10 @@ export const OTPVerificationScreen = ({
91
92
  }, 1000);
92
93
  }
93
94
 
94
- // `interval` is null until the first tick is scheduled; clearing a null
95
- // handle has always been the no-op it is today.
96
- return () => clearInterval(interval as ReturnType<typeof setInterval>);
95
+ // The ref is null until the first tick is scheduled; clearing a null
96
+ // handle is a no-op.
97
+ return () =>
98
+ clearInterval(intervalRef.current as ReturnType<typeof setInterval>);
97
99
  }, [startTimer]);
98
100
 
99
101
  useEffect(() => {
@@ -118,27 +120,11 @@ export const OTPVerificationScreen = ({
118
120
  barStyle="dark-content"
119
121
  style={styles.screen}
120
122
  >
123
+ <Header
124
+ title={strings.commons.headers.otpVerification}
125
+ onBack={() => navigation?.goBack()}
126
+ />
121
127
  <Container style={styles.body}>
122
- <Container style={styles.backRow}>
123
- <Touchable
124
- style={styles.backButton}
125
- onPress={() => navigation?.goBack()}
126
- >
127
- <Icon
128
- color={lightTheme.colors.palette.grey600}
129
- name="arrow-left-s-line"
130
- size={25}
131
- />
132
- </Touchable>
133
- </Container>
134
- <Typography
135
- color={lightTheme.colors.palette.grey800}
136
- style={styles.heading}
137
- variant="header"
138
- weight="semibold"
139
- >
140
- {strings.commons.headers.otpVerification}
141
- </Typography>
142
128
  <Typography
143
129
  color={lightTheme.colors.palette.grey700}
144
130
  size="s"
@@ -201,19 +187,9 @@ const styles = StyleSheet.create({
201
187
  body: {
202
188
  flex: 1,
203
189
  marginHorizontal: 16,
204
- },
205
- backRow: {
206
- justifyContent: "center",
207
- height: 42,
208
- marginBottom: 18,
209
- },
210
- backButton: {
211
- marginLeft: -14,
212
- padding: 2,
213
- width: 42,
214
- },
215
- heading: {
216
- marginBottom: 2,
190
+ // The title moved into the Header, which carries its own bottom spacing;
191
+ // the description now opens the body.
192
+ marginTop: 16,
217
193
  },
218
194
  description: {
219
195
  marginBottom: 24,
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { StyleSheet } from "react-native";
3
3
 
4
+ import Right from "@bigbinary/neeto-icons-rn/icons/Right";
4
5
  import {
5
6
  Avatar,
6
7
  Container,
@@ -8,7 +9,6 @@ import {
8
9
  Typography,
9
10
  lightTheme,
10
11
  } from "@bigbinary/neetoui-rn";
11
- import Icon from "react-native-remix-icon";
12
12
 
13
13
  import { moderateScale } from "../../helpers/scale";
14
14
  import { type Organization as OrganizationEntity } from "../../slices/auth";
@@ -64,11 +64,7 @@ export const Organization = ({
64
64
  ) : (
65
65
  showOrganizationDetails()
66
66
  )}
67
- <Icon
68
- color={lightTheme.colors.primary}
69
- name="arrow-right-s-line"
70
- size={25}
71
- />
67
+ <Right color={lightTheme.colors.primary} size={25} />
72
68
  </Touchable>
73
69
  );
74
70
  };
@@ -4,17 +4,15 @@ import { StyleSheet } from "react-native";
4
4
  import {
5
5
  Container,
6
6
  FlashList,
7
+ Header,
7
8
  ParentView,
8
9
  SearchBar,
9
- Touchable,
10
10
  Typography,
11
11
  lightTheme,
12
12
  } from "@bigbinary/neetoui-rn";
13
- import Icon from "react-native-remix-icon";
14
13
 
15
14
  import { Organization } from "./Organization";
16
15
 
17
- import { LineLoader } from "../../components";
18
16
  import { useLocalization } from "../../contexts/localization";
19
17
  import { moderateScale } from "../../helpers/scale";
20
18
  import { useAuth } from "../../hooks/query/useAuth";
@@ -57,45 +55,35 @@ export const SubDomainScreen = ({
57
55
  org.subdomain.toLowerCase().includes(searchTermLowerCase)
58
56
  );
59
57
 
60
- const renderHeader = () => (
61
- <Container style={styles.header}>
58
+ const renderIntro = () => (
59
+ <Container style={styles.intro}>
62
60
  <Typography
63
- color={lightTheme.colors.palette.grey800}
64
- style={styles.headerTitle}
65
- variant="header"
66
- weight="semibold"
61
+ color={lightTheme.colors.palette.grey600}
62
+ size="s"
63
+ style={styles.introDescription}
64
+ weight="regular"
67
65
  >
68
- {strings.commons.headers.subDomain}
69
- </Typography>
70
- <Container>
71
- <Typography
72
- color={lightTheme.colors.palette.grey600}
73
- size="s"
74
- style={styles.headerDescription}
75
- weight="regular"
76
- >
77
- {strings.commons.subdomain.description1}
78
- <Typography color={lightTheme.colors.text.primary} weight="bold">
79
- {organizations[0].email}
80
- </Typography>
81
- {strings.commons.subdomain.description2}
66
+ {strings.commons.subdomain.description1}
67
+ <Typography color={lightTheme.colors.text.primary} weight="bold">
68
+ {organizations[0].email}
82
69
  </Typography>
83
- {/*
84
- v3's SearchBar owns its text; it has no `value` prop, so the screen
85
- only mirrors it through onChangeText.
86
- */}
87
- <SearchBar
88
- // `formatString` returns a plain string whenever every argument is
89
- // one, which is the case here.
90
- placeholder={
91
- strings.formatString(
92
- strings.commons.placeholders.search,
93
- strings.commons.labels.Workspaces.toLowerCase()
94
- ) as string
95
- }
96
- onChangeText={setSearchTerm}
97
- />
98
- </Container>
70
+ {strings.commons.subdomain.description2}
71
+ </Typography>
72
+ {/*
73
+ v3's SearchBar owns its text; it has no `value` prop, so the screen
74
+ only mirrors it through onChangeText.
75
+ */}
76
+ <SearchBar
77
+ // `formatString` returns a plain string whenever every argument is
78
+ // one, which is the case here.
79
+ placeholder={
80
+ strings.formatString(
81
+ strings.commons.placeholders.search,
82
+ strings.commons.labels.Workspaces.toLowerCase()
83
+ ) as string
84
+ }
85
+ onChangeText={setSearchTerm}
86
+ />
99
87
  </Container>
100
88
  );
101
89
 
@@ -105,22 +93,15 @@ export const SubDomainScreen = ({
105
93
  barStyle="dark-content"
106
94
  style={styles.screen}
107
95
  >
108
- <Container>
109
- <Container style={styles.navBar}>
110
- {/* v3's ripple config dropped `isCentered`; nothing replaces it. */}
111
- <Touchable
112
- hitSlop={10}
113
- rippleConfig={{ shouldOverflowContainer: true }}
114
- style={styles.backButton}
115
- onPress={onBackPress}
116
- >
117
- <Icon name="arrow-left-s-line" size={moderateScale(24)} />
118
- </Touchable>
119
- </Container>
120
- <LineLoader isLoading={isSelectingOrganization} />
121
- </Container>
96
+ {/* Header carries the progress line the screen used to draw with its
97
+ own LineLoader. */}
98
+ <Header
99
+ isLoading={isSelectingOrganization}
100
+ title={strings.commons.headers.subDomain}
101
+ onBack={onBackPress}
102
+ />
122
103
  <Container style={styles.body}>
123
- {renderHeader()}
104
+ {renderIntro()}
124
105
  <FlashList
125
106
  contentContainerStyle={styles.contentContainerStyle}
126
107
  data={filteredOrganizations}
@@ -142,29 +123,16 @@ const styles = StyleSheet.create({
142
123
  screen: {
143
124
  flex: 1,
144
125
  },
145
- navBar: {
146
- alignItems: "center",
147
- flexDirection: "row",
148
- height: moderateScale(44),
149
- paddingHorizontal: moderateScale(16),
150
- },
151
- backButton: {
152
- marginLeft: moderateScale(-8),
153
- },
154
126
  body: {
155
127
  flex: 1,
156
128
  marginHorizontal: moderateScale(16),
157
- marginTop: moderateScale(16),
129
+ marginTop: moderateScale(4),
158
130
  },
159
- header: {
131
+ intro: {
160
132
  justifyContent: "center",
161
133
  marginBottom: 18,
162
134
  },
163
- headerTitle: {
164
- lineHeight: moderateScale(28),
165
- marginBottom: moderateScale(8),
166
- },
167
- headerDescription: {
135
+ introDescription: {
168
136
  marginBottom: moderateScale(8),
169
137
  },
170
138
  flatListStyle: {
@@ -1,7 +1,8 @@
1
1
  import React, { type ReactNode } from "react";
2
2
  import { Linking, ScrollView, StyleSheet } from "react-native";
3
3
 
4
- import { LeftArrow, Help } from "@bigbinary/neeto-icons-rn";
4
+ import Help from "@bigbinary/neeto-icons-rn/icons/Help";
5
+ import LeftArrow from "@bigbinary/neeto-icons-rn/icons/LeftArrow";
5
6
  import {
6
7
  Typography,
7
8
  Container,
@@ -1,7 +1,7 @@
1
1
  import React, { type ComponentType } from "react";
2
2
  import { StyleSheet, View } from "react-native";
3
3
 
4
- import { MenuVertical } from "@bigbinary/neeto-icons-rn";
4
+ import MenuVertical from "@bigbinary/neeto-icons-rn/icons/MenuVertical";
5
5
  import {
6
6
  Avatar as UIAvatar,
7
7
  Container,