Skip to content

Commit b264808

Browse files
authored
Upgrade samples to 0.77 (#1005)
## Description Upgrades Calculator samples and csharp and cppwinrt NativeModule samples to 0.77. Note: will include fabric NativeModule sample in separate PR. ### Why Part of the 0.77 release.
1 parent 1f4b998 commit b264808

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+28680
-6814
lines changed

samples/Calculator/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This sample showcases the usage of React Native for Windows to build a simple calculator. It includes implementations in C# and C++/WinRT.
44

5-
It currently targets React Native Windows 0.76.
5+
It currently targets React Native Windows 0.77.
66

77
### Setup
88
First, make sure you've met the [React Native Windows System Requirements](https://microsoft.github.io/react-native-windows/docs/rnw-dependencies).

samples/Calculator/cppwinrt/Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ ruby ">= 2.6.10"
77
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'
10+
gem 'concurrent-ruby', '< 1.3.4'

samples/Calculator/cppwinrt/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ To upgrade this sample to the latest version of RNW:
2525
```
2626
3. Create a new React Native app and change version to version you want to upgrade to (replace 'version' with desired version - for latest version, use 'latest'):
2727
```cmd
28-
npx @react-native-community/cli@latest init Calculator --version {version}
28+
npx @react-native-community/cli@latest init Calculator --template @react-native-community/template@latest --skip-git-init
2929
```
3030
3131
4. Add a lockfile to the calculator directory:

samples/Calculator/cppwinrt/__tests__/App.test.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@
22
* @format
33
*/
44

5-
import 'react-native';
65
import React from 'react';
6+
import ReactTestRenderer from 'react-test-renderer';
77
import App from '../App';
88

9-
// Note: import explicitly to use the types shipped with jest.
10-
import {it} from '@jest/globals';
11-
12-
// Note: test renderer must be required after react-native.
13-
import renderer from 'react-test-renderer';
14-
15-
it('renders correctly', () => {
16-
renderer.create(<App />);
9+
test('renders correctly', async () => {
10+
await ReactTestRenderer.act(() => {
11+
ReactTestRenderer.create(<App />);
12+
});
1713
});

samples/Calculator/cppwinrt/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ buildscript {
44
minSdkVersion = 24
55
compileSdkVersion = 35
66
targetSdkVersion = 34
7-
ndkVersion = "26.1.10909125"
8-
kotlinVersion = "1.9.24"
7+
ndkVersion = "27.1.12297006"
8+
kotlinVersion = "2.0.21"
99
}
1010
repositories {
1111
google()

samples/Calculator/cppwinrt/ios/Calculator.xcodeproj/project.pbxproj

Lines changed: 4 additions & 189 deletions
Large diffs are not rendered by default.

samples/Calculator/cppwinrt/ios/Calculator/AppDelegate.h

Lines changed: 0 additions & 6 deletions
This file was deleted.

samples/Calculator/cppwinrt/ios/Calculator/AppDelegate.mm

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import UIKit
2+
import React
3+
import React_RCTAppDelegate
4+
import ReactAppDependencyProvider
5+
6+
@main
7+
class AppDelegate: RCTAppDelegate {
8+
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
9+
self.moduleName = "Calculator"
10+
self.dependencyProvider = RCTAppDependencyProvider()
11+
12+
// You can add your custom initial props in the dictionary below.
13+
// They will be passed down to the ViewController used by React Native.
14+
self.initialProps = [:]
15+
16+
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
17+
}
18+
19+
override func sourceURL(for bridge: RCTBridge) -> URL? {
20+
self.bundleURL()
21+
}
22+
23+
override func bundleURL() -> URL? {
24+
#if DEBUG
25+
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
26+
#else
27+
Bundle.main.url(forResource: "main", withExtension: "jsbundle")
28+
#endif
29+
}
30+
}

samples/Calculator/cppwinrt/ios/Calculator/main.m

Lines changed: 0 additions & 10 deletions
This file was deleted.

samples/Calculator/cppwinrt/ios/CalculatorTests/CalculatorTests.m

Lines changed: 0 additions & 66 deletions
This file was deleted.

samples/Calculator/cppwinrt/ios/CalculatorTests/Info.plist

Lines changed: 0 additions & 24 deletions
This file was deleted.

samples/Calculator/cppwinrt/ios/Podfile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ target 'Calculator' do
2323
:app_path => "#{Pod::Config.instance.installation_root}/.."
2424
)
2525

26-
target 'CalculatorTests' do
27-
inherit! :complete
28-
# Pods for testing
29-
end
30-
3126
post_install do |installer|
3227
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
3328
react_native_post_install(

0 commit comments

Comments
 (0)