MCPcopy Create free account
hub / github.com/dabit3/react-native-ai / ChatModelModal

Function ChatModelModal

app/src/components/ChatModelModal.tsx:6–47  ·  view source on GitHub ↗
({ handlePresentModalPress })

Source from the content-addressed store, hash-verified

4import { Model, Theme } from '../../types'
5
6export function ChatModelModal({ handlePresentModalPress }: { handlePresentModalPress: () => void }) {
7 const { theme } = useContext(ThemeContext)
8 const { setChatType, chatType, models } = useContext(AppContext)
9 const styles = getStyles(theme)
10 const options = models
11
12 function _setChatType(v: Model) {
13 setChatType(v)
14 handlePresentModalPress()
15 }
16
17 return (
18 <View style={styles.bottomSheetContainer}>
19 <View>
20 <View style={styles.chatOptionsTextContainer}>
21 <Text style={styles.chatOptionsText}>
22 Models
23 </Text>
24 </View>
25 {
26 options.map((option, index) => (
27 <TouchableHighlight
28 underlayColor={'transparent'}
29 onPress={() => _setChatType(option)}
30 accessibilityRole="button"
31 accessibilityLabel={`Select model ${option.name}`}
32 key={index}>
33 <View style={optionContainer(theme, chatType.label, option.label)}>
34 <option.icon
35 size={20}
36 theme={theme}
37 selected={chatType.label === option.label}
38 />
39 <Text style={optionText(theme, chatType.label, option.label)}>
40 {option.name}
41 </Text>
42 </View>
43 </TouchableHighlight>
44 ))
45 }
46 </View>
47 </View>
48 )
49}
50

Callers

nothing calls this directly

Calls 4

optionContainerFunction · 0.85
optionTextFunction · 0.85
getStylesFunction · 0.70
_setChatTypeFunction · 0.70

Tested by

no test coverage detected