The defaultProps static field is no longer working for me now that I’m migrating to CRNA. Please help me understand why this shows “test = undefined” instead of “test = true”. Thanks!
import React, { Component } from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { Constants } from 'expo';
import { bool } from 'prop-types' // 15.6.0
class Test extends Component {
static propTypes = {
test: bool
}
static defaultProps = {
test: true
}
render() {
const { test } = this.props;
return <Text>{'test = ' + test}</Text>;
}
}
export default class App extends Component {
render() {
return (
<View style={styles.container}>
<Test />
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
paddingTop: Constants.statusBarHeight,
backgroundColor: '#ecf0f1',
},
});