I have the following component structure being rendered:
<Text>
Hello <UsernameWrapper>@gaberocksall</UsernameWrapper>! Nice to meet you.
</Text>
I would like create a custom component which automatically places @usernames into a UsernameWrapper, like this (and it should be rendered identically to the above snippet):
<AutoUsernameText>Hello @gaberocksall! Nice to meet you.</AutoUsernameText>
Or, even more generally, something along the lines of:
<MagicWrapper wrap={/@\w+/gi} wrapper={UsernameWrapper}>
Hello @gaberocksall! Nice to meet you.
</MagicWrapper>
How would I go about creating the MagicWrapper component in React Native?