Skip to content

Commit 12b6345

Browse files
committed
Use monospace font for code (inline, block & fence)
This improves the rendering of code (code_inline, code code_block and fence) to use a monospace font. Fonts that are installed by default on iOS / Android are chosen. before (iOS): <img width="436" alt="code_monospace_ios_before" src="https://user-images.githubusercontent.com/456610/89115794-27910680-d441-11ea-896c-49ab714dcf68.png"> after (iOS): <img width="432" alt="code_monospace_ios_after" src="https://user-images.githubusercontent.com/456610/89115797-2bbd2400-d441-11ea-8298-c4c902f515f8.png"> before (Android): <img width="358" alt="code_monospace_android_before" src="https://user-images.githubusercontent.com/456610/89115800-2f50ab00-d441-11ea-8a26-6af850a697df.png"> after (Android): <img width="355" alt="code_monospace_android_after" src="https://user-images.githubusercontent.com/456610/89115801-337cc880-d441-11ea-85b4-1529dfdf1c81.png">
1 parent 773c723 commit 12b6345

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/lib/styles.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,20 +133,44 @@ export const styles = {
133133
backgroundColor: '#f5f5f5',
134134
padding: 10,
135135
borderRadius: 4,
136+
...Platform.select({
137+
["ios"]: {
138+
fontFamily: "Courier",
139+
},
140+
["android"]: {
141+
fontFamily: "monospace",
142+
},
143+
}),
136144
},
137145
code_block: {
138146
borderWidth: 1,
139147
borderColor: '#CCCCCC',
140148
backgroundColor: '#f5f5f5',
141149
padding: 10,
142150
borderRadius: 4,
151+
...Platform.select({
152+
["ios"]: {
153+
fontFamily: "Courier",
154+
},
155+
["android"]: {
156+
fontFamily: "monospace",
157+
},
158+
}),
143159
},
144160
fence: {
145161
borderWidth: 1,
146162
borderColor: '#CCCCCC',
147163
backgroundColor: '#f5f5f5',
148164
padding: 10,
149165
borderRadius: 4,
166+
...Platform.select({
167+
["ios"]: {
168+
fontFamily: "Courier",
169+
},
170+
["android"]: {
171+
fontFamily: "monospace",
172+
},
173+
}),
150174
},
151175

152176
// Tables

0 commit comments

Comments
 (0)