Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt the demo app to run in Expo (instead of requiring native Android/iOS setup) #24

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

zhibek
Copy link

@zhibek zhibek commented Jan 16, 2018

No description provided.

@zhibek
Copy link
Author

zhibek commented Jan 16, 2018

Following the changes in this PR, the application loads successfully in Expo and most features are working correctly.

Areas currently not functioning correctly are:

  • Icons
  • Fonts

@zhibek
Copy link
Author

zhibek commented Jan 16, 2018

@xotahal Thanks for sharing your work on react-native-material-ui! I'm not sure if you're interested in adopting this PR to allow the demo app to use Expo. For me, it gave me a faster way to try the demo out and is an easy reference for the components that are available in react-native-material-ui.

@cepm-nate
Copy link

cepm-nate commented Jan 30, 2018

Regarding the Fonts: I've been able to load them into an expo project with Material Design by doing something like this for my main render() call:

  render() {
    return !this.state.resourcesLoaded 
    ? <AppLoading
        startAsync={this._cacheResourcesAsync}
        onFinish={() => this.setState({ resourcesLoaded: true })}
        onError={console.warn}
      /> 
    : <MainAppContainer />;
  }

And the cache loader is simply

_cacheResourcesAsync() {
  return Font.loadAsync({
    'Roboto': require('./res/fonts/Roboto-Regular.ttf'),
  });
}

(And yes, make sure you initialize the resourcesLoaded sate to false.)

This method could be extended to use multiple promises in the _cacheResourceAsync() to grab multiple fonts or other resources. Just an idea.

@DaniGuardiola
Copy link

Thank you so much! This works!! And it made my life so much easier! Seems pretty broken though, with a lot of the images not showing up and animations not working.

@paulolc
Copy link

paulolc commented Jul 30, 2019

The README should be updated with instructions on how to run in through Expo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants