Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Upgrade react native #5041

Merged
merged 19 commits into from
Mar 13, 2025
Merged

Conversation

jorelosorio
Copy link
Member

Closes https://github.com/AtB-AS/kundevendt/issues/19873

NOTE: Details about some findings in the issue

@jorelosorio jorelosorio self-assigned this Feb 25, 2025
@@ -221,7 +221,7 @@ export const Dashboard_TripSearchScreen: React.FC<RootProps> = ({
});
}

const searchTimeButtonRef = useRef();
const searchTimeButtonRef = useRef(null);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the documentation says about breaking changes https://react.dev/blog/2024/04/25/react-19-upgrade-guide#useref-requires-argument now a value is required, however I am confused about what to use, null or undefined? could you please @gorandalum @rosvik to help me identify what works well in that case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use undefined instead of null but for other cases looks like it need to be null instead of undefined

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the default was undefined when not set before, so sounds like a good idea to use that in most cases 👍

children: React.ReactNode;
}

export const AccessibilityContextProvider = ({children}: Props) => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rosvik @gorandalum I was upgrading the react-native that now uses react 19 and there are some changes as listed here https://react.dev/blog/2024/04/25/react-19-upgrade-guide, seems like this is the way to go now, what do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgrading to 18.3 and fixing all eslint issues sounds like a nice first step. Could do the actual React 19 upgrade in another PR, since I assume there's some risk to it.

Copy link
Member Author

@jorelosorio jorelosorio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are many compilation issues with the new version of react:

image

I need to have the help from the team to identify them and proper fix them.

@jorelosorio jorelosorio marked this pull request as ready for review March 3, 2025 14:00
Copy link
Member

@rosvik rosvik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 🎉 This seems to work fine based on my limited amount of testing locally. Would be nice to merge early in this sprint, and I don't see any reason not to 🚀

compileSdkVersion = 34
targetSdkVersion = 34
buildToolsVersion = "35.0.0"
minSdkVersion = 24
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we dropping support for phones with SDK version 23 here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, noticed now that you've already put a note about it in the issue 👌

@@ -221,7 +221,7 @@ export const Dashboard_TripSearchScreen: React.FC<RootProps> = ({
});
}

const searchTimeButtonRef = useRef();
const searchTimeButtonRef = useRef(null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the default was undefined when not set before, so sounds like a good idea to use that in most cases 👍

@@ -121,7 +121,7 @@ const TabBar: React.FC<MaterialTopTabBarProps> = ({
color={tabColor}
testID={options.tabBarTestID}
>
{label}
<>{label}</>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the background for this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is not in a <></> component, the compiler says that a child can not be string

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, that's a bit strange. ThemeText should allow strings, no? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is because the child is React.ReactNode not any as before I think.

children: React.ReactNode;
}

export const AccessibilityContextProvider = ({children}: Props) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgrading to 18.3 and fixing all eslint issues sounds like a nice first step. Could do the actual React 19 upgrade in another PR, since I assume there's some risk to it.

@jorelosorio jorelosorio merged commit 56a83c8 into master Mar 13, 2025
4 checks passed
@jorelosorio jorelosorio deleted the jorelosorio/Upgrade-React-Native branch March 13, 2025 11:00
# bound in the template on Cocoapods with next React Native release.
gem 'cocoapods', '>= 1.13', '< 1.15'
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
gem "configure_extensions"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jorelosorio The build is failing for the OMS now that configure_extensions is removed. Could you have a look? https://github.com/AtB-AS/mittatb-app/actions/runs/13834854603/job/38707329323

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants