PropTypes Module is not giving warnings like it should

I imported Proptypes at the top of my component and tried to set some required proptypes for my component, but I am not receiving any yellowbox warnings like I am supposed to.

I don’t received warnings when I do not export a named export for my prop, neither do I receive warnings when I send the wrong type of prop.

The code in my App.js file is below.

import React, {Component} from 'react';
import { StyleSheet, Text, View } from 'react-native';

import Count, {num} from './Count';

export default class App extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Count count={num} />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

The code for my component, Count.js, is below,

import React from 'react';
import { Text, StyleSheet } from 'react-native';
import PropTypes from 'prop-types';

const styles = StyleSheet.create({
    text: {fontSize: 72}
})

// export const num = 55
export const num = "Not a number!"


class Count extends React.Component {
    static protoTypes = {
        count: PropTypes.number.isRequired
    }

    render() {
        return (
            <Text style={styles.text}>{this.props.count}</Text>
        )
    }
}

export default Count

I have tried this both on Snack and also my phone using a project built with Expo CLI on my local machine. I have included th link to the Snack below.

Snack

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.