Skip to content

Commit 634e72a

Browse files
authored
Remove old architecture support (#634)
1 parent bab684d commit 634e72a

30 files changed

+31
-395
lines changed

.github/workflows/build-android.yml

+2-6
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,8 @@ jobs:
2626
build:
2727
if: github.repository == 'Expensify/react-native-live-markdown'
2828
runs-on: ubuntu-latest
29-
strategy:
30-
matrix:
31-
react-native-architecture: ['Paper', 'Fabric']
32-
fail-fast: false
3329
concurrency:
34-
group: build-android-${{ matrix.react-native-architecture }}-${{ github.ref }}
30+
group: build-android-${{ github.ref }}
3531
cancel-in-progress: true
3632
steps:
3733
- name: Check out Git repository
@@ -48,4 +44,4 @@ jobs:
4844

4945
- name: Build app
5046
working-directory: example/android
51-
run: ./gradlew assembleDebug --build-cache -PreactNativeArchitectures=arm64-v8a -PnewArchEnabled=${{ matrix.react-native-architecture == 'Fabric' && 'true' || 'false' }}
47+
run: ./gradlew assembleDebug --build-cache -PreactNativeArchitectures=arm64-v8a

.github/workflows/build-ios.yml

+7-13
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,8 @@ jobs:
2626
build:
2727
if: github.repository == 'Expensify/react-native-live-markdown'
2828
runs-on: macos-13
29-
strategy:
30-
matrix:
31-
react-native-architecture: ['Paper', 'Fabric']
32-
fail-fast: false
3329
concurrency:
34-
group: build-ios-${{ matrix.react-native-architecture }}-${{ github.ref }}
30+
group: build-ios-${{ github.ref }}
3531
cancel-in-progress: true
3632
steps:
3733
- name: Check out Git repository
@@ -43,8 +39,8 @@ jobs:
4339
path: |
4440
node_modules
4541
example/node_modules
46-
key: build-ios-node-modules-${{ matrix.react-native-architecture }}-${{ hashFiles('package-lock.json') }}
47-
restore-keys: build-ios-node-modules-${{ matrix.react-native-architecture }}-
42+
key: build-ios-node-modules-${{ hashFiles('package-lock.json') }}
43+
restore-keys: build-ios-node-modules-
4844

4945
- name: Install node_modules
5046
run: npm ci
@@ -56,13 +52,11 @@ jobs:
5652
example/ios/Pods
5753
~/Library/Caches/CocoaPods
5854
~/.cocoapods
59-
key: build-ios-pods-${{ matrix.react-native-architecture }}-${{ hashFiles('node_modules/react-native/package.json') }}
60-
restore-keys: build-ios-pods-${{ matrix.react-native-architecture }}-
55+
key: build-ios-pods-${{ hashFiles('node_modules/react-native/package.json') }}
56+
restore-keys: build-ios-pods-
6157

6258
- name: Install Pods
6359
working-directory: example/ios
64-
env:
65-
RCT_NEW_ARCH_ENABLED: ${{ matrix.react-native-architecture == 'Fabric' && '1' || '0' }}
6660
run: |
6761
bundler install
6862
bundler exec pod install
@@ -75,8 +69,8 @@ jobs:
7569
uses: actions/cache@v4
7670
with:
7771
path: ~/Library/Developer/Xcode/DerivedData
78-
key: build-ios-derived-data-${{ matrix.react-native-architecture }}-${{ hashFiles('node_modules/react-native/package.json') }}
79-
restore-keys: build-ios-derived-data-${{ matrix.react-native-architecture }}-
72+
key: build-ios-derived-data-${{ hashFiles('node_modules/react-native/package.json') }}
73+
restore-keys: build-ios-derived-data-
8074

8175
- name: Build app
8276
working-directory: example

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ By default, the example is configured to build with the old architecture. To run
5656
2. For iOS, run:
5757

5858
```sh
59-
cd example/ios && bundler install && RCT_NEW_ARCH_ENABLED=1 bundler exec pod install
59+
cd example/ios && bundler install && bundler exec pod install
6060
npm run example ios
6161
```
6262

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
- 🔧 Customizable logic
99
- 🎨 Customizable styles
1010
- 🌐 Universal support (Android, iOS, web)
11-
- 🏗️ Supports New Architecture
11+
- 🏗️ Supports only the New Architecture
1212

1313
## Installation
1414

@@ -179,7 +179,7 @@ Currently, `react-native-live-markdown` supports only [ExpensiMark](https://gith
179179

180180
## Compatibility
181181

182-
`react-native-live-markdown` supports two latest React Native minor releases.
182+
`react-native-live-markdown` supports two latest React Native minor releases with the New Architecture enabled.
183183

184184
| react-native | @expensify/react-native-live-markdown |
185185
| :----------: | :-----------------------------------: |

RNLiveMarkdown.podspec

+4-6
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,16 @@ Pod::Spec.new do |s|
3636

3737
install_modules_dependencies(s)
3838

39-
if ENV['USE_FRAMEWORKS'] != nil && ENV['RCT_NEW_ARCH_ENABLED'] == '1'
39+
if ENV['USE_FRAMEWORKS'] != nil
4040
add_dependency(s, "React-FabricComponents", :additional_framework_paths => [
4141
"react/renderer/textlayoutmanager/platform/ios",
4242
"react/renderer/components/textinput/platform/ios",
4343
])
4444
add_dependency(s, "React-rendererconsistency")
4545
end
4646

47-
if ENV['RCT_NEW_ARCH_ENABLED'] == '1'
48-
s.subspec "newarch" do |ss|
49-
ss.source_files = "cpp/**/*.{cpp,h}"
50-
ss.header_dir = "RNLiveMarkdown"
51-
end
47+
s.subspec "newarch" do |ss|
48+
ss.source_files = "cpp/**/*.{cpp,h}"
49+
ss.header_dir = "RNLiveMarkdown"
5250
end
5351
end

android/build.gradle

+5-26
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,8 @@ def reactNativeArchitectures() {
1818
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
1919
}
2020

21-
def isNewArchitectureEnabled() {
22-
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
23-
}
24-
2521
apply plugin: "com.android.library"
26-
27-
if (isNewArchitectureEnabled()) {
28-
apply plugin: "com.facebook.react"
29-
}
22+
apply plugin: "com.facebook.react"
3023

3124
def getExtOrDefault(name) {
3225
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["LiveMarkdown_" + name]
@@ -93,7 +86,6 @@ android {
9386
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
9487

9588
buildConfigField "int", "REACT_NATIVE_MINOR_VERSION", REACT_NATIVE_MINOR_VERSION.toString()
96-
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
9789

9890
consumerProguardFiles "proguard-rules.pro"
9991

@@ -129,15 +121,10 @@ android {
129121

130122
sourceSets {
131123
main {
132-
if (isNewArchitectureEnabled()) {
133-
java.srcDirs += [
134-
"src/newarch",
135-
// This is needed to build Kotlin project with NewArch enabled
136-
"${project.buildDir}/generated/source/codegen/java"
137-
]
138-
} else {
139-
java.srcDirs += ["src/oldarch"]
140-
}
124+
java.srcDirs += [
125+
// This is needed to build Kotlin project with NewArch enabled
126+
"${project.buildDir}/generated/source/codegen/java"
127+
]
141128

142129
// TextLayoutManager
143130
if (REACT_NATIVE_MINOR_VERSION <= 76 ) {
@@ -190,14 +177,6 @@ dependencies {
190177
implementation project(":react-native-reanimated")
191178
}
192179

193-
if (isNewArchitectureEnabled()) {
194-
react {
195-
jsRootDir = file("../src/")
196-
libraryName = "LiveMarkdown"
197-
codegenJavaPackageName = "com.expensify.livemarkdown"
198-
}
199-
}
200-
201180
// This fixes linking errors due to undefined symbols from libworklets.so.
202181
// During Gradle Sync, Android Gradle Plugin runs Prefab and treats worklets
203182
// like a header-only library. During build, config files are not regenerated

android/src/main/java/com/expensify/livemarkdown/LiveMarkdownModule.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ public LiveMarkdownModule(ReactApplicationContext reactContext) {
2222

2323
@Override
2424
public boolean install() {
25-
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
26-
FabricUIManager uiManager =
27-
(FabricUIManager) UIManagerHelper.getUIManager(getReactApplicationContext(), UIManagerType.FABRIC);
28-
mNativeProxy.createCommitHook(uiManager);
29-
}
25+
FabricUIManager uiManager =
26+
(FabricUIManager) UIManagerHelper.getUIManager(getReactApplicationContext(), UIManagerType.FABRIC);
27+
mNativeProxy.createCommitHook(uiManager);
3028

3129
long jsiRuntime = Objects.requireNonNull(getReactApplicationContext().getJavaScriptContextHolder(), "[react-native-live-markdown] JavaScriptContextHolder is null").get();
3230
injectJSIBindings(jsiRuntime);

android/src/oldarch/LiveMarkdownModuleSpec.java

-12
This file was deleted.

android/src/oldarch/MarkdownTextInputDecoratorViewManagerSpec.java

-11
This file was deleted.

android/src/oldarch/NativeLiveMarkdownModuleSpec.java

-37
This file was deleted.

android/src/oldarch/NativeProxy.java

-9
This file was deleted.

apple/LiveMarkdownModule.h

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
#ifdef RCT_NEW_ARCH_ENABLED
21
#import <RNLiveMarkdownSpec/RNLiveMarkdownSpec.h>
3-
#else
4-
#import <React/RCTBridgeModule.h>
5-
#endif // RCT_NEW_ARCH_ENABLED
62

73
#import <React/RCTEventEmitter.h>
84

95
// Without inheriting after RCTEventEmitter we don't get access to bridge
10-
@interface LiveMarkdownModule : RCTEventEmitter
11-
#ifdef RCT_NEW_ARCH_ENABLED
12-
<NativeLiveMarkdownModuleSpec>
13-
#else
14-
<RCTBridgeModule>
15-
#endif // RCT_NEW_ARCH_ENABLED
6+
@interface LiveMarkdownModule : RCTEventEmitter <NativeLiveMarkdownModuleSpec>
7+
168
@end

apple/LiveMarkdownModule.mm

-14
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
#import "LiveMarkdownModule.h"
22

33
#import <RNLiveMarkdown/RuntimeDecorator.h>
4-
5-
#ifdef RCT_NEW_ARCH_ENABLED
64
#import <RNLiveMarkdown/MarkdownCommitHook.h>
7-
#endif // RCT_NEW_ARCH_ENABLED
85

96
#import <React/RCTBridge+Private.h>
10-
11-
#ifdef RCT_NEW_ARCH_ENABLED
127
#import <React/RCTScheduler.h>
138
#import <React/RCTSurfacePresenter.h>
14-
#endif // RCT_NEW_ARCH_ENABLED
159

1610
#import <jsi/jsi.h>
1711

@@ -23,10 +17,8 @@
2317
// actually register the hook
2418

2519
@implementation LiveMarkdownModule {
26-
#ifdef RCT_NEW_ARCH_ENABLED
2720
std::shared_ptr<MarkdownCommitHook> commitHook_;
2821
__weak RCTSurfacePresenter *surfacePresenter_;
29-
#endif // RCT_NEW_ARCH_ENABLED
3022
}
3123

3224
RCT_EXPORT_MODULE()
@@ -37,16 +29,12 @@ @implementation LiveMarkdownModule {
3729
jsi::Runtime &rt = *(jsi::Runtime *)cxxBridge.runtime;
3830
expensify::livemarkdown::injectJSIBindings(rt);
3931

40-
#ifdef RCT_NEW_ARCH_ENABLED
4132
RCTScheduler *scheduler = [surfacePresenter_ scheduler];
4233
commitHook_ = std::make_shared<MarkdownCommitHook>(scheduler.uiManager);
43-
#endif // RCT_NEW_ARCH_ENABLED
4434

4535
return @(1);
4636
}
4737

48-
#ifdef RCT_NEW_ARCH_ENABLED
49-
5038
- (void)handleJavaScriptDidLoadNotification:(NSNotification *)notification
5139
{
5240
surfacePresenter_ = self.bridge.surfacePresenter;
@@ -89,6 +77,4 @@ - (void)invalidate {
8977
[super invalidate];
9078
}
9179

92-
#endif // RCT_NEW_ARCH_ENABLED
93-
9480
@end

apple/MarkdownCommitHook.h

-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#pragma once
2-
#ifdef RCT_NEW_ARCH_ENABLED
32

43
#include <react/renderer/components/iostextinput/TextInputShadowNode.h>
54
#include <react/renderer/uimanager/UIManager.h>
@@ -45,5 +44,3 @@ class MarkdownCommitHook : public UIManagerCommitHook {
4544

4645
} // namespace livemarkdown
4746
} // namespace expensify
48-
49-
#endif // RCT_NEW_ARCH_ENABLED

apple/MarkdownCommitHook.mm

-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#ifdef RCT_NEW_ARCH_ENABLED
2-
31
#include <React/RCTUtils.h>
42
#include <react/renderer/core/ComponentDescriptor.h>
53
#include <react/renderer/textlayoutmanager/RCTAttributedTextUtils.h>
@@ -303,5 +301,3 @@
303301

304302
} // namespace livemarkdown
305303
} // namespace expensify
306-
307-
#endif // RCT_NEW_ARCH_ENABLED
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// This guard prevent this file to be compiled in the old architecture.
2-
#ifdef RCT_NEW_ARCH_ENABLED
31
#import <React/RCTViewComponentView.h>
42

53
NS_ASSUME_NONNULL_BEGIN
@@ -8,5 +6,3 @@ NS_ASSUME_NONNULL_BEGIN
86
@end
97

108
NS_ASSUME_NONNULL_END
11-
12-
#endif /* RCT_NEW_ARCH_ENABLED */

apple/MarkdownTextInputDecoratorComponentView.mm

-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// This guard prevent this file to be compiled in the old architecture.
2-
#ifdef RCT_NEW_ARCH_ENABLED
31
#import <react/renderer/components/RNLiveMarkdownSpec/Props.h>
42

53
#import <RNLiveMarkdown/MarkdownTextInputDecoratorComponentView.h>
@@ -85,4 +83,3 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &
8583
}
8684

8785
@end
88-
#endif

0 commit comments

Comments
 (0)