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

2932: Update to React-Native 75 #3158

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

2932: Update to React-Native 75 #3158

wants to merge 10 commits into from

Conversation

LeandraH
Copy link
Contributor

@LeandraH LeandraH commented Mar 18, 2025

Short Description

This PR upgrades React-Native to 0.75, and React to 18.3.1

Proposed Changes

  • Upgraded RN to 0.75
  • Upgraded React to 18.3.1
  • Downgraded styled components from version 6 to version 5 😢 The theme type unfortunately wasn't applied in the functions in styled components (something like background-color: ${props => props.theme.colors.backgroundColor}) Upgraded styled-components from 6.1.13 to 6.1.16 🥳
  • Fixed some typing problems
  • Deleted the endlessly growing list of duplicate HEADER_SEARCH_PATHS in the project file

Side Effects

Everything possible

Testing

Anything could break from the upgrade
Please also check if the error in #3116 disappears for you by going to a different branch and running yarn install there, it did for me.

Resolved Issues

Fixes: #2932
Possibly fixes: #3116


@@ -617,46 +617,6 @@
" ${PODS_CONFIGURATION_BUILD_DIR}/React-NativeModulesApple/React_NativeModulesApple.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios",
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure why Xcode regularly adds more repeats of these lines but it works without them (at least on my machine :D)

@@ -20,7 +20,7 @@ const DatePickerWrapper = styled.View`

const StyledView = styled.View`
gap: 8px;
justify-content: ${props => (props.theme.contentDirection === 'rtl' ? 'flex-start' : 'flex-end')};
justify-content: flex-end;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not only do we not have the contentDirection prop in the native part, RN is also smart enough to already flip large parts of the displays in rtl languages.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep .. no need for contentDirection here.

@steffenkleinle
Copy link
Member

steffenkleinle commented Mar 19, 2025

Could you please add some information on why the downgrade of styled-components was necessary?

@LeandraH
Copy link
Contributor Author

LeandraH commented Mar 20, 2025

Could you please add some information on why the downgrade of styled-components was necessary?

It was your advice from this Mattermost thread 😁

Basically, the combination of RN 75 and Styled-components 6 led to the type error in the native project that functions inside a styled component didn't have access to the theme type, e.g. background-color: ${props => props.theme.colors.backgroundColor} leading to the error Parameter 'props' implicitly has an 'any' type. I'll add that to the description as well, thanks!

@bahaaTuffaha
Copy link
Contributor

Basically, the combination of RN 75 and Styled-components 6 led to the type error in the native project that functions inside a styled component didn't have access to the theme type, e.g. background-color: ${props => props.theme.colors.backgroundColor} leading to the error Parameter 'props' implicitly has an 'any' type. I'll add that to the description as well, thanks!

I think there is a way to use theme in V6:

But it needs a lot of changes 😐️.

Copy link
Contributor

@bahaaTuffaha bahaaTuffaha left a comment

Choose a reason for hiding this comment

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

Works great on android api 35 ...tested most features.
but on older api (29) it doesn't show content :
Screenshot_1742475772

I compared with main branch the content is working fine.

@LeandraH
Copy link
Contributor Author

Basically, the combination of RN 75 and Styled-components 6 led to the type error in the native project that functions inside a styled component didn't have access to the theme type, e.g. background-color: ${props => props.theme.colors.backgroundColor} leading to the error Parameter 'props' implicitly has an 'any' type. I'll add that to the description as well, thanks!

I think there is a way to use theme in V6:

* [Unable to style react-select component with styled-components v6 styled-components/styled-components#4074 (comment)](https://github.com/styled-components/styled-components/issues/4074#issuecomment-1870027194)

This thread is about a specific case, using react-select with styled components, which is unfortunately not what the problem here is :(

* Another way to do it is passing `$theme` as prop.

But it needs a lot of changes 😐️.

Yeah, that would be about 250 changes, for something that should be there already, especially considering that the code works in web, just not in native.

Buuuuuut, it turns out that the latest styled-components version that was released three days ago fixes this problem 🥳

@LeandraH
Copy link
Contributor Author

LeandraH commented Mar 20, 2025

Works great on android api 35 ...tested most features. but on older api (29) it doesn't show content :

I compared with main branch the content is working fine.

I obviously can't reproduce it 😭 I set up a fancy new emulator with Android 29, and I get all the content. I even tried switching the phone's language to Arabic, in case the rtl changes broke something. Do you have any more hints on how to reproduce the missing content? Do you get any errors in the terminal?

@bahaaTuffaha
Copy link
Contributor

Works great on android api 35 ...tested most features. but on older api (29) it doesn't show content :
I compared with main branch the content is working fine.

I obviously can't reproduce it 😭 I set up a fancy new emulator with Android 29, and I get all the content. I even tried switching the phone's language to Arabic, in case the rtl changes broke something. Do you have any more hints on how to reproduce the missing content? Do you get any errors in the terminal?

I even changed the screen size to pixel7 pro this time and still no content:
Not sure if its related:

Screenshot_1742492905

Screenshot_1742492844

image
Does 86x matters cuz I searched for a 64x version but there is non.

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