Skip to content

Commit 3d84352

Browse files
committed
fix: add button margins and reduce text container margins to prevent cutoff
1 parent 07103af commit 3d84352

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

.changeset/fix-button-margins.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'create-expo-stack': patch
3+
'rn-new': patch
4+
---
5+
6+
Add horizontal margins to button wrapper in Nativewind templates to prevent full-width buttons.
7+
8+
- Add button wrapper View with `mx-4` class (16px horizontal margins) around Link/Button components in the Nativewind Expo Router stack template
9+
- Ensures buttons have proper spacing and don't stretch to fill the entire screen width

cli/src/templates/packages/expo-router/stack/app/index.tsx.ejs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,19 @@ export default function Home() {
3030
<InternalizationExample />
3131
<% } %>
3232
</ScreenContent>
33+
<% if (props.stylingPackage?.name === "nativewind") { %>
34+
<View className={styles.buttonWrapper}>
35+
<% } %>
3336
<Link href={{ pathname: '/details', params: { name: 'Dan' } }} asChild>
3437
<% if (props.stylingPackage?.name === "unistyles") { %>
3538
<Button title="Show Details" style={styles.button} />
3639
<% } else { %>
3740
<Button title="Show Details" />
3841
<% } %>
3942
</Link>
43+
<% if (props.stylingPackage?.name === "nativewind") { %>
44+
</View>
45+
<% } %>
4046
</Container>
4147
</View>
4248
);
@@ -45,7 +51,8 @@ export default function Home() {
4551
<% if (props.stylingPackage?.name === "nativewind") { %>
4652
const styles = {
4753
container: "flex flex-1 bg-white",
48-
}
54+
buttonWrapper: "mx-4",
55+
};
4956
<% } else if (props.stylingPackage?.name === "stylesheet") { %>
5057
const styles = StyleSheet.create({
5158
container: {

0 commit comments

Comments
 (0)