1- import { useState , useMemo , useCallback , FC } from "react"
1+ import { useState , useMemo , useCallback , useEffect , FC } from "react"
22import { View , TouchableOpacity , ViewStyle , TextStyle , Modal , ScrollView , TextInput , Platform } from "react-native"
33import { Text } from "@/components/ignite"
44import AppIcon from "./AppIcon"
@@ -46,6 +46,22 @@ export const AppPicker: FC<AppPickerProps> = ({
4646 const { themed, theme} = useAppTheme ( )
4747 const [ searchQuery , setSearchQuery ] = useState ( "" )
4848
49+ // Debug logging when modal opens
50+ useEffect ( ( ) => {
51+ if ( visible ) {
52+ console . log ( "🔍 AppPicker opened with" , apps . length , "total apps" )
53+ console . log ( "🔍 Filter predicate exists:" , ! ! filterPredicate )
54+ if ( filterPredicate ) {
55+ const filtered = apps . filter ( filterPredicate )
56+ console . log ( "🔍 After filter predicate:" , filtered . length , "apps" )
57+ console . log (
58+ "🔍 Filtered apps:" ,
59+ filtered . map ( a => ( { name : a . name , type : a . type , compatible : a . compatibility ?. isCompatible } ) ) ,
60+ )
61+ }
62+ }
63+ } , [ visible , apps , filterPredicate ] )
64+
4965 // Filter and search apps
5066 const filteredApps = useMemo ( ( ) => {
5167 let result = apps
@@ -112,7 +128,7 @@ export const AppPicker: FC<AppPickerProps> = ({
112128 < MaterialCommunityIcons name = "magnify" size = { 20 } color = { theme . colors . textDim } style = { themed ( $searchIcon ) } />
113129 < TextInput
114130 style = { themed ( $searchInput ) }
115- placeholder = { translate ( "common:search" ) }
131+ placeholder = "Search"
116132 placeholderTextColor = { theme . colors . textDim }
117133 value = { searchQuery }
118134 onChangeText = { setSearchQuery }
@@ -128,6 +144,9 @@ export const AppPicker: FC<AppPickerProps> = ({
128144
129145 { /* App List */ }
130146 < ScrollView style = { themed ( $scrollView ) } contentContainerStyle = { themed ( $scrollContent ) } >
147+ { /* Debug text */ }
148+ < Text style = { { color : theme . colors . text , padding : 10 } } > Showing { filteredApps . length } apps</ Text >
149+
131150 { filteredApps . length === 0 ? (
132151 < View style = { themed ( $emptyState ) } >
133152 < MaterialCommunityIcons name = "application-outline" size = { 48 } color = { theme . colors . textDim } />
@@ -167,9 +186,6 @@ export const AppPicker: FC<AppPickerProps> = ({
167186 />
168187 ) }
169188 </ View >
170- { app . developerName && (
171- < Text text = { app . developerName } style = { themed ( $developerName ) } numberOfLines = { 1 } />
172- ) }
173189 { ! isCompatible && showCompatibilityWarnings && compatibilityMessage && (
174190 < View style = { themed ( $warningContainer ) } >
175191 < MaterialCommunityIcons name = "alert-circle" size = { 14 } color = { theme . colors . error } />
@@ -200,7 +216,7 @@ const $modalContent: ThemedStyle<ViewStyle> = ({colors, spacing}) => ({
200216 backgroundColor : colors . background ,
201217 borderTopLeftRadius : spacing . lg ,
202218 borderTopRightRadius : spacing . lg ,
203- maxHeight : "80 %" ,
219+ height : "90 %" , // Changed from maxHeight to height for consistent sizing
204220 paddingBottom : Platform . OS === "ios" ? spacing . xl : spacing . lg ,
205221} )
206222
@@ -226,11 +242,13 @@ const $closeButton: ThemedStyle<ViewStyle> = ({spacing}) => ({
226242const $searchContainer : ThemedStyle < ViewStyle > = ( { colors, spacing} ) => ( {
227243 flexDirection : "row" ,
228244 alignItems : "center" ,
229- backgroundColor : colors . palette . neutral200 ,
245+ backgroundColor : colors . backgroundAlt ,
230246 borderRadius : spacing . sm ,
231247 marginHorizontal : spacing . lg ,
232248 marginBottom : spacing . md ,
233249 paddingHorizontal : spacing . sm ,
250+ borderWidth : 1 ,
251+ borderColor : colors . border ,
234252} )
235253
236254const $searchIcon : ThemedStyle < ViewStyle > = ( { spacing} ) => ( {
@@ -250,11 +268,13 @@ const $clearButton: ThemedStyle<ViewStyle> = ({spacing}) => ({
250268
251269const $scrollView : ThemedStyle < ViewStyle > = ( ) => ( {
252270 flex : 1 ,
271+ minHeight : 400 , // Ensure minimum height for scrollview
253272} )
254273
255274const $scrollContent : ThemedStyle < ViewStyle > = ( { spacing} ) => ( {
256275 paddingHorizontal : spacing . lg ,
257276 paddingBottom : spacing . lg ,
277+ flexGrow : 1 , // Ensure content can grow
258278} )
259279
260280const $emptyState : ThemedStyle < ViewStyle > = ( { spacing} ) => ( {
@@ -270,10 +290,13 @@ const $emptyText: ThemedStyle<TextStyle> = ({colors, spacing}) => ({
270290} )
271291
272292const $appItem : ThemedStyle < ViewStyle > = ( { colors, spacing} ) => ( {
273- backgroundColor : colors . palette . neutral100 ,
293+ backgroundColor : colors . backgroundAlt ,
274294 borderRadius : spacing . sm ,
275295 marginBottom : spacing . sm ,
276296 padding : spacing . md ,
297+ borderWidth : 2 ,
298+ borderColor : colors . border ,
299+ minHeight : 70 , // Ensure minimum height
277300} )
278301
279302const $appItemSelected : ThemedStyle < ViewStyle > = ( { colors, spacing} ) => ( {
@@ -314,12 +337,6 @@ const $appName: ThemedStyle<TextStyle> = ({colors}) => ({
314337 flex : 1 ,
315338} )
316339
317- const $developerName : ThemedStyle < TextStyle > = ( { colors, spacing} ) => ( {
318- fontSize : 13 ,
319- color : colors . textDim ,
320- marginTop : spacing . xxs ,
321- } )
322-
323340const $badge : ThemedStyle < ViewStyle > = ( { colors, spacing} ) => ( {
324341 backgroundColor : colors . palette . secondary400 ,
325342 borderRadius : spacing . xs ,
0 commit comments