-
Notifications
You must be signed in to change notification settings - Fork 58
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
[Issue/605][Android]Apply OS font size scale change in editor #795
Changes from all commits
8632107
d5ac36c
0ecc2a2
a12ca56
77bcc1f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Platform } from 'react-native'; | ||
|
||
// Basically React Native has a mechanism to scale font size automatically. | ||
// But GM is rendered on top of fragment of which retain flag is true. | ||
// Hence we deal with fontScale change manually on our side. | ||
export function getScaledFontSize( fontSize, fontScale ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. currently there's no dependency of unit test in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's hold on a bit while we're still assessing the solution in this PR. While at it though, what do you have in mind for how such a unit test would be run? Will it become part of the Jest testsuite already in place in gutenberg-mobile? |
||
if ( Platform.OS === 'ios' ) { | ||
return fontSize ? fontSize : undefined; // to not to affect to iOS | ||
} | ||
const baseFontSize = 18; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we use the default value set in RN for this? https://github.com/facebook/react-native/blob/1151c096dab17e5d9a6ac05b61aacecd4305f3db/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewDefaults.java#L15 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
return ( fontSize ? fontSize : baseFontSize ) * fontScale; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not directly related to the issue but to align condition with wordpress-android added
fontScale
to prevent activity recreation by fontScale change.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 @hotchemi , does this change make the demo app differ in behavior between Android and iOS?
I'm thinking that making the demo app behave closer to WPAndroid might not be a desirable goal. Instead, the demo app should be as simple as possible and ideally not hide any "mistakes" or "hacks" WPAndroid implements. Also, ideally the Android and iOS implementations of the demo app should be as identical as possible.