๐Ÿ“ฆ manideepk90 / react-native-hyperswitch-sdk

๐Ÿ“„ ClickableTextElement.res ยท 35 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35open ReactNative
open Style

@react.component
let make = (
  ~initialIconName,
  ~updateIconName=None,
  ~text,
  ~isSelected,
  ~setIsSelected,
  ~textType,
  ~fillIcon=true,
  ~fillText=false,
  ~disabled=false,
  ~gap=10.,
  ~coloredText=false,
  ~size=?,
) => {
  let {linkColor, primaryColor} = ThemebasedStyle.useThemeBasedStyle()
  let isLink = textType === TextWrapper.LinkText || textType === LinkTextBold
  <CustomPressable
    disabled
    style={s({flexDirection: #row, alignItems: #center})}
    onPress={_ => setIsSelected(!isSelected)}
  >
    <CustomSelectBox
      initialIconName updateIconName isSelected fill={isLink ? linkColor : primaryColor} ?size
    />
    <Space width=gap />
    <TextWrapper
      text textType overrideStyle={Some(s({flex: 1., color: ?(isLink ? Some(linkColor) : None)}))}
    />
  </CustomPressable>
}