fullstory-react-native
fullstory-react-native copied to clipboard
WIP: pass props to views that don't
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
@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