entria / react-native-fontawesome

React Native Font Awesome Icons
MIT License
176 stars 34 forks source link

Include Example #2

Closed rturk closed 7 years ago

rturk commented 7 years ago
speller commented 7 years ago

Don't understand how to use it. When I try this:

import FontAwesome from 'react-native-fontawesome';
...
    render() {
        return (
            <View style={styles.container}>
                <TouchableHighlight style={ styles.imageContainer }>
                    <FontAwesome>
                        yahoo
                    </FontAwesome>
                </TouchableHighlight>
            </View>
        );
    };

I get the error: Touchable child must either be native or forward setNativeProps to a native component

What to do?

sibelius commented 7 years ago

@speller could u try this branch https://github.com/entria/react-native-fontawesome/pull/3

it will solve your problem

speller commented 7 years ago

@sibelius The patch is incomplete. It work only if I change the first file of the file to import React, { Component } from 'react'; . This solved the error messages, but I still can't see any icons, just a blank page. How to change my example above to see icons? I added the fontawesome-webfont.ttf to the assets/fonts dir.

sibelius commented 7 years ago

ok, I'll fix it

You also need to include the fonts on ios and android

image

the name should be FontAwesome.ttf

feel free to send a PR to improve README.md instructions

speller commented 7 years ago

@sibelius The font filename was the issue, thanks!

I'm totally newbie in mobile development and React Native so I just learn everything.

So I suggest following addition to the README: