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

Upgrade to react-native 0.66 #15914

Merged
merged 12 commits into from Jan 20, 2022
Merged

Upgrade to react-native 0.66 #15914

merged 12 commits into from Jan 20, 2022

Conversation

Kudo
Copy link
Contributor

@Kudo Kudo commented Jan 14, 2022

Why

follow up #15817 (comment)
after we use the react-native from npm, the react-native version we used in expo-go is decoupled with other stuffs. that makes us upgrade react-native easier.

How

  1. update versions in package.json
  2. sync changes from react-native-upgrade-helper
  3. okio and okhttp were be upgraded in react-native 0.66. this is the same to [packages] Fix okio/okhttp compatibility issue #15915 landed.
  4. RCTComponentData changed its designated initializer in react-native 0.65. to make it compatible with older version, i introduced the EXComponentDataCompatibleWrapper class to support different versions.
  5. [react-native-lab] to fix expo-go build error, we should patch react-native to use the codegen library from its repo but not from node_modules: Fix codegen resolution error when node_modules has different version react-native#29.

Test Plan

  • CI passed
  • bare-expo build & launch test
  • unversioned expo-go build & launch test

Checklist

  • Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md).
  • This diff will work correctly for expo build (eg: updated @expo/xdl).
  • This diff will work correctly for expo prebuild & EAS Build (eg: updated a module plugin).

Copy link
Contributor

@bbarthec bbarthec left a comment

Choose a reason for hiding this comment

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

Superb work!
Nice job taking core of each edge case detected 🚀
I've briefly looked at the upgrade from rn@0.66.4 to rn@0.67.0-rc.6 and observed that there's a change in android/build.gradle regarding fetching react-native from Maven Central. Should we care about it? Maybe that might cause some additional issues? 🤔

Comment on lines +1 to +28
// Copyright 2018-present 650 Industries. All rights reserved.

#import <ExpoModulesCore/EXComponentDataCompatibleWrapper.h>

@interface RCTComponentData (EXComponentDataCompatibleWrapper)

// available in RN 0.65+
- (instancetype)initWithManagerClass:(Class)managerClass
bridge:(RCTBridge *)bridge
eventDispatcher:(id<RCTEventDispatcherProtocol>) eventDispatcher;

- (instancetype)initWithManagerClass:(Class)managerClass bridge:(RCTBridge *)bridge;

@end

@implementation EXComponentDataCompatibleWrapper

- (instancetype)initWithManagerClass:(Class)managerClass
bridge:(RCTBridge *)bridge
eventDispatcher:(id<RCTEventDispatcherProtocol>)eventDispatcher
{
if ([self respondsToSelector:@selector(initWithManagerClass:bridge:)]) {
return [super initWithManagerClass:managerClass bridge:bridge];
}
return [super initWithManagerClass:managerClass bridge:bridge eventDispatcher:eventDispatcher];
}

@end
Copy link
Contributor

Choose a reason for hiding this comment

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

Very clean solution 👏

@Kudo
Copy link
Contributor Author

Kudo commented Jan 20, 2022

Superb work! Nice job taking core of each edge case detected 🚀 I've briefly looked at the upgrade from rn@0.66.4 to rn@0.67.0-rc.6 and observed that there's a change in android/build.gradle regarding fetching react-native from Maven Central. Should we care about it? Maybe that might cause some additional issues? 🤔

that is a nice to have notation that prevent users accidentally to fetch the old react-native from maven central when they do not fetch from node_modules. since we have implementation "com.facebook.react:react-native:+", in this case, the old version on maven central is also a match.
anyway, i'll try further to upgrade 0.67 and include the gradle change.

Kudo added a commit to expo/react-native that referenced this pull request Jan 20, 2022
…29)

# Why

fix android client build error for expo/expo#15914 when different react-native version between `node_modules/react-native` and `react-native-lab/react-native`.

# How

use the `react-native-codegen` from the same repository.
@expo-bot
Copy link
Collaborator

Hi there! 👋 I'm a bot whose goal is to ensure your contributions meet our guidelines.

I've found some issues in your pull request that should be addressed (click on them for more details) 👇

⚠️ Suggestion: Missing changelog entries


Your changes should be noted in the changelog. Read Updating Changelogs guide and consider (it's optional) adding an appropriate entry to the following changelogs:


Generated by ExpoBot 🤖 against da07926

@Kudo Kudo merged commit 402679c into master Jan 20, 2022
@Kudo Kudo deleted the @kudo/rn66 branch January 20, 2022 06:55
@mangkoran
Copy link

mangkoran commented Jan 20, 2022

Is there any way to try out expo with this PR?

I want to try this out in my project.

@Kudo
Copy link
Contributor Author

Kudo commented Jan 21, 2022

@mangkoran you can try to have a react-native 0.66 project and install expo modules

$ npx react-native init RN066 --version 0.66
$ cd RN066
$ npx install-expo-modules

@mangkoran
Copy link

@Kudo I encountered some issue when trying to run npx install-expo-modules. I filed new issue expo/expo-cli#4163.

lukmccall added a commit to software-mansion-labs/expo-maps that referenced this pull request Jan 27, 2022
Bump `expo-modules-core` to `0.7.0`:

# Changelog:

## 0.7.0 — 2022-01-26

### 🎉 New features

- Allow accessing `RCTBridge` from the modules on iOS. ([#15816](expo/expo#15816) by [@tsapeta](https://github.com/tsapeta))
- Added support for native callbacks through the view props in Sweet API on iOS. ([#15731](expo/expo#15731) by [@tsapeta](https://github.com/tsapeta))
- Added support for native callbacks through the view props in Sweet API on Android. ([#15743](expo/expo#15743) by [@lukmccall](https://github.com/lukmccall))
- The `ModuleDefinition` will use class name if the `name` component wasn't provided in Sweet API on Android. ([#15738](expo/expo#15738) by [@lukmccall](https://github.com/lukmccall))
- Added `onViewDestroys` component to the `ViewManager` in Sweet API on Android. ([#15740](expo/expo#15740) by [@lukmccall](https://github.com/lukmccall))
- Added shortened `constants` component that takes `vargs Pair<String, Any?>` as an argument in Sweet API on Android. ([#15742](expo/expo#15742) by [@lukmccall](https://github.com/lukmccall))
- Introduced the concept of chainable exceptions in Sweet API on iOS. ([#15813](expo/expo#15813) by [@tsapeta](https://github.com/tsapeta))
- Sweet function closures can throw errors on iOS. ([#15849](expo/expo#15849) by [@tsapeta](https://github.com/tsapeta))
- Add `requireNativeModule` function to replace accessing native modules from `NativeModulesProxy`. ([#15848](expo/expo#15848) by [@tsapeta](https://github.com/tsapeta))
- Implemented basic functionality of JSI host object to replace `NativeModulesProxy` on iOS. ([#15847](expo/expo#15847) by [@tsapeta](https://github.com/tsapeta))

### 🐛 Bug fixes

- It's no longer possible to directly call methods from the `ModuleDefinition` in the `ViewManagers` on Android. ([#15741](expo/expo#15741) by [@lukmccall](https://github.com/lukmccall))
- Fix compatibility with react-native 0.66. ([#15914](expo/expo#15914) by [@Kudo](https://github.com/kudo))

## 0.6.4 — 2022-01-05

### 🐛 Bug fixes

- Fix `ReactInstanceManager.onHostPause` exception from moving Android apps to background. ([#15748](expo/expo#15748) by [@Kudo](https://github.com/kudo))

## 0.6.3 — 2021-12-16

### 🐛 Bug fixes

- Fixed the deep link wasn't passed to the application if the application wasn't running when the deep link was sent. ([#15593](expo/expo#15593) by [@lukmccall](https://github.com/lukmccall))

## 0.6.2 — 2021-12-15

### 🎉 New features

- Add `onNewIntent` and `onBackPressed` support to `ReactActivityLifecycleListener`. ([#15550](expo/expo#15550) by [@Kudo](https://github.com/Kudo))
prakashbask pushed a commit to prakashbask/expo that referenced this pull request Mar 16, 2022
# Why

follow up expo#15817 (comment)
after we use the react-native from npm, the react-native version we used in expo-go is decoupled with other stuffs. that makes us upgrade react-native easier.

# How

1. update versions in package.json
2. sync changes from [react-native-upgrade-helper](https://react-native-community.github.io/upgrade-helper/?from=0.64.2&to=0.66.4)
3. `RCTComponentData` changed its designated initializer in react-native 0.65. to make it compatible with older version, i introduced the `EXComponentDataCompatibleWrapper` class to support different versions.
4. [react-native-lab] to fix expo-go build error, we should patch react-native to use the codegen library from its repo but not from node_modules:  expo/react-native#29.

# Test Plan

- CI passed
- bare-expo build & launch test
- unversioned expo-go build & launch test
Kudo added a commit that referenced this pull request Apr 28, 2022
…#17266)

# Why

`__apply_Xcode_12_5_M1_post_install_workaround` was missing when i did #15914. that may introduced some build issue on m1 machine when flipper is enabled.

# How

- add missing `__apply_Xcode_12_5_M1_post_install_workaround` as from [react-native 0.68 template](https://github.com/facebook/react-native/blob/b5f1b26a8ff4014e45bbb95c5956ba2c2cf286db/template/ios/Podfile#L35)
- also update `use_flipper!()` statement as from [react-native 0.68 template](https://github.com/facebook/react-native/blob/b5f1b26a8ff4014e45bbb95c5956ba2c2cf286db/template/ios/Podfile#L31). i think the old flipper issue should be already resolved.

# Test Plan

tested on m1 macos

```sh
$ EXPO_BETA=1 expo init sdk45 # select bare
# update ios/Podfile with the change and uncomment use_flipper!()
$ expo run:ios
# test with flipper
```
brentvatne pushed a commit that referenced this pull request Apr 28, 2022
…#17266)

# Why

`__apply_Xcode_12_5_M1_post_install_workaround` was missing when i did #15914. that may introduced some build issue on m1 machine when flipper is enabled.

# How

- add missing `__apply_Xcode_12_5_M1_post_install_workaround` as from [react-native 0.68 template](https://github.com/facebook/react-native/blob/b5f1b26a8ff4014e45bbb95c5956ba2c2cf286db/template/ios/Podfile#L35)
- also update `use_flipper!()` statement as from [react-native 0.68 template](https://github.com/facebook/react-native/blob/b5f1b26a8ff4014e45bbb95c5956ba2c2cf286db/template/ios/Podfile#L31). i think the old flipper issue should be already resolved.

# Test Plan

tested on m1 macos

```sh
$ EXPO_BETA=1 expo init sdk45 # select bare
# update ios/Podfile with the change and uncomment use_flipper!()
$ expo run:ios
# test with flipper
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: suggestions ExpoBot has some suggestions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants