@umituz/react-native-settings 5.3.20 → 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,8 +4,8 @@
|
|
|
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
11
|
import { useAppNavigation } from '@umituz/react-native-design-system/molecules';
|
|
@@ -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]
|
|
@@ -81,72 +77,42 @@ export const FAQScreen: React.FC<FAQScreenProps> = ({
|
|
|
81
77
|
|
|
82
78
|
const header = renderHeader ? renderHeader({ onBack: handleBack }) : null;
|
|
83
79
|
|
|
84
|
-
const renderCategory = useCallback(({ item }: { item: FAQCategory }) => (
|
|
85
|
-
<FAQCategoryComponent
|
|
86
|
-
category={item}
|
|
87
|
-
isExpanded={isExpanded}
|
|
88
|
-
onToggleItem={toggleExpansion}
|
|
89
|
-
styles={customStyles?.category}
|
|
90
|
-
/>
|
|
91
|
-
), [isExpanded, toggleExpansion, customStyles?.category]);
|
|
92
|
-
|
|
93
|
-
const keyExtractor = useCallback((item: FAQCategory) => item.id, []);
|
|
94
|
-
|
|
95
|
-
const renderListHeader = useCallback(() => (
|
|
96
|
-
<View style={[styles.header, customStyles?.header]}>
|
|
97
|
-
<FAQSearchBar
|
|
98
|
-
value={searchQuery}
|
|
99
|
-
onChangeText={setSearchQuery}
|
|
100
|
-
placeholder={searchPlaceholder}
|
|
101
|
-
styles={customStyles?.searchBar}
|
|
102
|
-
/>
|
|
103
|
-
</View>
|
|
104
|
-
), [searchQuery, setSearchQuery, searchPlaceholder, customStyles?.searchBar, customStyles?.header, styles.header]);
|
|
105
|
-
|
|
106
|
-
const renderListEmpty = useCallback(() => {
|
|
107
|
-
if (searchQuery && !hasResults) {
|
|
108
|
-
return (
|
|
109
|
-
<FAQEmptyState
|
|
110
|
-
title={emptySearchTitle}
|
|
111
|
-
message={emptySearchMessage}
|
|
112
|
-
styles={customStyles?.emptyState}
|
|
113
|
-
/>
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
return null;
|
|
117
|
-
}, [searchQuery, hasResults, emptySearchTitle, emptySearchMessage, customStyles?.emptyState]);
|
|
118
|
-
|
|
119
|
-
const renderListFooter = useCallback(() => (
|
|
120
|
-
<View style={{ height: tokens.spacing.xl * 2 }} />
|
|
121
|
-
), [tokens.spacing.xl]);
|
|
122
|
-
|
|
123
80
|
return (
|
|
124
81
|
<ScreenLayout
|
|
125
82
|
edges={['bottom']}
|
|
126
|
-
scrollable={false}
|
|
127
83
|
header={header}
|
|
84
|
+
contentContainerStyle={customStyles?.content}
|
|
128
85
|
>
|
|
129
|
-
<View style={
|
|
130
|
-
<View style={
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
ListEmptyComponent={renderListEmpty}
|
|
138
|
-
ListFooterComponent={renderListFooter}
|
|
139
|
-
style={[styles.content, customStyles?.content]}
|
|
140
|
-
contentContainerStyle={{ paddingVertical: tokens.spacing.md }}
|
|
141
|
-
showsVerticalScrollIndicator={false}
|
|
142
|
-
initialNumToRender={5}
|
|
143
|
-
maxToRenderPerBatch={5}
|
|
144
|
-
windowSize={10}
|
|
145
|
-
removeClippedSubviews={true}
|
|
146
|
-
/>
|
|
147
|
-
</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
|
+
/>
|
|
148
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} />
|
|
149
115
|
</View>
|
|
150
116
|
</ScreenLayout>
|
|
151
117
|
);
|
|
152
|
-
};
|
|
118
|
+
};
|