Skip to content

Conversation

nutstick
Copy link
Contributor

@nutstick nutstick commented Oct 20, 2022

This pull request resolves #91

Description

Support for Fabric in iOS and Android.

JS changes

  • Add codegenConfig in package.json
  • Move requireNativeComponent to separate file and migrate to codegenNativeComponent
  • Split the type into 3 files RNCProgressViewNativeComponentAndroid (for Android), RNCProgressViewNativeComponent (for iOS, macOS), RNCProgressViewNativeComponentWindows (for Windows) since the types is slightly difference.

Cpp changes

  • Add new common/cpp
  • Only use by iOS

Why?

iOS supports setting an image as a background of progress. It's a bit tricky to add, but I follow the solution from reactwg/react-native-new-architecture#31 (comment) which requires implementing image loading in c++ layer. Another solution is reactwg/react-native-new-architecture#31 (reply in thread) which looks cleaner and won't impact Android but it have to import RCTBridge+Private.h so I choose to implement c++ instead, can let me know which one you prefer.

iOS changes

  • Update podspec
  • iOS Implementation for fabric support
  • Support auto link

Android Changes

  • Update gradle files
  • Android Implementation for fabric support
  • Maintain backward compatibility using RNCProgressViewManagerImpl
  • Support auto link

Breaking change:
It should support both old architecture and new architecture. But requires bumping minimum RN version and minimum iOS version

  • Fabric -> RN version >= 0.70
  • Old architecture -> RN version >= 0.65 and minimal iOS version to 11.0

Affected platforms

  • Android
  • iOS
  • Windows
  • MacOS

Test plan/screenshots/videos

I created fabric-example/ for testing out fabric using RN 0.70 (+ react-native-test-app).

Paper

iOS Android
Simulator Screen Shot - iPhone 13 - 2022-10-21 at 00 34 43 Screenshot_1666364415

Fabric

iOS Android
Simulator Screen Shot - iPhone 13 - 2022-10-22 at 22 15 26 Screenshot_1666454734

"dependencies": {
"react": "18.1.0",
"react-native": "0.70.1",
"@react-native-community/progress-view": "link:../"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using link: protocol, will need to update metro.config.js to watch the whole repo and blacklist react-native but it will make yarn install faster.

@nutstick nutstick marked this pull request as ready for review October 22, 2022 16:28
@nutstick nutstick requested a review from Naturalclar as a code owner October 22, 2022 16:28
Copy link
Member

@Naturalclar Naturalclar left a comment

Choose a reason for hiding this comment

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

Awesome! LGTM

@Naturalclar Naturalclar merged commit f9ce7d2 into react-native-progress-view:master Oct 31, 2022
@zabojad
Copy link

zabojad commented Aug 22, 2023

@nutstick Is there anything specific to do in order to compile successfully?

I can't get XCode to compile progress-view with new arch enabled, it seems it doesn't find the codegen files.

Screenshot 2023-08-22 at 16 24 28

(issue #131)

@nutstick
Copy link
Contributor Author

Hi @zabojad there might be some change to support react-native 0.72 (I suspected it change the generated files slightly difference). It might requires an update for this library to support newer version.

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

Successfully merging this pull request may close these issues.

Support new React Native new architecture (TurboModules/Fabric)
3 participants