Giter Club home page Giter Club logo

Comments (4)

acornejo avatar acornejo commented on April 28, 2024 1

@cyprusglobe I did install @exponent/vector-icons, although I had not done the --save-dev (i.e. it was not in package.json). However AFAIK that should not make a difference.

the error stems from the following line in Icon.js (part of native-base):

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

I repeated the same steps in a clean project and it still doesn't work, although I get a slightly different error:

screenshot_20170104-204853

from expo.

hafizio avatar hafizio commented on April 28, 2024 1

https://github.com/exponent/nativebase-example

from expo.

cyprusglobe avatar cyprusglobe commented on April 28, 2024

@acornejo did you by chance run npm install @exponent/vector-icons --save-dev or yarn add @exponent/vector-icons inside your project?

from expo.

acornejo avatar acornejo commented on April 28, 2024

Finally made these work. Several things were missing.

First, exp.json had to be modified to include "ttf" in assetExts.

That got me past the first few errors.

Next, the native-base package (the version listed in the original exponent blog post advertising working UI toolkits), depends on the roboto font for its default theme.

For that to work I needed the following wrapper on the app:

class Wrapper extends React.Component {
  state = { fontsAreLoaded: false };

  async componentWillMount() {
    await Exponent.Font.loadAsync({
      'Roboto_medium': require('native-base/Fonts/Roboto_medium.ttf')
    });
    this.setState({fontsAreLoaded: true});
  }

  render() {
    if (this.state.fontsAreLoaded)
      return <App/>;
    else
      return <Exponent.Components.AppLoading/>;
  }
}

The blog post was misleading since it implied that native-base would work without any special tweaks beyond doing npm install native-base, this was not the case. Summarizing required steps were:

  • Edit exp.json to tweak asset extensions
  • Install exponent/vector-icons
  • Load roboto font using exponent's load-async.

from expo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.