reactionic
reactionic copied to clipboard
ES6 context not available
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!
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'} />);
}
}