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

fix inline code blocks #2527

Merged
merged 8 commits into from
Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/styles/codeStyles/index.android.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const codeWordWrapper = {
height: 10,
};
const codeWordStyle = {
borderLeftWidth: 0,
borderRightWidth: 0,
borderTopLeftRadius: 0,
borderBottomLeftRadius: 0,
borderTopRightRadius: 0,
borderBottomRightRadius: 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this just borderRadius: 0? Why does this have to be included?

Copy link
Member Author

@parasharrajat parasharrajat Apr 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jasperhuangg these style props take precedence over borderRadius. Due to the reason we need to specify borderRadius for Web, we can't remove it from the main code styles. But on native, the new implementation only wants border radius for the first and last word. Thus to override it, I have to be specific for each edge.
In Short, borderRadius does not work.

flexBasis: 'auto',
paddingLeft: 0,
paddingRight: 0,
justifyContent: 'center',
marginVertical: -2,
top: -1,
};

const codeBlock = {
lineHeight: 18,
};

export default {codeWordWrapper, codeWordStyle, codeBlock};
25 changes: 25 additions & 0 deletions src/styles/codeStyles/index.ios.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const codeWordWrapper = {
height: 20,
justifyContent: 'center',
marginTop: 4,
};
const codeWordStyle = {
borderLeftWidth: 0,
borderRightWidth: 0,
borderTopLeftRadius: 0,
borderBottomLeftRadius: 0,
borderTopRightRadius: 0,
borderBottomRightRadius: 0,
paddingLeft: 0,
paddingRight: 0,
justifyContent: 'center',
marginVertical: -2,
height: 20,
top: 4,
};

const codeBlock = {
lineHeight: 13,
};

export default {codeWordWrapper, codeWordStyle, codeBlock};
4 changes: 4 additions & 0 deletions src/styles/codeStyles/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const codeWordWrapper = {};
const codeWordStyle = {};
const codeBlock = {};
export default {codeWordWrapper, codeWordStyle, codeBlock};
18 changes: 4 additions & 14 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import wordBreak from './utilities/wordBreak';
import textInputAlignSelf from './utilities/textInputAlignSelf';
import CONST from '../CONST';
import positioning from './utilities/positioning';
import codeStyles from './codeStyles';

const styles = {
// Add all of our utility and helper styles
Expand Down Expand Up @@ -1312,22 +1313,11 @@ const styles = {
},

codeWordWrapper: {
height: 10,
...codeStyles.codeWordWrapper,
},

codeWordStyle: {
borderLeftWidth: 0,
borderRightWidth: 0,
borderTopLeftRadius: 0,
borderBottomLeftRadius: 0,
borderTopRightRadius: 0,
borderBottomRightRadius: 0,
flexBasis: 'auto',
paddingLeft: 0,
paddingRight: 0,
justifyContent: 'center',
marginVertical: -2,
top: -1,
...codeStyles.codeWordStyle,
},

codeFirstWordStyle: {
Expand Down Expand Up @@ -1418,10 +1408,10 @@ const webViewStyles = {

code: {
...baseCodeTagStyles,
...codeStyles.codeBlock,
paddingLeft: 5,
paddingRight: 5,
fontFamily: fontFamily.MONOSPACE,
lineHeight: 18,
fontSize: 13,
},

Expand Down