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 to React Native 0.76 #130

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

chore: Upgrade to React Native 0.76 #130

wants to merge 8 commits into from

Conversation

thehale
Copy link
Member

@thehale thehale commented Dec 10, 2024

This has been an intensely difficult upgrade.

I attempted to use the upgrade guide, but ran into problem after
problem. The approach that ultimately proved successful was to
scaffold a brand new app, copy in my old code, and make
adjustments as needed to fix bugs.

Each commit represents a logical progression through the upgrade.
They are an idealized path someone else could follow, learning from
the many mistakes/frustrations I faced along the way.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

This has been an intensely difficult upgrade.

I attempted to use the upgrade guide, but ran into problem after
problem. The approach that ultimately proved successful was to
scaffold a brand new app, copy in my old code, and make
adjustments as needed to fix bugs.

This commit contains the core-only changes needed for the 0.76
upgrade. Subsequent commits will contain the third-party changes
required for full functionality on 0.76
Includes transitive upgrades to `react-native-reanimated` and all
the navigators used in the app. Removes a few unused packages.
The best part is that this upgrade **simplifies** my code and processes.

I no longer have to do the awkward manual linking steps in
Android and iOS. In fact, because `react-native-vector-icons` now
installs all fonts in `assets/fonts`, it also handles my custom fonts!

This commit also removes all the unused icon packs. My hope is
that will contribute to a smaller bundle size.
The mainline `react-native-fs` hasn't had a commit for almost
18 months and hasn't had a new release for over 2 years.

So, I switched to the most stable looking fork which has been
updated much more regularly and has a decent sized user base.
This commit looks deceptively simple. It was one of the hardest
parts of the upgrade.

First, `LocationStatus.ts` was part of a custom native module I
had written to support the Android versions which require
location permissions for Bluetooth scans. Since that was on the
Old Architecture, I had to learn how to write a New Architecture
native module. That ended up being easiest to do by publishing
a separate package on npm.

Additionally, the maintainers of `react-native-ble-manager` are
still working on full support for the New Architecture. Timing was
very much in my favor since they started publishing viable release
candidates mere days before I started this upgrade project, and
the full release was published only ~20 hours ago.
MongoDB, the company that acquired Realm several years ago,
recently announced that they are deprecating Realm :/

So, I'll need to start building an alternate mass storage solution.
Fortunately, it looks like there's a new kid on the sqlite block,
`react-native-nitro-sqlite`, so I may be able to switch to the
database I had wanted to use in the first place.

BUT... that migration doesn't need to happen today. Realm still
works for now, so we'll keep it and upgrade it until we are able
to move to a more stable datastore.
Getting everything else up to date as much as possible.

Some additional notes
===============
`react-native-charts-wrapper` - Will need to replace this soon
too. It hasn't moved to the new architecture yet and probably
won't any time soon (no recent commits/updates). The best
alternative I'm seeing right now is `react-native-echarts` with the
`react-native-skia` renderer.

`react-native-paper` - The lead maintainer of this component
library has moved to other priorites at Callstack. Updates here,
while not stalled, have dramatically slowed down. Replacing the
entire component library will be a big lift, so I'm not eager to do
this yet, but I may have to somewhat soon.

When it comes time to really push on both of these big library
migrations, I want to put a big priority on choosing tools that
support compatibility with `react-native-windows`,
`react-native-macos`, and ideally `react-native-web`. Some of the
choices I made during this 0.76 upgrade move the app closer to
supporting a Desktop build, and I want to continue that arc.
It wasn't worth the effort to try and track how these lock files
would have changed through the "idealized" upgrade process.
So, instead, I'm just committing their final result here at the end.
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.

2 participants