react-native-builder-bob icon indicating copy to clipboard operation
react-native-builder-bob copied to clipboard

Issue when working expo-font

Open muyaszed opened this issue 4 years ago • 4 comments

Ask your Question

Hi first of all I would like to say thank you for this useful library. I am using this boilerplate(with Expo) to create an UI library and I am having a problem using a custom font(google).

In order to use the font, I need to also use expo-font to load the font properly. In doing so, I had to install all related expo dependencies to the main package in order to make it working properly.

Unfortunately, my demo expo app in the example folder will always throws an error about the font is not a system font and should be loaded properly using loadsync.

From my investigation, this is happening because there are conflicts between 2 or more expo-font installations. At the moment to solve my problem, my workaround is to create a postinstall script which will delete the expo-font module inside the expo demo app node-modules.

What are you thought on this? Is there any better way of doing this? Thanks

muyaszed avatar Mar 28 '21 17:03 muyaszed

Also having this issue with a number of expo specific modules that I require not finding @unimodules/core and other packages the Expo SDK normally installs that are present in the example app node_modules but not the package's node_modules. I have tried installing all of the missing dependancies and even adding the Expo SDK as a dep for the main package but this then directly results in the same error mentioned above.

It would be fab if there was a little more documentation on how to handle using Expo APIs for packages scaffolded with react-native-builder-bob 😃

thomas-coldwell avatar Oct 12 '21 14:10 thomas-coldwell

https://github.com/callstack/react-native-builder-bob#how-do-i-add-a-react-native-library-containing-native-code-as-a-dependency-in-my-library

satya164 avatar Oct 12 '21 14:10 satya164

Thanks @satya164 - are you suggesting that I put expo itself as a peer & dev dependency in the root package.json? I've tried that - it gets rid of any errors about @unimodules/core not being there but I also get the same error as the OP with fontFamily "material" is not a system font and has not been loaded through Font.loadAsync when using @expo/vector-icons.

thomas-coldwell avatar Oct 12 '21 14:10 thomas-coldwell

Nevermind - just me being silly 😅 put @expo/vector-icons into the peerDependencies in the root package.json and it started working perfectly. Put it in a small test repo for anyone else who might come across and wants to see an example of it https://github.com/thomas-coldwell/expo-lib-vector-icons

Thanks for pointing me in the right direction @satya164 😃

thomas-coldwell avatar Oct 12 '21 15:10 thomas-coldwell