SearchBar from react-native-elements problem on sdk25


#1

https://snack.expo.io/BJDgohbdM

You can test it here, on skd24 the searchbar is fine, if you change to 25, non is working…

2nd problem:
can’t run this on locale. fontFamaly 'MaterialIcons" is not a system font
So, how to load MaterialIcons with loadAsync??


#2

When you change the SDK version in snack, you need to save and reload the snack before it will work on your device :confused:
https://snack.expo.io/rJ45S6buM

If you share an example for the MaterialIcons thing, I suspect there’s an easier solution, but you can add whatever icon sets you want: https://docs.expo.io/versions/latest/guides/icons.html


#3

thanks,
loading material is the problem.
How snack load the fonts?
for ionicon i know that Ionicon.font is enough, but for material? there are no wrote api, no example. Can you make this run on local?


#4

Hey @bonobomagno - I think I experienced the same problem as you recently, and I solved it by adding await Font.loadAsync({ 'Material Icons': require('@expo/vector-icons/fonts/MaterialIcons.ttf')}) to componentDidMount of my root component. Could you give that a try and let us know if that fixes things for you? We’re not quite sure why it isn’t working out of the box right now, but we’re working on it!


Async load non Ionicons Icon
#5

This is what I was talking.
No api about.
I did with 'MaterialIcons", at least it didn’t give me error, but the icon was non visible.

Now i’m asking how ‘Material Icons’, with the space , can work. Never saw a space inspecting the code…
Btw, tomorrow I will test, and I suggest to write a better api for vector icon lib
Thanks


#6

Ok.

  componentDidMount () {
    Font.loadAsync({
      'MaterialIcons': require('@expo/vector-icons/fonts/MaterialIcons.ttf')
    })
  }

now it works, but using explicit ttf file for this work is really ugly.
any plan for a bettere api on vector-icons?


closed #7

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.