react-navigation icon indicating copy to clipboard operation
react-navigation copied to clipboard

Font issues on iOS

Open ilyaux opened this issue 7 years ago • 1 comments

Faced with such a problem.The application was tested on Android. Today I started testing on iOS and an error occurred. The font is not loaded.

Environment

"OS": "Windows"
"iOS": "11"
"expo": "^32.0.0",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",

Steps to Reproduce

Launch the app on iOS 11.

  1. Boot Index.js
import {AppRegistry} from 'react-native'
import RootNavigation from './App'
import {name as appName} from './app.json'


AppRegistry.registerComponent(appName, () => RootNavigation)
  1. Then the tabnavigator is loaded:
const RootNavigation = createBottomTabNavigator(
  {
    1: Feed,
    2: MapScreen,
    3: Favorite,
    4: Profile,
    5: Search
  },
  {
    navigationOptions: ({ navigation }) => ({
      tabBarIcon: ({ focused, tintColor }) => {
        const { routeName } = navigation.state;
        let iconName;
        if (routeName === "1") {
          iconName = focused ? "ios-star" : "ios-star";
        } else if (routeName === "2") {
          iconName = focused ? "ios-map" : "ios-map";
        } else if (routeName === "3") {
          iconName = focused ? "ios-paper" : "ios-paper";
        } else if (routeName === "4") {
          iconName = focused ? "ios-person" : "ios-person";
        } else if (routeName === "5") {
          iconName = focused ? "ios-search" : "ios-search";
        }
        return <Ionicons name={iconName} size={22} color={tintColor} />;
      }
    }),
    tabBarOptions: {
      activeTintColor: BLUE,
      inactiveTintColor: "gray",
      inactiveBackgroundColor: "#1f1f1f",
      activeBackgroundColor: "#1f1f1f",
      style: {
        elevation: 30,
        backgroundColor: "green",
        borderTopWidth: 1,
        borderTopColor: "#1f1f1f"
      }
    }
  }
);

export default RootNavigation;

Expected Behavior

Load the Feed page.

Actual Behavior

Error on iOS:

fontFamily "Roboto" is not a system font and has not been loaded through Font.loadAsync.

If you intended to use a system font, make sure you typed the name correctly and that it is supported by your device operating system.

As I know it somewhere you want to insert. But I don't know where:

import { Font } from 'expo';

    state = {
      fontLoaded: false,
    };

    componentDidMount() {
        Font.loadAsync({
          'Roboto': require('./assets/fonts/Roboto.ttf'),
        });
      }

I would be very grateful for your help!

ilyaux avatar Mar 10 '19 23:03 ilyaux

Hi there!

closing in favor of https://github.com/expo/expo/issues/3690

eriveltonelias avatar Mar 13 '19 00:03 eriveltonelias