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

ES6 context not available #73

Open
ptfly opened this issue Oct 11, 2016 · 1 comment
Open

ES6 context not available #73

ptfly opened this issue Oct 11, 2016 · 1 comment

Comments

@ptfly
Copy link

ptfly commented Oct 11, 2016

First, awesome project guys!

I'm trying to use IonModal for example, and in my component, I'm setting:

static contextTypes = {
    router:React.PropTypes.object,
    ionShowModal: React.PropTypes.func,
    ionKeyboardHeight: React.PropTypes.number,
    ionPlatform: React.PropTypes.object
};

But when I ran the app (in browser or in cordova/ ios simulator) all context types are undefined except the router. Any idea how can I fix this?

Object { router: Object, ionShowModal: undefined, ionKeyboardHeight: undefined, ionPlatform: undefined }

I'm using latest official react release, thanks!

@idmontie
Copy link

I'm able to use the static contextTypes syntax, but I've noticed that some of the ion props are not defined immediately. But here is an example of using the ionPlatform context that I have used:

class Example extends Component {
  static contextTypes = {
    ionPlatform: object,
  }
  
  render() {
    return (<i className={this.context.ionPlatform.isIos ? 'ion-ios-arrow-back' : 'ion-android-arrow-back'} />);
  }
}

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

No branches or pull requests

2 participants