React-native-swiper: fontFamily: 'Arial' is missing

Created on 19 Feb 2018  路  3Comments  路  Source: leecade/react-native-swiper

Which OS ?

Android.

Version

Which versions are you using:

  • react-native-swiper v1.5.13
  • react-native v0.50.3

Expected behaviour

This error should not be thrown, as having or not having font family Arial available seems to make no difference to the swiper.

Actual behaviour

If Arial has not been loaded in as a fontFamily every time the swiper is mounted, or when you swipe to another component using the swiper, this error is thrown.

How to reproduce it

Use the swiper on any React Native project without Arial loaded and set showButtons={true} . Then use the swiper component to trigger this error.

Temporary solution

Since having or not having Arial seems to make no difference, you can 'fool' swiper into thinking Arial is loaded by adding 'Arial':require('./anyfont.ttf') to the section where you load your fonts (usually Expo.Font.loadAsync() ) , replacing anyfont.ttf with any font file that can be loaded.

Most helpful comment

you must go node_modules/react-native-swiper/index.js find fontFamily: 'Arial' and remove it

All 3 comments

you must go node_modules/react-native-swiper/index.js find fontFamily: 'Arial' and remove it

Edited : Solution here https://github.com/leecade/react-native-swiper/issues/444#issuecomment-311583763

_Hey @Sadoyangrigor !
Thank you for the answer to this question, as I ran into the same problem, however removing something in node_modules is not something we can consider a good solution, is there anything else we could do that you recommend (that would persist an installation on another collaborator's computer) ?_

Instead of adding font,
I just overrided the button style:

nextButton={styles.buttonText} prevButton={styles.buttonText}

buttonText: { fontSize: 50, color: '#007aff', }

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ruben-kasaz picture ruben-kasaz  路  3Comments

nicolabortignon picture nicolabortignon  路  3Comments

Liqiankun picture Liqiankun  路  3Comments

chetanparakh picture chetanparakh  路  3Comments

losikov picture losikov  路  3Comments