You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Event if the user does not pass onPress the listItem visual behavior is touchable, due to the wrapper: <TouchableOpactity>
i.e: compare: <DemoCommunityScreen> vs DemoDebugScreen
Solution overview
A way to fix this in the ListItem component is by conditionally render the TouchableOpacity, this is a functional code sample:
// PATH: app/components/ListItem.tsx// check if obPress props is presentconstisTouchable=TouchableOpacityProps.onPress!==undefinedconstcontent=(<><ListItemActionside="left"size={height}icon={leftIcon}iconColor={leftIconColor}Component={LeftComponent}/><Text{...TextProps}tx={tx}text={text}txOptions={txOptions}style={themed($textStyles)}>{children}</Text><ListItemActionside="right"size={height}icon={rightIcon}iconColor={rightIconColor}Component={RightComponent}/></>)return(<Viewref={ref}style={themed($containerStyles)}>{/* make the item touchable if required */}{isTouchable ? (<TouchableOpacity{...TouchableOpacityProps}style={$touchableStyles}>{content}</TouchableOpacity>) : ({/* it could be raw View, styledView or React Fragment */}<Viewstyle={$touchableStyles}>{content}</View>)}</View>)
The text was updated successfully, but these errors were encountered:
Current behavior
Event if the user does not pass
onPress
the listItem visual behavior is touchable, due to the wrapper:<TouchableOpactity>
i.e: compare:
<DemoCommunityScreen>
vsDemoDebugScreen
Solution overview
A way to fix this in the
ListItem
component is by conditionally render theTouchableOpacity
, this is a functional code sample:The text was updated successfully, but these errors were encountered: