Skip to content

Add dynamic fonts loading (and downloading) #2736

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

Merged
merged 11 commits into from
Sep 19, 2023
Merged

Conversation

M-i-k-e-l
Copy link
Collaborator

@M-i-k-e-l M-i-k-e-l commented Sep 7, 2023

Description

Add dynamic fonts loading (and downloading)
Please note that Android emulator sometimes has issues with connectivity and it needs to be restarted (mainly after the computer "goes to sleep")

Changelog

DynamicFonts - download and load to memory fonts - this is experimental for now! (also requires using react-native-fs)

Additional info

WOAUILIB-3752

@M-i-k-e-l M-i-k-e-l added the Important for Next Release PR that must be included in the release version label Sep 7, 2023
@M-i-k-e-l M-i-k-e-l requested a review from Inbal-Tish September 7, 2023 05:06
@M-i-k-e-l
Copy link
Collaborator Author

M-i-k-e-l commented Sep 7, 2023

@Inbal-Tish I've added the DynamicFontsScreen, not sure why but not all Android's fonts appear to be working, any idea?
* I do see them in the local folder (fixed)

@Inbal-Tish
Copy link
Collaborator

Simulator Screenshot - iPhone 13 - 2023-09-11 at 09 43 24

@M-i-k-e-l
Copy link
Collaborator Author

M-i-k-e-l commented Sep 11, 2023

@Inbal-Tish
Please clean-install, it has been added to the devDependencies (it is also noted in the comments under changelog)

@Inbal-Tish
Copy link
Collaborator

@Inbal-Tish Please clean-install, it has been added to the devDependencies (it is also noted in the comments under changelog)

I did - twice. And pod-install

@M-i-k-e-l
Copy link
Collaborator Author

@Inbal-Tish Please clean-install, it has been added to the devDependencies (it is also noted in the comments under changelog)

I did - twice. And pod-install

Maybe it's a cache issue? Did you clean it?
I'll retest it myself

@M-i-k-e-l
Copy link
Collaborator Author

@Inbal-Tish Please clean-install, it has been added to the devDependencies (it is also noted in the comments under changelog)

I did - twice. And pod-install

Maybe it's a cache issue? Did you clean it? I'll retest it myself

Works for me :/

@@ -0,0 +1,9 @@
export default class PermissionsAcquirer {
public async checkPermissions() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Who's calling this method?

Copy link
Collaborator Author

@M-i-k-e-l M-i-k-e-l Sep 13, 2023

Choose a reason for hiding this comment

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

It is used in the same file.
If you asking about the fact it is public, then I thought it can be useful but I did not use it yet.

Copy link
Collaborator

Choose a reason for hiding this comment

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

What same file? On Android you're calling it from getPermissions but here it is not called at all...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, I think I wanted similar API, not sure why... I'll remove it

return new Promise((resolve, reject) => {
DynamicFont.loadFontFromFile({
name: fontName,
filePath
Copy link
Collaborator

Choose a reason for hiding this comment

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

on iOS this param is called 'path', not 'filePath'...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll comment it out

RCT_EXPORT_METHOD(
loadFontFromFile:(NSDictionary *)options callback:(RCTResponseSenderBlock)callback)
{
NSString *path = [options valueForKey:@"path"];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here - the parm name you extract is "path" (not "pathFile")

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll comment it out

@Inbal-Tish
Copy link
Collaborator

@M-i-k-e-l Looks really great. I left you a few small comments and I'll keep trying to run it or see why it keeps asking me for the fs dependency...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Important for Next Release PR that must be included in the release version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants