Skip to content

Commit 8ec0820

Browse files
authored
[macOS] Bump example app (#3993)
## Description For now it doesn't work with hook-based API 😞 ## Test plan <details> <summary>Tested on the following code:</summary> ```tsx import { useState } from 'react'; import { Pressable, StyleSheet, View } from 'react-native'; import { Gesture, GestureDetector, GestureHandlerRootView, RectButton, useTapGesture, } from 'react-native-gesture-handler'; const randomColor = () => { const r = Math.floor(Math.random() * 256); const g = Math.floor(Math.random() * 256); const b = Math.floor(Math.random() * 256); return `rgb(${r},${g},${b})`; }; export default function App() { const [bgColor, setBgColor] = useState('black'); const tap = useTapGesture({ onDeactivate: () => { setBgColor(randomColor()); }, disableReanimated: true, }); const oldTap = Gesture.Tap() .onEnd(() => { setBgColor(randomColor()); }) .runOnJS(true); return ( <GestureHandlerRootView style={styles.container}> <View style={{ width: 100, height: 100, borderRadius: 50, backgroundColor: bgColor, }} /> <View style={[ styles.container, { width: '100%', flexDirection: 'row', }, ]}> <GestureDetector gesture={tap}> <View style={styles.button} /> </GestureDetector> <GestureDetector gesture={oldTap}> <View style={styles.button} /> </GestureDetector> <Pressable style={styles.button} onPress={() => { setBgColor(randomColor()); }} /> <RectButton style={styles.button} onPress={() => { setBgColor(randomColor()); }} /> </View> </GestureHandlerRootView> ); } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'space-evenly', alignItems: 'center', }, button: { width: 100, height: 50, backgroundColor: 'crimson', borderRadius: 10, }, }); ``` </details>
1 parent 831c711 commit 8ec0820

14 files changed

Lines changed: 2425 additions & 1804 deletions

File tree

apps/common-app/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
"@react-native-community/cli": "18.0.0",
3535
"@react-native-community/cli-platform-android": "18.0.0",
3636
"@react-native-community/cli-platform-ios": "18.0.0",
37-
"@react-native-community/slider": "5.0.1",
3837
"@react-native-community/viewpager": "5.0.11",
3938
"@react-native/babel-preset": "0.79.0",
4039
"@react-native/eslint-config": "0.79.0",

apps/common-app/src/legacy/release_tests/combo/index.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ import {
1616
TapGestureHandler,
1717
TextInput,
1818
RectButton,
19-
createNativeWrapper,
2019
TapGestureHandlerStateChangeEvent,
2120
} from 'react-native-gesture-handler';
22-
import Slider from '@react-native-community/slider';
2321

2422
import Swipeable from 'react-native-gesture-handler/ReanimatedSwipeable';
2523

@@ -30,12 +28,6 @@ import { PressBox } from '../../basic/multitap';
3028
import { LoremIpsum } from '../../../common';
3129
import { InfoButton } from './InfoButton';
3230

33-
const WrappedSlider = createNativeWrapper(Slider, {
34-
shouldCancelWhenOutside: false,
35-
shouldActivateOnStart: true,
36-
disallowInterruption: true,
37-
});
38-
3931
type TouchableHighlightProps = RNTouchableHighlightProps & {
4032
onClick: () => void;
4133
};
@@ -153,8 +145,6 @@ class Combo extends Component<ComboProps> {
153145
<Text>Hello</Text>
154146
</View>
155147
</TouchableHighlight>
156-
{/* @ts-ignore Slider is a union type and it seems like TS has some trouble with infering props type */}
157-
<WrappedSlider style={styles.slider} />
158148
<TextInput
159149
style={styles.textinput}
160150
placeholder="Type something here!"
@@ -250,10 +240,6 @@ const styles = StyleSheet.create({
250240
fontWeight: 'bold',
251241
backgroundColor: 'transparent',
252242
},
253-
slider: {
254-
margin: 10,
255-
flex: 1,
256-
},
257243
scrollView: {
258244
flex: 1,
259245
},

apps/expo-example/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"dependencies": {
1414
"@expo/metro-runtime": "~6.1.2",
1515
"@react-native-async-storage/async-storage": "2.2.0",
16-
"@react-native-community/slider": "5.0.1",
1716
"@react-native-community/viewpager": "5.0.11",
1817
"@react-navigation/elements": "^2.3.8",
1918
"@react-navigation/native": "^7.1.6",

apps/macos-example/Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@ gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
88
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
99
gem 'xcodeproj', '< 1.26.0'
1010
gem 'concurrent-ruby', '< 1.3.4'
11+
12+
# Ruby 3.4.0 has removed some libraries from the standard library.
13+
gem 'bigdecimal'
14+
gem 'logger'
15+
gem 'benchmark'
16+
gem 'mutex_m'

apps/macos-example/Gemfile.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,12 @@ PLATFORMS
109109

110110
DEPENDENCIES
111111
activesupport (>= 6.1.7.5, != 7.1.0)
112+
benchmark
113+
bigdecimal
112114
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)
113115
concurrent-ruby (< 1.3.4)
116+
logger
117+
mutex_m
114118
xcodeproj (< 1.26.0)
115119

116120
RUBY VERSION

apps/macos-example/macos/MacOSExample-macOS/AppDelegate.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#import "AppDelegate.h"
22

33
#import <React/RCTBundleURLProvider.h>
4+
#import <ReactAppDependencyProvider/RCTAppDependencyProvider.h>
45

56
@implementation AppDelegate
67

@@ -10,6 +11,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification
1011
// You can add your custom initial props in the dictionary below.
1112
// They will be passed down to the ViewController used by React Native.
1213
self.initialProps = @{};
14+
self.dependencyProvider = [RCTAppDependencyProvider new];
1315

1416
return [super applicationDidFinishLaunching:notification];
1517
}

apps/macos-example/macos/MacOSExample-macOS/Info.plist

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@
2323
<key>LSMinimumSystemVersion</key>
2424
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
2525
<key>NSAppTransportSecurity</key>
26-
<dict>
27-
<key>NSAllowsArbitraryLoads</key>
28-
<true/>
29-
<key>NSExceptionDomains</key>
30-
<dict>
31-
<key>localhost</key>
32-
<dict>
33-
<key>NSExceptionAllowsInsecureHTTPLoads</key>
34-
<true/>
35-
</dict>
36-
</dict>
37-
</dict>
26+
<dict>
27+
<key>NSAllowsArbitraryLoads</key>
28+
<true/>
29+
<key>NSExceptionDomains</key>
30+
<dict>
31+
<key>localhost</key>
32+
<dict>
33+
<key>NSExceptionAllowsInsecureHTTPLoads</key>
34+
<true/>
35+
</dict>
36+
</dict>
37+
</dict>
3838
<key>NSMainStoryboardFile</key>
3939
<string>Main</string>
4040
<key>NSPrincipalClass</key>
@@ -43,5 +43,7 @@
4343
<true/>
4444
<key>NSSupportsSuddenTermination</key>
4545
<true/>
46+
<key>RCTNewArchEnabled</key>
47+
<true/>
4648
</dict>
4749
</plist>

apps/macos-example/macos/MacOSExample.xcodeproj/project.pbxproj

Lines changed: 56 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 46;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -29,7 +29,7 @@
2929
514201592437B4B40078DB4F /* MacOSExample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MacOSExample.entitlements; sourceTree = "<group>"; };
3030
87331EFB346BFDA93E5B2BD1 /* libPods-MacOSExample-macOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MacOSExample-macOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
3131
B5171904E6719F4BDED73559 /* Pods-MacOSExample-macOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MacOSExample-macOS.release.xcconfig"; path = "Target Support Files/Pods-MacOSExample-macOS/Pods-MacOSExample-macOS.release.xcconfig"; sourceTree = "<group>"; };
32-
D68EC4D024D3BD76718BD55A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
32+
D68EC4D024D3BD76718BD55A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
3333
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
3434
/* End PBXFileReference section */
3535

@@ -67,7 +67,6 @@
6767
37FF6647F5AC89DF645E6531 /* Pods-MacOSExample-macOS.debug.xcconfig */,
6868
B5171904E6719F4BDED73559 /* Pods-MacOSExample-macOS.release.xcconfig */,
6969
);
70-
name = Pods;
7170
path = Pods;
7271
sourceTree = "<group>";
7372
};
@@ -148,6 +147,7 @@
148147
381D8A6E24576A4E00465D17 /* Bundle React Native code and images */,
149148
6D0EC1752E57E7826E33BE11 /* [CP] Copy Pods Resources */,
150149
D01A669245645FE4195DB892 /* [CP-User] Generate metadata for clangd */,
150+
74A914BC92C8F532A0EFF786 /* [CP] Embed Pods Frameworks */,
151151
);
152152
buildRules = (
153153
);
@@ -300,13 +300,35 @@
300300
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-MacOSExample-macOS/Pods-MacOSExample-macOS-resources.sh\"\n";
301301
showEnvVarsInLog = 0;
302302
};
303+
74A914BC92C8F532A0EFF786 /* [CP] Embed Pods Frameworks */ = {
304+
isa = PBXShellScriptBuildPhase;
305+
buildActionMask = 2147483647;
306+
files = (
307+
);
308+
inputPaths = (
309+
"${PODS_ROOT}/Target Support Files/Pods-MacOSExample-macOS/Pods-MacOSExample-macOS-frameworks.sh",
310+
"${PODS_ROOT}/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework",
311+
);
312+
name = "[CP] Embed Pods Frameworks";
313+
outputPaths = (
314+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/hermes.framework",
315+
);
316+
runOnlyForDeploymentPostprocessing = 0;
317+
shellPath = /bin/sh;
318+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-MacOSExample-macOS/Pods-MacOSExample-macOS-frameworks.sh\"\n";
319+
showEnvVarsInLog = 0;
320+
};
303321
D01A669245645FE4195DB892 /* [CP-User] Generate metadata for clangd */ = {
304322
isa = PBXShellScriptBuildPhase;
305-
alwaysOutOfDate = true;
323+
alwaysOutOfDate = 1;
306324
buildActionMask = 2147483647;
307325
files = (
308326
);
327+
inputPaths = (
328+
);
309329
name = "[CP-User] Generate metadata for clangd";
330+
outputPaths = (
331+
);
310332
runOnlyForDeploymentPostprocessing = 0;
311333
shellPath = /bin/bash;
312334
shellScript = "../../../scripts/clangd-generate-xcode-metadata.sh";
@@ -352,7 +374,10 @@
352374
CURRENT_PROJECT_VERSION = 1;
353375
ENABLE_BITCODE = NO;
354376
INFOPLIST_FILE = "MacOSExample-iOS/Info.plist";
355-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
377+
LD_RUNPATH_SEARCH_PATHS = (
378+
"$(inherited)",
379+
"@executable_path/Frameworks",
380+
);
356381
OTHER_LDFLAGS = (
357382
"$(inherited)",
358383
"-ObjC",
@@ -373,7 +398,10 @@
373398
CLANG_ENABLE_MODULES = YES;
374399
CURRENT_PROJECT_VERSION = 1;
375400
INFOPLIST_FILE = "MacOSExample-iOS/Info.plist";
376-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
401+
LD_RUNPATH_SEARCH_PATHS = (
402+
"$(inherited)",
403+
"@executable_path/Frameworks",
404+
);
377405
OTHER_LDFLAGS = (
378406
"$(inherited)",
379407
"-ObjC",
@@ -395,8 +423,11 @@
395423
CURRENT_PROJECT_VERSION = 1;
396424
DEAD_CODE_STRIPPING = NO;
397425
INFOPLIST_FILE = "MacOSExample-macos/Info.plist";
398-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
399-
MACOSX_DEPLOYMENT_TARGET = 11.0;
426+
LD_RUNPATH_SEARCH_PATHS = (
427+
"$(inherited)",
428+
"@executable_path/Frameworks",
429+
);
430+
MACOSX_DEPLOYMENT_TARGET = 15.0;
400431
OTHER_LDFLAGS = (
401432
"$(inherited)",
402433
"-ObjC",
@@ -418,8 +449,11 @@
418449
CLANG_ENABLE_MODULES = YES;
419450
CURRENT_PROJECT_VERSION = 1;
420451
INFOPLIST_FILE = "MacOSExample-macos/Info.plist";
421-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
422-
MACOSX_DEPLOYMENT_TARGET = 11.0;
452+
LD_RUNPATH_SEARCH_PATHS = (
453+
"$(inherited)",
454+
"@executable_path/Frameworks",
455+
);
456+
MACOSX_DEPLOYMENT_TARGET = 15.0;
423457
OTHER_LDFLAGS = (
424458
"$(inherited)",
425459
"-ObjC",
@@ -480,22 +514,22 @@
480514
GCC_WARN_UNUSED_FUNCTION = YES;
481515
GCC_WARN_UNUSED_VARIABLE = YES;
482516
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
483-
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
517+
LD_RUNPATH_SEARCH_PATHS = (
518+
/usr/lib/swift,
519+
"$(inherited)",
520+
);
484521
LIBRARY_SEARCH_PATHS = (
485522
"$(SDKROOT)/usr/lib/swift",
486523
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
487524
"\"$(inherited)\"",
488525
);
489526
MTL_ENABLE_DEBUG_INFO = YES;
490527
ONLY_ACTIVE_ARCH = YES;
491-
OTHER_LDFLAGS = (
492-
"$(inherited)",
493-
" ",
494-
);
528+
OTHER_LDFLAGS = "$(inherited) ";
495529
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
496530
SDKROOT = iphoneos;
497531
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
498-
USE_HERMES = false;
532+
USE_HERMES = true;
499533
};
500534
name = Debug;
501535
};
@@ -540,20 +574,20 @@
540574
GCC_WARN_UNUSED_FUNCTION = YES;
541575
GCC_WARN_UNUSED_VARIABLE = YES;
542576
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
543-
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
577+
LD_RUNPATH_SEARCH_PATHS = (
578+
/usr/lib/swift,
579+
"$(inherited)",
580+
);
544581
LIBRARY_SEARCH_PATHS = (
545582
"$(SDKROOT)/usr/lib/swift",
546583
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
547584
"\"$(inherited)\"",
548585
);
549586
MTL_ENABLE_DEBUG_INFO = NO;
550-
OTHER_LDFLAGS = (
551-
"$(inherited)",
552-
" ",
553-
);
587+
OTHER_LDFLAGS = "$(inherited) ";
554588
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
555589
SDKROOT = iphoneos;
556-
USE_HERMES = false;
590+
USE_HERMES = true;
557591
VALIDATE_PRODUCT = YES;
558592
};
559593
name = Release;

apps/macos-example/macos/Podfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
require_relative '../node_modules/react-native-macos/scripts/react_native_pods'
2-
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
32
require_relative '../../../scripts/clangd-add-xcode-step.rb'
43

54
prepare_react_native_project!
65

6+
ENV['RCT_NEW_ARCH_ENABLED']='1'
7+
78
ENV['GH_EXAMPLE_APP_NAME'] = 'MacOSExample'
89

910
target 'MacOSExample-macOS' do
10-
platform :macos, '11.0'
11+
platform :macos, '15.0'
1112
use_native_modules!
1213

1314
# Flags change depending on the env values.
1415
flags = get_default_flags()
1516

1617
use_react_native!(
1718
:path => '../node_modules/react-native-macos',
18-
:hermes_enabled => false,
1919
# An absolute path to your application root.
2020
:app_path => "#{Pod::Config.instance.installation_root}/..",
21-
:new_arch_enabled => true
21+
:new_arch_enabled => true,
22+
:fabric_enabled => true
2223
)
2324

2425
post_install do |installer|

0 commit comments

Comments
 (0)