React-native-swiper: Arial font not available in Android simulator

Created on 22 Jun 2017  路  4Comments  路  Source: leecade/react-native-swiper

Hi, the swiper is working perfectly in ios, but I'm getting an error in Android simulator (Nexus 5 on Android Studio), that says Arial is not a system font.
The line triggering this issue is 86 on src/index.js.
I'm using create react native app, which uses Expo on the background.

image

Thanks

Most helpful comment

Looks like it's being required for the control buttons (next/previous arrow buttons) so you can bypass this by either not showing the controls or providing your own nextButton and prevButton props:

<Swiper nextButton={<Text>&gt;</Text>} prevButton={<Text>&lt;</Text>} />

All 4 comments

I had the same issue, but I solved by adding Arial font to my app.

  1. Download Arial font.
    https://jp.ffonts.net/Arial.font.download
  2. Add "Arial.ttf" to some directory of your project.
  3. Loading the font in your app by "Expo.Font" API.

e.g.

import { Font } from 'expo';
export default class App extends React.Component {
  state = {
    fontLoaded: false
  }
  async componentDidMount() {
    await Font.loadAsync({
      'Arial': require('./path/to/fonts/Arial.ttf')
    });
    this.setState({ fontLoaded: true });
  }
  render() {
    if (!this.state.fontLoaded) return null;
    return (
      <Main /> 
    );
  }
  // ...
}

I have the same issue, and - as a workaround - have added arial.ttf to my project. However,

a) I am using other fonts in my app.
b) Arial requires an extra 358k of download to my users which I'd prefer to save them...

I am new to react-native. Can I override this default behaviour by specifying a fontFamily in the component somewhere? Just looking through the code, it doesn't look like I can do that, but I am not sure.

If you are already using a custom font you can just add a duplicate require with 'Arial' as the key. Silly but no bloat at least...:)

Looks like it's being required for the control buttons (next/previous arrow buttons) so you can bypass this by either not showing the controls or providing your own nextButton and prevButton props:

<Swiper nextButton={<Text>&gt;</Text>} prevButton={<Text>&lt;</Text>} />
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

AndrewSouthpaw picture AndrewSouthpaw  路  3Comments

tokict picture tokict  路  3Comments

itinance picture itinance  路  3Comments

hadrienbbt picture hadrienbbt  路  3Comments