Skip to content

Touchable #8

Description

@ssomnoremac

I'm finding more often than not that I do this:

<Row>
  <Touchable onPress={}>...</Touchable>
<Row>

Why not just toggle the Component type to Touchable (handling Platform differences as well) when onPress is present?

<Row onPress={}>...</Row>

and like so

const Component = !onPress
    ? View
    : Platform.OS === 'android'
        ? TouchableNativeFeedback 
        : TouchableHighlight

    <Component style={[_style, _shorthandStyles, style]} onPress={onPress || () => null} {...otherProps} >
        {props.children}
    </Component>

pass the empty function to View ? There might be a better way.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions