Skip to content

Commit

Permalink
refactor: avoid spreading in Text styles
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitarNestorov committed Feb 7, 2023
1 parent c02070b commit ef368b7
Show file tree
Hide file tree
Showing 19 changed files with 117 additions and 120 deletions.
4 changes: 2 additions & 2 deletions src/components/Typography/AnimatedText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ function AnimatedText({
<Animated.Text
{...rest}
style={[
{ ...font, color: theme.colors.onSurface },
font,
styles.text,
{ writingDirection },
{ writingDirection, color: theme.colors.onSurface },
style,
]}
/>
Expand Down
7 changes: 2 additions & 5 deletions src/components/Typography/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,9 @@ const Text = (
<NativeText
ref={root}
style={[
{
...font,
color: theme.colors.onSurface,
},
font,
styles.text,
{ writingDirection },
{ writingDirection, color: theme.colors.onSurface },
style,
]}
{...rest}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,6 @@ exports[`Appbar passes additional props to AppbarBackAction, AppbarContent and A
style={
Array [
Object {
"color": "rgba(28, 27, 31, 1)",
"fontFamily": "System",
"fontSize": 22,
"fontWeight": "400",
Expand All @@ -752,6 +751,7 @@ exports[`Appbar passes additional props to AppbarBackAction, AppbarContent and A
"textAlign": "left",
},
Object {
"color": "rgba(28, 27, 31, 1)",
"writingDirection": "ltr",
},
Array [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ exports[`can render leading checkbox control 1`] = `
style={
Array [
Object {
"color": "rgba(28, 27, 31, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
Expand All @@ -140,6 +139,7 @@ exports[`can render leading checkbox control 1`] = `
"textAlign": "left",
},
Object {
"color": "rgba(28, 27, 31, 1)",
"writingDirection": "ltr",
},
Array [
Expand Down Expand Up @@ -213,7 +213,6 @@ exports[`can render the Android checkbox on different platforms 1`] = `
style={
Array [
Object {
"color": "rgba(28, 27, 31, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
Expand All @@ -224,6 +223,7 @@ exports[`can render the Android checkbox on different platforms 1`] = `
"textAlign": "left",
},
Object {
"color": "rgba(28, 27, 31, 1)",
"writingDirection": "ltr",
},
Array [
Expand Down Expand Up @@ -412,7 +412,6 @@ exports[`can render the iOS checkbox on different platforms 1`] = `
style={
Array [
Object {
"color": "rgba(28, 27, 31, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
Expand All @@ -423,6 +422,7 @@ exports[`can render the iOS checkbox on different platforms 1`] = `
"textAlign": "left",
},
Object {
"color": "rgba(28, 27, 31, 1)",
"writingDirection": "ltr",
},
Array [
Expand Down Expand Up @@ -575,7 +575,6 @@ exports[`renders unchecked 1`] = `
style={
Array [
Object {
"color": "rgba(28, 27, 31, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
Expand All @@ -586,6 +585,7 @@ exports[`renders unchecked 1`] = `
"textAlign": "left",
},
Object {
"color": "rgba(28, 27, 31, 1)",
"writingDirection": "ltr",
},
Array [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ exports[`can render leading radio button control 1`] = `
style={
Array [
Object {
"color": "rgba(28, 27, 31, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
Expand All @@ -139,6 +138,7 @@ exports[`can render leading radio button control 1`] = `
"textAlign": "left",
},
Object {
"color": "rgba(28, 27, 31, 1)",
"writingDirection": "ltr",
},
Array [
Expand Down Expand Up @@ -211,7 +211,6 @@ exports[`can render the Android radio button on different platforms 1`] = `
style={
Array [
Object {
"color": "rgba(28, 27, 31, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
Expand All @@ -222,6 +221,7 @@ exports[`can render the Android radio button on different platforms 1`] = `
"textAlign": "left",
},
Object {
"color": "rgba(28, 27, 31, 1)",
"writingDirection": "ltr",
},
Array [
Expand Down Expand Up @@ -341,7 +341,6 @@ exports[`can render the iOS radio button on different platforms 1`] = `
style={
Array [
Object {
"color": "rgba(28, 27, 31, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
Expand All @@ -352,6 +351,7 @@ exports[`can render the iOS radio button on different platforms 1`] = `
"textAlign": "left",
},
Object {
"color": "rgba(28, 27, 31, 1)",
"writingDirection": "ltr",
},
Array [
Expand Down Expand Up @@ -503,7 +503,6 @@ exports[`renders unchecked 1`] = `
style={
Array [
Object {
"color": "rgba(28, 27, 31, 1)",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
Expand All @@ -514,6 +513,7 @@ exports[`renders unchecked 1`] = `
"textAlign": "left",
},
Object {
"color": "rgba(28, 27, 31, 1)",
"writingDirection": "ltr",
},
Array [
Expand Down
Loading

0 comments on commit ef368b7

Please sign in to comment.