Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: text nested variants #442

Merged
merged 2 commits into from
Dec 15, 2024
Merged

feat: text nested variants #442

merged 2 commits into from
Dec 15, 2024

Conversation

jpudysz
Copy link
Owner

@jpudysz jpudysz commented Dec 15, 2024

Summary

Fixes an issue reported on Discord.
If there are two text nodes with a parent <-> child relationship, there was a bug where the child's variants would override the parent's variants. This PR fixes that by ensuring variants are rolled out from the child to the parent, so every node now has the correct variant attached. It also supports cases where React Native Text nodes inherit parent styles, similar to regular React Native behavior.

For:

<React.Fragment>
      <ThemedText type="title">
        Parent
        <ThemedText>
          Amother ThemedText
        </ThemedText>
      </ThemedText>
      <ThemedText type="title">
        Parent
        <Text>
          RN Text
        </Text>
      </ThemedText>
</React.Fragment>

We should get following result:

RocketSim_Screenshot_iPhone_16_Pro_Max_6 9_2024-12-15_15 38 16

Requires regression testing before merging for #433

Copy link

vercel bot commented Dec 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-unistyles-2.0 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 15, 2024 2:57pm
react-native-unistyles-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 15, 2024 2:57pm

@jpudysz
Copy link
Owner Author

jpudysz commented Dec 15, 2024

Looks good with variants nested Pressables regression

@jpudysz jpudysz merged commit da1f1a6 into main Dec 15, 2024
4 checks passed
@jpudysz jpudysz deleted the feature/nested-variants branch December 15, 2024 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant