fullstory-react-native icon indicating copy to clipboard operation
fullstory-react-native copied to clipboard

WIP: pass props to views that don't

Open RyanCommits opened this issue 1 year ago • 1 comments

const CustomComponent = () => {
  return <Text>sample text</Text>
}

class CustomClassComponent extends React.Component {
  render() {
    return <Text>sample text</Text>
  }
}

const FSComponent = withFSAttributes(CustomComponent)
const FSClassComponent = withFSAttributes(CustomClassComponent)

const App = () => {
  return (
    <View>
      <FSComponent fsClass="fs-unmask" />
      <FSClassComponent fsClass="fs-unmask" />
    </View>
  )
}

For the above example, CustomComponent does not pass props to its children. Using the Higher Order Component withFSAttributes will pass fsClass and any other props to its children (top level element).

TODO - typescript and tests

RyanCommits avatar Feb 16 '23 20:02 RyanCommits

@JoshMiers-FS @prashanthsadasivan-fullstory This is a WIP but let me know if this is sufficient to solve our customer's issue. If it's good I'll write some tests and add support for TypeScript

RyanCommits avatar Feb 16 '23 20:02 RyanCommits