react-native-vector-icons icon indicating copy to clipboard operation
react-native-vector-icons copied to clipboard

Unrecognized font family 'Ionicons'

Open Edydh opened this issue 5 years ago • 11 comments

  • [ ] Review the documentation: https://github.com/oblador/react-native-vector-icons
  • [ ] Search for existing issues (including closed ones): https://github.com/oblador/react-native-vector-icons/issues

Environment

macOS Catalina 10.15.6 IOS "react-native-vector-icons": "^7.0.0"

Description

Describe your issue in detail. Include screenshots if needed. I am trying to add a simple Icon button to open navigation.openDrawer

import Icon from 'react-native-vector-icons/Ionicons';

const HomeStackScreen = ({navigation}) => ( <HomeStack.Navigator> <HomeStack.Screen name="Home" component={HomeScreen} options={{ title: 'Feed', headerLeft: () =>( <Icon.Button name="menu" size={25} backgroundColor="#61dafb" onPress={() => navigation.openDrawer()}></Icon.Button> )

  }} />

</HomeStack.Navigator>

);

Demo

You can use https://snack.expo.io/ to create a demo that can help users to better understand your problem.

Edydh avatar Sep 04 '20 19:09 Edydh

having to same problem as well! ):

aaculp avatar Sep 09 '20 18:09 aaculp

For IOS

Edit Info.plist and add a property called Fonts provided by application (or UIAppFonts if Xcode won't autocomplete/not using Xcode) and type in the files you just added. It will look something like this: XCode screenshot https://cloud.githubusercontent.com/assets/378279/12421498/2db1f93a-be88-11e5-89c8-2e563ba6251a.png

Just step 4 from the following link:

https://medium.com/@vimniky/how-to-use-vector-icons-in-your-react-native-project-8212ac6a8f06

The new version of react-native does the library automatically

  1. Add Fonts provided by application as a new key

Edydh avatar Sep 11 '20 19:09 Edydh

Hi @Edydh I have the same problem where im passing Ionicon as a setting pram for react-native-paper

export default function Main() {
	return (
		<PaperProvider
			theme={theme}
			settings={{
				icon: props => <Ionicons {...props} />,
			}}>
			<App />
		</PaperProvider>
	);
}

so from the react native 0.60 update, manual linking, for eg: react-native link react-native-vector-icons will cause failure in ios as the auto link will twice link causing failure in build, so even the manual linking from https://github.com/oblador/react-native-vector-icons#option-manually will cause error.

now its working after adding the .ttf file on the info.plist now :) image

ravi0the0sun avatar Nov 13 '20 02:11 ravi0the0sun

Still having this problem with iOS. Anyone resolve this?

jvence avatar Feb 24 '21 10:02 jvence

This is the solution https://github.com/oblador/react-native-vector-icons/issues/1238#issuecomment-691278273

Just the step 4 of the following link:

https://medium.com/@vimniky/how-to-use-vector-icons-in-your-react-native-project-8212ac6a8f06

for react-native versions > 0.60

It worked for me

gdeusdara avatar Feb 27 '21 20:02 gdeusdara

Is there a reason that we have to manually add them? Not any way to automate this process? A lot of people are going to run into this issue.

smilingkylan avatar Jul 07 '21 06:07 smilingkylan

Try to import and load the font

import Ionicons from 'react-native-vector-icons/Ionicons'
Ionicons.loadFont()

ramirobg94 avatar Jul 16 '21 11:07 ramirobg94

This seems like a conspiracy theory. I'm also having this problem and tried everything. It works on Android but not on IOS. For more than 3 days trying everything with a dam Mac air that takes more than 40 minutes to refresh the cache. Is just pure hell.

bogdan-marian avatar Nov 01 '21 22:11 bogdan-marian

Try to import and load the font

import Ionicons from 'react-native-vector-icons/Ionicons'
Ionicons.loadFont()

it work for me! thank!

Kusou1 avatar Jun 22 '22 10:06 Kusou1

import Ionicons from 'react-native-vector-icons/Ionicons' Ionicons.loadFont()

Thanks, it works for me! Do you know why this is needed?

wolfzer44 avatar Sep 05 '22 23:09 wolfzer44

import Ionicons from 'react-native-vector-icons/Ionicons' Ionicons.loadFont()

Thanks, it works for me! Do you know why this is needed?

In the end, it makes sense because in this case you only load the needed font when you mount the app the first time. Imagine importing or loading all the fonts... that's huge and not needed.

ramirobg94 avatar Sep 07 '22 13:09 ramirobg94

follow the below link for solution https://www.devhubspot.net/post/detail/react-native-unrecognised-font-family-error-solution

Sudarshan101 avatar Mar 13 '23 14:03 Sudarshan101

Can I just say that this should not be considered as fixed. This should not be closed. Just copying the fonts manually by had in a new directory and then try this... and if it does not work try that... and if it does not work try the otter thing. is just not a fix. This is a workaround. It works on android out of the box when you add a specific font module. It should work also on ios.

bogdan-marian avatar Aug 05 '23 11:08 bogdan-marian