File tree 3 files changed +10
-0
lines changed
3 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ exports[`elementsToReactElements > should ignore dynamic texts by default 1`] =
20
20
" marginBottom" : 0 ,
21
21
" marginTop" : 0 ,
22
22
" position" : " absolute" ,
23
+ " textAlign" : " left" ,
23
24
" top" : " 0px" ,
24
25
" width" : " 100px" ,
25
26
},
@@ -74,6 +75,7 @@ exports[`elementsToReactElements > should render text chidrens 1`] = `
74
75
" marginBottom" : 0 ,
75
76
" marginTop" : 0 ,
76
77
" position" : " absolute" ,
78
+ " textAlign" : " left" ,
77
79
" top" : " 0px" ,
78
80
" width" : " 100px" ,
79
81
},
@@ -143,6 +145,7 @@ exports[`elementsToReactElements > should replace dynamic texts if present 1`] =
143
145
" marginBottom" : 0 ,
144
146
" marginTop" : 0 ,
145
147
" position" : " absolute" ,
148
+ " textAlign" : " left" ,
146
149
" top" : " 0px" ,
147
150
" width" : " 100px" ,
148
151
},
Original file line number Diff line number Diff line change @@ -319,6 +319,7 @@ describe("createElementStyle", () => {
319
319
"marginBottom": 0,
320
320
"marginTop": 0,
321
321
"position": "absolute",
322
+ "textAlign": "left",
322
323
"top": "20px",
323
324
"width": "100px",
324
325
}
@@ -369,6 +370,7 @@ describe("createElementStyle", () => {
369
370
"marginBottom": 0,
370
371
"marginTop": 0,
371
372
"position": "absolute",
373
+ "textAlign": "left",
372
374
"textShadow": "2px 2px 4px blue",
373
375
"top": "20px",
374
376
"width": "100px",
@@ -413,6 +415,7 @@ describe("createElementStyle", () => {
413
415
"marginBottom": 0,
414
416
"marginTop": 0,
415
417
"position": "absolute",
418
+ "textAlign": "center",
416
419
"top": "20px",
417
420
"width": "100px",
418
421
}
@@ -456,6 +459,7 @@ describe("createElementStyle", () => {
456
459
"marginBottom": 0,
457
460
"marginTop": 0,
458
461
"position": "absolute",
462
+ "textAlign": "right",
459
463
"top": "20px",
460
464
"width": "100px",
461
465
}
Original file line number Diff line number Diff line change @@ -189,6 +189,9 @@ export function createElementStyle(element: OGElement): CSSProperties {
189
189
fontSize : `${ element . fontSize } px` ,
190
190
lineHeight : element . lineHeight ,
191
191
letterSpacing : `${ element . letterSpacing } px` ,
192
+ // We need both textAlign and justifyContent to center the text
193
+ // so that it works with both single and multi-line text
194
+ textAlign : element . align ,
192
195
justifyContent :
193
196
element . align === "center"
194
197
? "center"
You can’t perform that action at this time.
0 commit comments