Join GitHub today
Deprecate and eventually remove propTypes from core #29
Enforcing React prop type safety via propTypes is dubious at best. We've been using Flow for a much stricter enforcement of these props for quite a while. Unfortunately, much of our codebase existed before we typed our React Components and thus a bunch of stuff is still using PropTypes or some mix thereof. For a long time we've had files that export propTypes as well as Flow types and we tried to keep them in sync. However, we want to discourage the usage of propTypes in favor of static typing and only have one source of truth for the APIs of these components. That source of truth is Flow.
We have a couple of projects that want to use these Flow types as the source of truth. For example, using them to codegen native code for each component and ensuring the native components supports props of the same type.
Deprecate and remove propTypes from core RN!
Right now there are a couple of different ways propTypes are being used.
For open source, since the propType APIs from our main export have been public for a long time, we probably need to actually move these out into a deprecated repo instead of just deleting them. Before we can move them out, we need to fully decouple the propTypes from the rest of the repo.
It is a lot of work to do this, but none of it is very challenging. I'm hoping we can label these individual pieces of work as "Good First Task" and enlist the help of the community. This is the order of changes I think need to be made:
Remove callsites from components:
For a list of files, see the issue here: facebook/react-native#21342
Move and Rename custom
changed the title from
Deprecate and eventually remove propTypes from Core
Deprecate and eventually remove propTypes from core
Sep 22, 2018
referenced this issue
Sep 23, 2018
Looking at all the classes with mixins, it looks like
I definitely think that it's worth it to try and convert the last of the
I completed all of the standard components but didn't convert the ones that only had