@repzo/widget-react-native 1.0.9 → 1.1.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.
- package/CHANGELOG.md +365 -0
- package/README.md +55 -4
- package/lib/commonjs/agent-ui-blocks.js +2 -1
- package/lib/commonjs/agent-ui-blocks.js.map +1 -1
- package/lib/commonjs/attachments/pickers.js +3 -6
- package/lib/commonjs/attachments/pickers.js.map +1 -1
- package/lib/commonjs/device-id.js +31 -3
- package/lib/commonjs/device-id.js.map +1 -1
- package/lib/commonjs/i18n.js +26 -4
- package/lib/commonjs/i18n.js.map +1 -1
- package/lib/commonjs/locales.js +21 -1
- package/lib/commonjs/locales.js.map +1 -1
- package/lib/commonjs/push/push-notifications.js +0 -1
- package/lib/commonjs/push/push-notifications.js.map +1 -1
- package/lib/commonjs/state/widget-store.js +57 -20
- package/lib/commonjs/state/widget-store.js.map +1 -1
- package/lib/commonjs/storage.js +13 -1
- package/lib/commonjs/storage.js.map +1 -1
- package/lib/commonjs/types.js +6 -3
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/ui/WidgetProvider.js +74 -47
- package/lib/commonjs/ui/WidgetProvider.js.map +1 -1
- package/lib/commonjs/ui/components/AgentUiBlocks.js +35 -15
- package/lib/commonjs/ui/components/AgentUiBlocks.js.map +1 -1
- package/lib/commonjs/ui/components/Launcher.js +4 -1
- package/lib/commonjs/ui/components/Launcher.js.map +1 -1
- package/lib/commonjs/ui/components/Markdown.js +32 -2
- package/lib/commonjs/ui/components/Markdown.js.map +1 -1
- package/lib/commonjs/ui/components/RatingCard.js +6 -3
- package/lib/commonjs/ui/components/RatingCard.js.map +1 -1
- package/lib/commonjs/ui/hooks/use-widget-insets.js +0 -1
- package/lib/commonjs/ui/hooks/use-widget-insets.js.map +1 -1
- package/lib/commonjs/ui/screens/chat/ChatView.js +67 -29
- package/lib/commonjs/ui/screens/chat/ChatView.js.map +1 -1
- package/lib/commonjs/ui/utils/html.js +8 -1
- package/lib/commonjs/ui/utils/html.js.map +1 -1
- package/lib/commonjs/ui/utils/native-gradient.js +0 -1
- package/lib/commonjs/ui/utils/native-gradient.js.map +1 -1
- package/lib/module/agent-ui-blocks.js +2 -1
- package/lib/module/agent-ui-blocks.js.map +1 -1
- package/lib/module/attachments/pickers.js +3 -6
- package/lib/module/attachments/pickers.js.map +1 -1
- package/lib/module/device-id.js +31 -3
- package/lib/module/device-id.js.map +1 -1
- package/lib/module/i18n.js +26 -4
- package/lib/module/i18n.js.map +1 -1
- package/lib/module/locales.js +21 -1
- package/lib/module/locales.js.map +1 -1
- package/lib/module/push/push-notifications.js +0 -1
- package/lib/module/push/push-notifications.js.map +1 -1
- package/lib/module/state/widget-store.js +58 -20
- package/lib/module/state/widget-store.js.map +1 -1
- package/lib/module/storage.js +13 -1
- package/lib/module/storage.js.map +1 -1
- package/lib/module/types.js +6 -3
- package/lib/module/types.js.map +1 -1
- package/lib/module/ui/WidgetProvider.js +74 -47
- package/lib/module/ui/WidgetProvider.js.map +1 -1
- package/lib/module/ui/components/AgentUiBlocks.js +35 -15
- package/lib/module/ui/components/AgentUiBlocks.js.map +1 -1
- package/lib/module/ui/components/Launcher.js +4 -1
- package/lib/module/ui/components/Launcher.js.map +1 -1
- package/lib/module/ui/components/Markdown.js +32 -3
- package/lib/module/ui/components/Markdown.js.map +1 -1
- package/lib/module/ui/components/RatingCard.js +6 -3
- package/lib/module/ui/components/RatingCard.js.map +1 -1
- package/lib/module/ui/hooks/use-widget-insets.js +0 -1
- package/lib/module/ui/hooks/use-widget-insets.js.map +1 -1
- package/lib/module/ui/screens/chat/ChatView.js +68 -30
- package/lib/module/ui/screens/chat/ChatView.js.map +1 -1
- package/lib/module/ui/utils/html.js +8 -1
- package/lib/module/ui/utils/html.js.map +1 -1
- package/lib/module/ui/utils/native-gradient.js +0 -1
- package/lib/module/ui/utils/native-gradient.js.map +1 -1
- package/lib/typescript/commonjs/agent-ui-blocks.d.ts.map +1 -1
- package/lib/typescript/commonjs/attachments/pickers.d.ts.map +1 -1
- package/lib/typescript/commonjs/device-id.d.ts.map +1 -1
- package/lib/typescript/commonjs/i18n.d.ts +22 -1
- package/lib/typescript/commonjs/i18n.d.ts.map +1 -1
- package/lib/typescript/commonjs/locales.d.ts.map +1 -1
- package/lib/typescript/commonjs/push/push-notifications.d.ts.map +1 -1
- package/lib/typescript/commonjs/state/widget-store.d.ts +13 -7
- package/lib/typescript/commonjs/state/widget-store.d.ts.map +1 -1
- package/lib/typescript/commonjs/storage.d.ts.map +1 -1
- package/lib/typescript/commonjs/types.d.ts +14 -8
- package/lib/typescript/commonjs/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/WidgetProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/AgentUiBlocks.d.ts +14 -0
- package/lib/typescript/commonjs/ui/components/AgentUiBlocks.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/Launcher.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/Markdown.d.ts +8 -0
- package/lib/typescript/commonjs/ui/components/Markdown.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/RatingCard.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/use-widget-insets.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/chat/ChatView.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/chat/ChatView.types.d.ts +10 -0
- package/lib/typescript/commonjs/ui/screens/chat/ChatView.types.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/html.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/native-gradient.d.ts.map +1 -1
- package/lib/typescript/module/agent-ui-blocks.d.ts.map +1 -1
- package/lib/typescript/module/attachments/pickers.d.ts.map +1 -1
- package/lib/typescript/module/device-id.d.ts.map +1 -1
- package/lib/typescript/module/i18n.d.ts +22 -1
- package/lib/typescript/module/i18n.d.ts.map +1 -1
- package/lib/typescript/module/locales.d.ts.map +1 -1
- package/lib/typescript/module/push/push-notifications.d.ts.map +1 -1
- package/lib/typescript/module/state/widget-store.d.ts +13 -7
- package/lib/typescript/module/state/widget-store.d.ts.map +1 -1
- package/lib/typescript/module/storage.d.ts.map +1 -1
- package/lib/typescript/module/types.d.ts +14 -8
- package/lib/typescript/module/types.d.ts.map +1 -1
- package/lib/typescript/module/ui/WidgetProvider.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/AgentUiBlocks.d.ts +14 -0
- package/lib/typescript/module/ui/components/AgentUiBlocks.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/Launcher.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/Markdown.d.ts +8 -0
- package/lib/typescript/module/ui/components/Markdown.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/RatingCard.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/use-widget-insets.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/chat/ChatView.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/chat/ChatView.types.d.ts +10 -0
- package/lib/typescript/module/ui/screens/chat/ChatView.types.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/html.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/native-gradient.d.ts.map +1 -1
- package/package.json +14 -4
- package/src/agent-ui-blocks.ts +2 -1
- package/src/attachments/pickers.ts +3 -6
- package/src/device-id.ts +34 -3
- package/src/i18n.ts +25 -2
- package/src/locales.ts +20 -0
- package/src/push/push-notifications.ts +0 -1
- package/src/state/widget-store.ts +52 -19
- package/src/storage.ts +18 -1
- package/src/types.ts +14 -8
- package/src/ui/WidgetProvider.tsx +88 -46
- package/src/ui/components/AgentUiBlocks.tsx +40 -12
- package/src/ui/components/Launcher.tsx +6 -1
- package/src/ui/components/Markdown.tsx +34 -3
- package/src/ui/components/RatingCard.tsx +6 -2
- package/src/ui/hooks/use-widget-insets.ts +0 -1
- package/src/ui/screens/chat/ChatView.tsx +77 -42
- package/src/ui/screens/chat/ChatView.types.ts +10 -0
- package/src/ui/utils/html.ts +9 -1
- package/src/ui/utils/native-gradient.ts +0 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* `attachments/pickers.ts`).
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { Fragment, useCallback, useEffect, useRef, useState } from 'react';
|
|
11
|
+
import { Fragment, memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
12
12
|
import {
|
|
13
13
|
Animated,
|
|
14
14
|
Easing,
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
type AttachmentProblem,
|
|
34
34
|
type DraftAttachment,
|
|
35
35
|
} from '../../../attachments/pickers';
|
|
36
|
+
import { formatLabel } from '../../../i18n';
|
|
36
37
|
import type {
|
|
37
38
|
AgentUiAction,
|
|
38
39
|
AgentProcedureForm,
|
|
@@ -315,20 +316,23 @@ export function ChatView({
|
|
|
315
316
|
[onIdentifyVisitor, onSendMessage, scrollToBottom]
|
|
316
317
|
);
|
|
317
318
|
|
|
319
|
+
const handleSubmitProcedureForm = useCallback(
|
|
320
|
+
(body: string) => void onSendMessage(body).catch(() => {}),
|
|
321
|
+
[onSendMessage]
|
|
322
|
+
);
|
|
323
|
+
|
|
324
|
+
// Recomputed only when the list changes — never on a keystroke.
|
|
325
|
+
const thread = useMemo(() => deriveThread(messages), [messages]);
|
|
326
|
+
const locales = useMemo(() => [locale, defaultLocale], [locale, defaultLocale]);
|
|
327
|
+
|
|
318
328
|
const headerTextColor = contrastingTextColor(color);
|
|
319
329
|
const onDarkHeader = headerTextColor === palette.white;
|
|
320
330
|
const isEmptyThread = !loading && messages.length === 0;
|
|
321
331
|
const agentIsActive = agentOnline ?? isOnline;
|
|
322
332
|
// "Waiting for a teammate" until someone replies: no teammate in the header
|
|
323
333
|
// and the visitor spoke last (bot replies before that still count as waiting).
|
|
324
|
-
const
|
|
325
|
-
.
|
|
326
|
-
.find((message) => (message.messageType ?? 'message') === 'message' && !message.deletedAt);
|
|
327
|
-
const awaitingTeammate = !agentName && !agentTyping && lastChatMessage?.direction === 'inbound';
|
|
328
|
-
// "Sent" / "Seen" goes under the visitor's latest message only.
|
|
329
|
-
const lastVisitorMessageId = [...messages]
|
|
330
|
-
.reverse()
|
|
331
|
-
.find((message) => message.direction === 'inbound' && (message.messageType ?? 'message') === 'message')?.id;
|
|
334
|
+
const awaitingTeammate =
|
|
335
|
+
!agentName && !agentTyping && thread.lastChatMessage?.direction === 'inbound';
|
|
332
336
|
// Two stops off the brand color: flat fill looked like an unstyled block.
|
|
333
337
|
// A non-hex brand color falls through mixHex unchanged and renders solid.
|
|
334
338
|
const topInset = useTopInset();
|
|
@@ -493,21 +497,25 @@ export function ChatView({
|
|
|
493
497
|
labels={labels}
|
|
494
498
|
onOpenImage={setViewerImage}
|
|
495
499
|
onRateConversation={onRateConversation}
|
|
496
|
-
locales={
|
|
500
|
+
locales={locales}
|
|
497
501
|
senderLabel={
|
|
498
502
|
isAgentMessage && (startsRun || startsDay)
|
|
499
503
|
? message.senderName || agentName || labels.team
|
|
500
504
|
: null
|
|
501
505
|
}
|
|
502
506
|
timeLabel={formatClockTime(message.createdAt, locale)}
|
|
503
|
-
receiptLabel={
|
|
507
|
+
receiptLabel={
|
|
508
|
+
message.id === thread.lastVisitorMessageId
|
|
509
|
+
? receiptLabel(message, labels)
|
|
510
|
+
: undefined
|
|
511
|
+
}
|
|
504
512
|
onSubmitProcedureForm={
|
|
505
|
-
|
|
506
|
-
?
|
|
513
|
+
message.id === thread.procedureFormMessageId
|
|
514
|
+
? handleSubmitProcedureForm
|
|
507
515
|
: undefined
|
|
508
516
|
}
|
|
509
517
|
onAgentUiAction={
|
|
510
|
-
|
|
518
|
+
thread.agentBlocksShown.has(message.id) ? handleAgentUiAction : undefined
|
|
511
519
|
}
|
|
512
520
|
/>
|
|
513
521
|
</WidgetErrorBoundary>
|
|
@@ -635,7 +643,11 @@ export function ChatView({
|
|
|
635
643
|
);
|
|
636
644
|
}
|
|
637
645
|
|
|
638
|
-
|
|
646
|
+
/**
|
|
647
|
+
* Memoized: the composer re-renders the screen on every keystroke, and every
|
|
648
|
+
* prop here is stable unless this message itself changed.
|
|
649
|
+
*/
|
|
650
|
+
const MessageBubble = memo(function MessageBubble({
|
|
639
651
|
message,
|
|
640
652
|
color,
|
|
641
653
|
labels,
|
|
@@ -795,7 +807,7 @@ function MessageBubble({
|
|
|
795
807
|
) : null}
|
|
796
808
|
</View>
|
|
797
809
|
);
|
|
798
|
-
}
|
|
810
|
+
});
|
|
799
811
|
|
|
800
812
|
/** Sent once the server has it, Seen once a teammate opened the conversation. */
|
|
801
813
|
function receiptLabel(message: Message, labels: ChatLabels): string | undefined {
|
|
@@ -900,17 +912,21 @@ function ProcedureFieldForm({
|
|
|
900
912
|
style={[styles.procedureToggle, { backgroundColor: expanded ? palette.surface : color }]}>
|
|
901
913
|
<Text
|
|
902
914
|
style={[styles.procedureToggleLabel, { color: expanded ? palette.text : palette.white }]}>
|
|
903
|
-
{submitted ?
|
|
915
|
+
{submitted ? labels.procedureDetailsSent : labels.procedureShareDetails}
|
|
904
916
|
</Text>
|
|
905
917
|
<Text
|
|
906
918
|
style={[styles.procedureToggleHint, { color: expanded ? palette.text : palette.white }]}>
|
|
907
|
-
{expanded
|
|
919
|
+
{expanded
|
|
920
|
+
? labels.procedureHide
|
|
921
|
+
: form.fields.length === 1
|
|
922
|
+
? labels.procedureFieldCountOne
|
|
923
|
+
: formatLabel(labels.procedureFieldCount, { count: form.fields.length })}
|
|
908
924
|
</Text>
|
|
909
925
|
</Pressable>
|
|
910
926
|
|
|
911
927
|
{expanded ? (
|
|
912
928
|
<>
|
|
913
|
-
<Text style={styles.procedureTitle}>{form.procedureName ||
|
|
929
|
+
<Text style={styles.procedureTitle}>{form.procedureName || labels.procedureTitle}</Text>
|
|
914
930
|
<View style={styles.procedureFields}>
|
|
915
931
|
{form.fields.map((field) => (
|
|
916
932
|
<View key={field.name}>
|
|
@@ -923,7 +939,7 @@ function ProcedureFieldForm({
|
|
|
923
939
|
onChangeText={(text) =>
|
|
924
940
|
setValues((current) => ({ ...current, [field.name]: text }))
|
|
925
941
|
}
|
|
926
|
-
placeholder={placeholderForField(field)}
|
|
942
|
+
placeholder={placeholderForField(field, labels)}
|
|
927
943
|
placeholderTextColor={palette.textSubtle}
|
|
928
944
|
editable={!submitted}
|
|
929
945
|
keyboardType={
|
|
@@ -999,9 +1015,9 @@ function TypingDot({ index, reduceMotion }: { index: number; reduceMotion: boole
|
|
|
999
1015
|
return <Animated.View style={[styles.typingDot, motionStyle]} />;
|
|
1000
1016
|
}
|
|
1001
1017
|
|
|
1002
|
-
function placeholderForField(field: AgentProcedureForm['fields'][number]) {
|
|
1003
|
-
if (field.type === 'email') return
|
|
1004
|
-
if (field.type === 'phone') return
|
|
1018
|
+
function placeholderForField(field: AgentProcedureForm['fields'][number], labels: ChatLabels) {
|
|
1019
|
+
if (field.type === 'email') return labels.procedureEmailPlaceholder;
|
|
1020
|
+
if (field.type === 'phone') return labels.procedurePhonePlaceholder;
|
|
1005
1021
|
if (field.type === 'date' || field.type === 'time') return '';
|
|
1006
1022
|
return field.label;
|
|
1007
1023
|
}
|
|
@@ -1010,24 +1026,43 @@ function stringPayload(value: unknown) {
|
|
|
1010
1026
|
return typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
1011
1027
|
}
|
|
1012
1028
|
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1029
|
+
/**
|
|
1030
|
+
* Everything the thread derives from the whole list, in one backwards pass.
|
|
1031
|
+
* (Per-message lookups made this O(n²) on every render, keystrokes included.)
|
|
1032
|
+
*/
|
|
1033
|
+
function deriveThread(messages: Message[]) {
|
|
1034
|
+
/** Messages whose agent blocks stay actionable. */
|
|
1035
|
+
const agentBlocksShown = new Set<string>();
|
|
1036
|
+
const laterSlotPickerIds = new Set<string>();
|
|
1037
|
+
let lastChatMessage: Message | undefined;
|
|
1038
|
+
let lastVisitorMessageId: string | undefined;
|
|
1039
|
+
|
|
1040
|
+
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
1041
|
+
const message = messages[index]!;
|
|
1042
|
+
const isChat = (message.messageType ?? 'message') === 'message';
|
|
1043
|
+
if (!lastChatMessage && isChat && !message.deletedAt) lastChatMessage = message;
|
|
1044
|
+
// "Sent" / "Seen" goes under the visitor's latest message only.
|
|
1045
|
+
if (!lastVisitorMessageId && isChat && message.direction === 'inbound') {
|
|
1046
|
+
lastVisitorMessageId = message.id;
|
|
1047
|
+
}
|
|
1017
1048
|
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
.
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1049
|
+
const blocks = getAgentUiBlocks(message.metadata);
|
|
1050
|
+
if (blocks.length === 0) continue;
|
|
1051
|
+
// A slot picker a later message re-sent is superseded: only the newest
|
|
1052
|
+
// one stays actionable. Any other block always does.
|
|
1053
|
+
const onlySlotPickers = blocks.every((block) => block.type === 'appointment_slot_picker');
|
|
1054
|
+
if (!onlySlotPickers || blocks.some((block) => !laterSlotPickerIds.has(block.id))) {
|
|
1055
|
+
agentBlocksShown.add(message.id);
|
|
1056
|
+
}
|
|
1057
|
+
blocks.forEach((block) => {
|
|
1058
|
+
if (block.type === 'appointment_slot_picker') laterSlotPickerIds.add(block.id);
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
// A procedure form only while it is the newest message in the thread.
|
|
1063
|
+
const last = messages[messages.length - 1];
|
|
1064
|
+
const procedureFormMessageId =
|
|
1065
|
+
last && last.direction !== 'inbound' && getProcedureForm(last.metadata) ? last.id : null;
|
|
1066
|
+
|
|
1067
|
+
return { agentBlocksShown, lastChatMessage, lastVisitorMessageId, procedureFormMessageId };
|
|
1033
1068
|
}
|
|
@@ -35,6 +35,16 @@ export interface ChatLabels {
|
|
|
35
35
|
joinedConversation: string;
|
|
36
36
|
procedureSend: string;
|
|
37
37
|
procedureSent: string;
|
|
38
|
+
procedureShareDetails: string;
|
|
39
|
+
procedureDetailsSent: string;
|
|
40
|
+
procedureHide: string;
|
|
41
|
+
/** `{count}` = number of fields (2 or more). */
|
|
42
|
+
procedureFieldCount: string;
|
|
43
|
+
procedureFieldCountOne: string;
|
|
44
|
+
/** Shown when the procedure has no name. */
|
|
45
|
+
procedureTitle: string;
|
|
46
|
+
procedureEmailPlaceholder: string;
|
|
47
|
+
procedurePhonePlaceholder: string;
|
|
38
48
|
blocks: AgentUiBlockLabels;
|
|
39
49
|
rating: RatingCardLabels;
|
|
40
50
|
attach: AttachLabels;
|
package/src/ui/utils/html.ts
CHANGED
|
@@ -14,10 +14,18 @@ const ENTITIES: Record<string, string> = {
|
|
|
14
14
|
' ': ' ',
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
/** `😀` / `😀` → 😀. Out-of-range or surrogate code points stay as written. */
|
|
18
|
+
function decodeNumericEntity(match: string, decimal?: string, hex?: string): string {
|
|
19
|
+
const code = decimal !== undefined ? Number(decimal) : parseInt(hex ?? '', 16);
|
|
20
|
+
const valid =
|
|
21
|
+
Number.isInteger(code) && code > 0 && code <= 0x10ffff && (code < 0xd800 || code > 0xdfff);
|
|
22
|
+
return valid ? String.fromCodePoint(code) : match;
|
|
23
|
+
}
|
|
24
|
+
|
|
17
25
|
function decodeEntities(text: string): string {
|
|
18
26
|
return text
|
|
19
27
|
.replace(/&(amp|lt|gt|quot|#39|apos|nbsp);/g, (match) => ENTITIES[match] ?? match)
|
|
20
|
-
.replace(/&#(\d
|
|
28
|
+
.replace(/&#(?:(\d{1,7})|[xX]([0-9a-fA-F]{1,6}));/g, decodeNumericEntity);
|
|
21
29
|
}
|
|
22
30
|
|
|
23
31
|
/** Block-level tags become newlines so paragraphs survive the strip. */
|
|
@@ -29,7 +29,6 @@ export interface NativeGradientProps {
|
|
|
29
29
|
let nativeGradient: ComponentType<NativeGradientProps> | null = null;
|
|
30
30
|
|
|
31
31
|
try {
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
33
32
|
const mod = require('react-native-linear-gradient');
|
|
34
33
|
const component = mod?.default ?? mod?.LinearGradient;
|
|
35
34
|
if (component) nativeGradient = component as ComponentType<NativeGradientProps>;
|