@umituz/react-native-settings 5.3.19 → 5.3.21
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-settings",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.21",
|
|
4
4
|
"description": "Complete settings hub for React Native apps - consolidated package with settings, localization, about, legal, appearance, feedback, FAQs, rating, and gamification",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* Uses design system tokens for theming
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import React, { useMemo
|
|
8
|
-
import { View,
|
|
7
|
+
import React, { useMemo } from 'react';
|
|
8
|
+
import { View, StyleSheet, ViewStyle, TextStyle, useWindowDimensions } from 'react-native';
|
|
9
9
|
import { getContentMaxWidth } from '@umituz/react-native-design-system/device';
|
|
10
10
|
import { ScreenLayout } from '@umituz/react-native-design-system/layouts';
|
|
11
|
-
import {
|
|
11
|
+
import { useAppNavigation } from '@umituz/react-native-design-system/molecules';
|
|
12
12
|
import { useAppDesignTokens } from '@umituz/react-native-design-system/theme';
|
|
13
13
|
import { FAQCategory } from '../../domain/entities/FAQEntity';
|
|
14
14
|
import { useFAQSearch } from '../hooks/useFAQSearch';
|
|
@@ -43,7 +43,6 @@ export const FAQScreen: React.FC<FAQScreenProps> = ({
|
|
|
43
43
|
searchPlaceholder,
|
|
44
44
|
emptySearchTitle,
|
|
45
45
|
emptySearchMessage,
|
|
46
|
-
headerTitle,
|
|
47
46
|
onBack,
|
|
48
47
|
renderHeader,
|
|
49
48
|
styles: customStyles,
|
|
@@ -58,14 +57,11 @@ export const FAQScreen: React.FC<FAQScreenProps> = ({
|
|
|
58
57
|
const styles = useMemo(
|
|
59
58
|
() =>
|
|
60
59
|
StyleSheet.create({
|
|
61
|
-
|
|
62
|
-
flex: 1,
|
|
63
|
-
},
|
|
64
|
-
header: {
|
|
60
|
+
searchBar: {
|
|
65
61
|
padding: tokens.spacing.md,
|
|
66
62
|
},
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
footer: {
|
|
64
|
+
height: tokens.spacing.xl * 2,
|
|
69
65
|
},
|
|
70
66
|
}),
|
|
71
67
|
[tokens]
|
|
@@ -79,79 +75,44 @@ export const FAQScreen: React.FC<FAQScreenProps> = ({
|
|
|
79
75
|
}
|
|
80
76
|
};
|
|
81
77
|
|
|
82
|
-
const header = renderHeader ? renderHeader({ onBack: handleBack }) :
|
|
83
|
-
<NavigationHeader
|
|
84
|
-
title={headerTitle}
|
|
85
|
-
onBackPress={handleBack}
|
|
86
|
-
/>
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
const renderCategory = useCallback(({ item }: { item: FAQCategory }) => (
|
|
90
|
-
<FAQCategoryComponent
|
|
91
|
-
category={item}
|
|
92
|
-
isExpanded={isExpanded}
|
|
93
|
-
onToggleItem={toggleExpansion}
|
|
94
|
-
styles={customStyles?.category}
|
|
95
|
-
/>
|
|
96
|
-
), [isExpanded, toggleExpansion, customStyles?.category]);
|
|
97
|
-
|
|
98
|
-
const keyExtractor = useCallback((item: FAQCategory) => item.id, []);
|
|
99
|
-
|
|
100
|
-
const renderListHeader = useCallback(() => (
|
|
101
|
-
<View style={[styles.header, customStyles?.header]}>
|
|
102
|
-
<FAQSearchBar
|
|
103
|
-
value={searchQuery}
|
|
104
|
-
onChangeText={setSearchQuery}
|
|
105
|
-
placeholder={searchPlaceholder}
|
|
106
|
-
styles={customStyles?.searchBar}
|
|
107
|
-
/>
|
|
108
|
-
</View>
|
|
109
|
-
), [searchQuery, setSearchQuery, searchPlaceholder, customStyles?.searchBar, customStyles?.header, styles.header]);
|
|
110
|
-
|
|
111
|
-
const renderListEmpty = useCallback(() => {
|
|
112
|
-
if (searchQuery && !hasResults) {
|
|
113
|
-
return (
|
|
114
|
-
<FAQEmptyState
|
|
115
|
-
title={emptySearchTitle}
|
|
116
|
-
message={emptySearchMessage}
|
|
117
|
-
styles={customStyles?.emptyState}
|
|
118
|
-
/>
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
return null;
|
|
122
|
-
}, [searchQuery, hasResults, emptySearchTitle, emptySearchMessage, customStyles?.emptyState]);
|
|
123
|
-
|
|
124
|
-
const renderListFooter = useCallback(() => (
|
|
125
|
-
<View style={{ height: tokens.spacing.xl * 2 }} />
|
|
126
|
-
), [tokens.spacing.xl]);
|
|
78
|
+
const header = renderHeader ? renderHeader({ onBack: handleBack }) : null;
|
|
127
79
|
|
|
128
80
|
return (
|
|
129
81
|
<ScreenLayout
|
|
130
82
|
edges={['bottom']}
|
|
131
|
-
scrollable={false}
|
|
132
83
|
header={header}
|
|
84
|
+
contentContainerStyle={customStyles?.content}
|
|
133
85
|
>
|
|
134
|
-
<View style={
|
|
135
|
-
<View style={
|
|
136
|
-
<
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
ListEmptyComponent={renderListEmpty}
|
|
143
|
-
ListFooterComponent={renderListFooter}
|
|
144
|
-
style={[styles.content, customStyles?.content]}
|
|
145
|
-
contentContainerStyle={{ paddingVertical: tokens.spacing.md }}
|
|
146
|
-
showsVerticalScrollIndicator={false}
|
|
147
|
-
initialNumToRender={5}
|
|
148
|
-
maxToRenderPerBatch={5}
|
|
149
|
-
windowSize={10}
|
|
150
|
-
removeClippedSubviews={true}
|
|
151
|
-
/>
|
|
152
|
-
</View>
|
|
86
|
+
<View style={{ alignSelf: 'center', width: '100%', maxWidth: contentMaxWidth }}>
|
|
87
|
+
<View style={[styles.searchBar, customStyles?.header]}>
|
|
88
|
+
<FAQSearchBar
|
|
89
|
+
value={searchQuery}
|
|
90
|
+
onChangeText={setSearchQuery}
|
|
91
|
+
placeholder={searchPlaceholder}
|
|
92
|
+
styles={customStyles?.searchBar}
|
|
93
|
+
/>
|
|
153
94
|
</View>
|
|
95
|
+
|
|
96
|
+
{searchQuery && !hasResults ? (
|
|
97
|
+
<FAQEmptyState
|
|
98
|
+
title={emptySearchTitle}
|
|
99
|
+
message={emptySearchMessage}
|
|
100
|
+
styles={customStyles?.emptyState}
|
|
101
|
+
/>
|
|
102
|
+
) : (
|
|
103
|
+
filteredCategories.map((cat) => (
|
|
104
|
+
<FAQCategoryComponent
|
|
105
|
+
key={cat.id}
|
|
106
|
+
category={cat}
|
|
107
|
+
isExpanded={isExpanded}
|
|
108
|
+
onToggleItem={toggleExpansion}
|
|
109
|
+
styles={customStyles?.category}
|
|
110
|
+
/>
|
|
111
|
+
))
|
|
112
|
+
)}
|
|
113
|
+
|
|
114
|
+
<View style={styles.footer} />
|
|
154
115
|
</View>
|
|
155
116
|
</ScreenLayout>
|
|
156
117
|
);
|
|
157
|
-
};
|
|
118
|
+
};
|