Skip to content

Commit d20dee8

Browse files
committed
Merge branch 'main' into @jpiasecki/display-contents
2 parents 044e208 + 17461c5 commit d20dee8

30 files changed

+104
-415
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

+5-7
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,17 @@ 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-
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/cpp\"" }
52-
end
47+
s.subspec "newarch" do |ss|
48+
ss.source_files = "cpp/**/*.{cpp,h}"
49+
ss.header_dir = "RNLiveMarkdown"
50+
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/cpp\"" }
5351
end
5452
end

android/build.gradle

+5-25
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]
@@ -128,15 +121,10 @@ android {
128121

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

141129
// TextLayoutManager
142130
if (REACT_NATIVE_MINOR_VERSION <= 76 ) {
@@ -189,14 +177,6 @@ dependencies {
189177
implementation project(":react-native-reanimated")
190178
}
191179

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

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/reactNativeVersionPatch/CustomMountingManager/latest/com/expensify/livemarkdown/CustomMountingManager.java

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import static com.facebook.react.views.text.TextAttributeProps.UNSET;
44

55
import android.content.Context;
6-
import android.content.res.AssetManager;
76
import android.text.BoringLayout;
87
import android.text.Layout;
98
import android.text.Spannable;

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

+1-42
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@
33
#import <RNLiveMarkdown/RuntimeDecorator.h>
44

55
#import <React/RCTBridge+Private.h>
6-
7-
#ifdef RCT_NEW_ARCH_ENABLED
86
#import <React/RCTScheduler.h>
97
#import <React/RCTSurfacePresenter.h>
10-
#endif // RCT_NEW_ARCH_ENABLED
118

129
#import <jsi/jsi.h>
1310

@@ -18,11 +15,7 @@
1815
// I think this is the easiest way to access the UIManager, which we need to
1916
// actually register the hook
2017

21-
@implementation LiveMarkdownModule {
22-
#ifdef RCT_NEW_ARCH_ENABLED
23-
__weak RCTSurfacePresenter *surfacePresenter_;
24-
#endif // RCT_NEW_ARCH_ENABLED
25-
}
18+
@implementation LiveMarkdownModule
2619

2720
RCT_EXPORT_MODULE()
2821

@@ -35,38 +28,6 @@ @implementation LiveMarkdownModule {
3528
return @(1);
3629
}
3730

38-
#ifdef RCT_NEW_ARCH_ENABLED
39-
40-
- (void)handleJavaScriptDidLoadNotification:(NSNotification *)notification
41-
{
42-
surfacePresenter_ = self.bridge.surfacePresenter;
43-
}
44-
45-
- (void)setBridge:(RCTBridge *)bridge
46-
{
47-
[super setBridge:bridge];
48-
49-
[[NSNotificationCenter defaultCenter] addObserver:self
50-
selector:@selector(handleJavaScriptDidLoadNotification:)
51-
name:RCTJavaScriptDidLoadNotification
52-
object:nil];
53-
54-
// only within the first loading `self.bridge.surfacePresenter` exists
55-
// during the reload `self.bridge.surfacePresenter` is null
56-
if (self.bridge.surfacePresenter) {
57-
surfacePresenter_ = self.bridge.surfacePresenter;
58-
}
59-
}
60-
61-
/*
62-
* Taken from RCTNativeAnimatedTurboModule:
63-
* This selector is invoked via BridgelessTurboModuleSetup.
64-
*/
65-
- (void)setSurfacePresenter:(id<RCTSurfacePresenterStub>)surfacePresenter
66-
{
67-
surfacePresenter_ = surfacePresenter;
68-
}
69-
7031
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
7132
(const facebook::react::ObjCTurboModule::InitParams &)params {
7233
return std::make_shared<facebook::react::NativeLiveMarkdownModuleSpecJSI>(
@@ -78,6 +39,4 @@ - (void)invalidate {
7839
[super invalidate];
7940
}
8041

81-
#endif // RCT_NEW_ARCH_ENABLED
82-
8342
@end
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

-7
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>
@@ -26,11 +24,7 @@ @implementation MarkdownTextInputDecoratorComponentView {
2624
RCTMarkdownUtils *_markdownUtils;
2725
RCTMarkdownStyle *_markdownStyle;
2826
NSNumber *_parserId;
29-
#ifdef RCT_NEW_ARCH_ENABLED
3027
__weak RCTTextInputComponentView *_textInput;
31-
#else
32-
__weak RCTBaseTextInputView *_textInput;
33-
#endif /* RCT_NEW_ARCH_ENABLED */
3428
__weak UIView<RCTBackedTextInputViewProtocol> *_backedTextInputView;
3529
__weak RCTBackedTextFieldDelegateAdapter *_adapter;
3630
__weak RCTUITextView *_textView;
@@ -143,4 +137,3 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &
143137
}
144138

145139
@end
146-
#endif

0 commit comments

Comments
 (0)