Skip to content
This repository was archived by the owner on Jun 11, 2026. It is now read-only.
This repository was archived by the owner on Jun 11, 2026. It is now read-only.

React Legacy ContextTypes API Deprecation / Migration #1128

Open

Description

Filing a new ticket to track that we need to migrate ReactXP off of the legacy Context APIs and onto a more modern one!

Mike Hardy (@mikehardy) shared the following:

(virtualenv) mike@kunashir:~/work/react-random/reactxp (unsafe-react-names) % grep -ri contexttypes *|grep -v dist | grep -v node_modules
src/web/Link.tsx:    static contextTypes = {
src/web/GestureView.tsx:    static contextTypes: React.ValidationMap<any> = {
src/web/TextInput.tsx:    static contextTypes: React.ValidationMap<any> = {
src/web/RootView.tsx:    static childContextTypes: React.ValidationMap<any> = {
src/web/RootView.tsx:    static childContextTypes: React.ValidationMap<any> = {
src/web/View.tsx:    static contextTypes: React.ValidationMap<any> = {
src/web/View.tsx:    static childContextTypes: React.ValidationMap<any> = {
src/web/Button.tsx:    static contextTypes = {
src/web/Button.tsx:    static childContextTypes = {
src/web/Image.tsx:    static contextTypes: React.ValidationMap<any> = {
src/web/Image.tsx:    static childContextTypes: React.ValidationMap<any> = {
src/web/Text.tsx:    static contextTypes = {
src/web/Text.tsx:    static childContextTypes: React.ValidationMap<any> = {
src/native-desktop/RootView.tsx:        static childContextTypes: React.ValidationMap<any> = {
src/native-common/Link.tsx:    static contextTypes = {
src/native-common/TextInput.tsx:    static contextTypes: React.ValidationMap<any> = {
src/native-common/View.tsx:    static contextTypes: React.ValidationMap<any> = {
src/native-common/View.tsx:    static childContextTypes: React.ValidationMap<any> = {
src/native-common/Button.tsx:    static contextTypes = {
src/native-common/Button.tsx:    static childContextTypes: React.ValidationMap<any> = {
src/native-common/Image.tsx:    static childContextTypes: React.ValidationMap<any> = {
src/native-common/Text.tsx:    static contextTypes: React.ValidationMap<any> = {
src/native-common/Text.tsx:    static childContextTypes: React.ValidationMap<any> = {
src/common/PopupContainerViewBase.tsx:    static contextTypes: React.ValidationMap<any> = {
src/common/PopupContainerViewBase.tsx:    static childContextTypes: React.ValidationMap<any> = {
src/common/utils/FocusManager.ts:    const contextTypes = Component.contextTypes || {};
src/common/utils/FocusManager.ts:    contextTypes.focusManager = PropTypes.object;
src/common/utils/FocusManager.ts:    Component.contextTypes = contextTypes;
src/windows/View.tsx:    static contextTypes: React.ValidationMap<any> = {
src/windows/View.tsx:        ...ViewCommon.contextTypes
src/windows/View.tsx:    static childContextTypes: React.ValidationMap<any> = {
src/windows/View.tsx:        ...ViewCommon.childContextTypes
src/windows/Button.tsx:    static childContextTypes: React.ValidationMap<any> = {
src/windows/Button.tsx:        ...ButtonBase.childContextTypes
src/windows/Text.tsx:    static contextTypes: React.ValidationMap<any> = {
src/windows/Text.tsx:        ...TextBase.contextTypes
src/windows/Text.tsx:    static childContextTypes: React.ValidationMap<any> = {
src/windows/Text.tsx:        ...TextBase.childContextTypes
(virtualenv) mike@kunashir:~/work/react-random/reactxp (unsafe-react-names) % grep -ri getchildcontext *|grep -v dist | grep -v node_modules
src/web/RootView.tsx:    getChildContext(): MainViewContext {
src/web/RootView.tsx:    getChildContext() {
src/web/View.tsx:    getChildContext() {
src/web/Button.tsx:    getChildContext(): ButtonContext {
src/web/Image.tsx:    getChildContext() {
src/web/Text.tsx:    getChildContext() {
src/native-desktop/RootView.tsx:        getChildContext() {
src/native-common/View.tsx:    getChildContext() {
src/native-common/Button.tsx:    getChildContext(): ButtonContext {
src/native-common/Image.tsx:    getChildContext() {
src/native-common/Text.tsx:    getChildContext() {
src/common/PopupContainerViewBase.tsx:    getChildContext() {
src/windows/View.tsx:    getChildContext() {
src/windows/View.tsx:        const childContext: ViewContext = super.getChildContext();
src/windows/Button.tsx:    getChildContext(): ButtonContext {
src/windows/Button.tsx:        const childContext: ButtonContext = super.getChildContext();
src/windows/Text.tsx:    getChildContext(): TextContext {
src/windows/Text.tsx:        const childContext: TextContext = super.getChildContext();

Related Ticket: #1039
Related Twitter Thread: @dan_abramov -- Performance Implications!
Documentation: https://reactjs.org/docs/context.html

This is a breaking change that depends on React >= 16.3.

Activity

  1. fbartho commented on Jul 22, 2020

    @fbartho
    ContributorAuthor

    Eric Traut (@erictraut) -- this is still an active concern. -- Do we have a roadmap to when we might be able to declare that reactxp is only compatible with React >=16.3? -- I'm happy to provide the PR if now is a good time.

  2. erictraut commented on Jul 22, 2020

    @erictraut
    Contributor

    In the past, we've said that we will generally support older versions of RN and React for one year after they have been replaced by newer versions. Can you remind me when React 16.3 was released? If it's more than a year ago, then I think we can go ahead and deprecate support in reactxp for older versions.

  3. fbartho commented on Jul 22, 2020

    @fbartho
    ContributorAuthor
  4. erictraut commented on Jul 22, 2020

    @erictraut
    Contributor

    Great, then we can move forward with this deprecation now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions