Skip to content

Commit 2c76fe7

Browse files
Samithacursoragent
authored andcommitted
chore(example): upgrade to React Native 0.81 and refresh demo app
- Upgrade React Native to 0.81.5 and React to 19.1.0 - Update Android: new package path (com.timezoneexample), Gradle 8.x, Java 17 - Migrate iOS to Swift AppDelegate, remove legacy ObjC and unit tests - Simplify Gemfile and bump CocoaPods to 1.16 - Redesign App.tsx with card-based UI, staggered animations - Add TypeScript, update metro and react-native configs - Remove jest config and debug manifest Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent e3de9c3 commit 2c76fe7

34 files changed

Lines changed: 1876 additions & 1078 deletions

example/.bundle/config

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

example/.gitignore

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Xcode
6+
#
7+
build/
8+
*.pbxuser
9+
!default.pbxuser
10+
*.mode1v3
11+
!default.mode1v3
12+
*.mode2v3
13+
!default.mode2v3
14+
*.perspectivev3
15+
!default.perspectivev3
16+
xcuserdata
17+
*.xccheckout
18+
*.moved-aside
19+
DerivedData
20+
*.hmap
21+
*.ipa
22+
*.xcuserstate
23+
**/.xcode.env.local
24+
25+
# Android/IntelliJ
26+
#
27+
build/
28+
.idea
29+
.gradle
30+
local.properties
31+
*.iml
32+
*.hprof
33+
.cxx/
34+
*.keystore
35+
!debug.keystore
36+
.kotlin/
37+
38+
# node.js
39+
#
40+
node_modules/
41+
npm-debug.log
42+
yarn-error.log
43+
44+
# fastlane
45+
#
46+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47+
# screenshots whenever they are needed.
48+
# For more information about the recommended setup visit:
49+
# https://docs.fastlane.tools/best-practices/source-control/
50+
51+
**/fastlane/report.xml
52+
**/fastlane/Preview.html
53+
**/fastlane/screenshots
54+
**/fastlane/test_output
55+
56+
# Bundle artifact
57+
*.jsbundle
58+
59+
# Ruby / CocoaPods
60+
**/Pods/
61+
/vendor/bundle/
62+
63+
# Temporary files created by Metro to check the health of the file watcher
64+
.metro-health-check*
65+
66+
# testing
67+
/coverage
68+
69+
# Yarn
70+
.yarn/*
71+
!.yarn/patches
72+
!.yarn/plugins
73+
!.yarn/releases
74+
!.yarn/sdks
75+
!.yarn/versions

example/Gemfile

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
source 'https://rubygems.org'
22

3-
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4-
ruby ">= 2.6.10"
5-
6-
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
7-
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
8-
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
9-
gem 'xcodeproj', '< 1.26.0'
3+
# Required for CocoaPods installation
4+
gem 'cocoapods', '~> 1.16'

example/Gemfile.lock

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
CFPropertyList (3.0.7)
5-
base64
6-
nkf
7-
rexml
4+
CFPropertyList (3.0.9)
85
activesupport (6.1.7.10)
96
concurrent-ruby (~> 1.0, >= 1.0.2)
107
i18n (>= 1.6, < 2)
118
minitest (>= 5.1)
129
tzinfo (~> 2.0)
1310
zeitwerk (~> 2.3)
14-
addressable (2.8.7)
15-
public_suffix (>= 2.0.2, < 7.0)
11+
addressable (2.8.8)
12+
public_suffix (>= 2.0.2, < 8.0)
1613
algoliasearch (1.27.5)
1714
httpclient (~> 2.8, >= 2.8.3)
1815
json (>= 1.5.1)
1916
atomos (0.1.3)
20-
base64 (0.2.0)
2117
claide (1.1.0)
22-
cocoapods (1.15.2)
18+
cocoapods (1.16.2)
2319
addressable (~> 2.8)
2420
claide (>= 1.0.2, < 2.0)
25-
cocoapods-core (= 1.15.2)
21+
cocoapods-core (= 1.16.2)
2622
cocoapods-deintegrate (>= 1.0.3, < 2.0)
2723
cocoapods-downloader (>= 2.1, < 3.0)
2824
cocoapods-plugins (>= 1.0.0, < 2.0)
@@ -36,8 +32,8 @@ GEM
3632
molinillo (~> 0.8.0)
3733
nap (~> 1.0)
3834
ruby-macho (>= 2.3.0, < 3.0)
39-
xcodeproj (>= 1.23.0, < 2.0)
40-
cocoapods-core (1.15.2)
35+
xcodeproj (>= 1.27.0, < 2.0)
36+
cocoapods-core (1.16.2)
4137
activesupport (>= 5.0, < 8)
4238
addressable (~> 2.8)
4339
algoliasearch (~> 1.0)
@@ -57,50 +53,46 @@ GEM
5753
netrc (~> 0.11)
5854
cocoapods-try (1.2.0)
5955
colored2 (3.1.2)
60-
concurrent-ruby (1.3.4)
56+
concurrent-ruby (1.3.6)
6157
escape (0.0.4)
62-
ethon (0.16.0)
58+
ethon (0.15.0)
6359
ffi (>= 1.15.0)
64-
ffi (1.17.0)
60+
ffi (1.17.3)
6561
fourflusher (2.3.1)
6662
fuzzy_match (2.0.4)
6763
gh_inspector (1.1.3)
68-
httpclient (2.8.3)
69-
i18n (1.14.6)
64+
httpclient (2.9.0)
65+
mutex_m
66+
i18n (1.14.8)
7067
concurrent-ruby (~> 1.0)
7168
json (2.7.6)
7269
minitest (5.25.4)
7370
molinillo (0.8.0)
74-
nanaimo (0.3.0)
71+
mutex_m (0.3.0)
72+
nanaimo (0.4.0)
7573
nap (1.1.0)
7674
netrc (0.11.0)
77-
nkf (0.2.0)
7875
public_suffix (4.0.7)
79-
rexml (3.3.9)
76+
rexml (3.4.4)
8077
ruby-macho (2.5.1)
81-
typhoeus (1.4.1)
82-
ethon (>= 0.9.0)
78+
typhoeus (1.5.0)
79+
ethon (>= 0.9.0, < 0.16.0)
8380
tzinfo (2.0.6)
8481
concurrent-ruby (~> 1.0)
85-
xcodeproj (1.25.1)
82+
xcodeproj (1.27.0)
8683
CFPropertyList (>= 2.3.3, < 4.0)
8784
atomos (~> 0.1.3)
8885
claide (>= 1.0.2, < 2.0)
8986
colored2 (~> 3.1)
90-
nanaimo (~> 0.3.0)
87+
nanaimo (~> 0.4.0)
9188
rexml (>= 3.3.6, < 4.0)
9289
zeitwerk (2.6.18)
9390

9491
PLATFORMS
9592
ruby
9693

9794
DEPENDENCIES
98-
activesupport (>= 6.1.7.5, != 7.1.0)
99-
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)
100-
xcodeproj (< 1.26.0)
101-
102-
RUBY VERSION
103-
ruby 2.6.10p210
95+
cocoapods (~> 1.16)
10496

10597
BUNDLED WITH
10698
1.17.2

example/README.md

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,58 +2,76 @@ This is a new [**React Native**](https://reactnative.dev) project, bootstrapped
22

33
# Getting Started
44

5-
>**Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
5+
> **Note**: Make sure you have completed the [Set Up Your Environment](https://reactnative.dev/docs/set-up-your-environment) guide before proceeding.
66
7-
## Step 1: Start the Metro Server
7+
## Step 1: Start Metro
88

9-
First, you will need to start **Metro**, the JavaScript _bundler_ that ships _with_ React Native.
9+
First, you will need to run **Metro**, the JavaScript build tool for React Native.
1010

11-
To start Metro, run the following command from the _root_ of your React Native project:
11+
To start the Metro dev server, run the following command from the root of your React Native project:
1212

13-
```bash
14-
# using npm
13+
```sh
14+
# Using npm
1515
npm start
1616

1717
# OR using Yarn
1818
yarn start
1919
```
2020

21-
## Step 2: Start your Application
21+
## Step 2: Build and run your app
2222

23-
Let Metro Bundler run in its _own_ terminal. Open a _new_ terminal from the _root_ of your React Native project. Run the following command to start your _Android_ or _iOS_ app:
23+
With Metro running, open a new terminal window/pane from the root of your React Native project, and use one of the following commands to build and run your Android or iOS app:
2424

25-
### For Android
25+
### Android
2626

27-
```bash
28-
# using npm
27+
```sh
28+
# Using npm
2929
npm run android
3030

3131
# OR using Yarn
3232
yarn android
3333
```
3434

35-
### For iOS
35+
### iOS
3636

37-
```bash
38-
# using npm
37+
For iOS, remember to install CocoaPods dependencies (this only needs to be run on first clone or after updating native deps).
38+
39+
The first time you create a new project, run the Ruby bundler to install CocoaPods itself:
40+
41+
```sh
42+
bundle install
43+
```
44+
45+
Then, and every time you update your native dependencies, run:
46+
47+
```sh
48+
bundle exec pod install
49+
```
50+
51+
For more information, please visit [CocoaPods Getting Started guide](https://guides.cocoapods.org/using/getting-started.html).
52+
53+
```sh
54+
# Using npm
3955
npm run ios
4056

4157
# OR using Yarn
4258
yarn ios
4359
```
4460

45-
If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly.
61+
If everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device.
62+
63+
This is one way to run your app — you can also build it directly from Android Studio or Xcode.
4664

47-
This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively.
65+
## Step 3: Modify your app
4866

49-
## Step 3: Modifying your App
67+
Now that you have successfully run the app, let's make changes!
5068

51-
Now that you have successfully run the app, let's modify it.
69+
Open `App.tsx` in your text editor of choice and make some changes. When you save, your app will automatically update and reflect these changes — this is powered by [Fast Refresh](https://reactnative.dev/docs/fast-refresh).
5270

53-
1. Open `App.tsx` in your text editor of choice and edit some lines.
54-
2. For **Android**: Press the <kbd>R</kbd> key twice or select **"Reload"** from the **Developer Menu** (<kbd>Ctrl</kbd> + <kbd>M</kbd> (on Window and Linux) or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> (on macOS)) to see your changes!
71+
When you want to forcefully reload, for example to reset the state of your app, you can perform a full reload:
5572

56-
For **iOS**: Hit <kbd>Cmd ⌘</kbd> + <kbd>R</kbd> in your iOS Simulator to reload the app and see your changes!
73+
- **Android**: Press the <kbd>R</kbd> key twice or select **"Reload"** from the **Dev Menu**, accessed via <kbd>Ctrl</kbd> + <kbd>M</kbd> (Windows/Linux) or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> (macOS).
74+
- **iOS**: Press <kbd>R</kbd> in iOS Simulator.
5775

5876
## Congratulations! :tada:
5977

@@ -62,11 +80,11 @@ You've successfully run and modified your React Native App. :partying_face:
6280
### Now what?
6381

6482
- If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
65-
- If you're curious to learn more about React Native, check out the [Introduction to React Native](https://reactnative.dev/docs/getting-started).
83+
- If you're curious to learn more about React Native, check out the [docs](https://reactnative.dev/docs/getting-started).
6684

6785
# Troubleshooting
6886

69-
If you can't get this to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
87+
If you're having issues getting the above steps to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
7088

7189
# Learn More
7290

example/android/app/build.gradle

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,24 @@ apply plugin: "com.android.application"
22
apply plugin: "org.jetbrains.kotlin.android"
33
apply plugin: "com.facebook.react"
44

5+
def isNewArchitectureEnabled() {
6+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
7+
}
8+
59
/**
610
* This is the configuration block to customize your React Native Android app.
711
* By default you don't need to apply any configuration, just uncomment the lines you need.
812
*/
913
react {
1014
/* Folders */
1115
// The root of your project, i.e. where "package.json" lives. Default is '../..'
12-
// root = file("../../")
16+
root = file("../../")
1317
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
14-
// reactNativeDir = file("../../node_modules/react-native")
18+
reactNativeDir = file("../../../node_modules/react-native")
1519
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
16-
// codegenDir = file("../../node_modules/@react-native/codegen")
20+
codegenDir = file("../../../node_modules/@react-native/codegen")
1721
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
18-
// cliFile = file("../../node_modules/react-native/cli.js")
22+
cliFile = file("../../../node_modules/react-native/cli.js")
1923

2024
/* Variants */
2125
// The list of variants to that are debuggable. For those we're going to
@@ -63,27 +67,29 @@ def enableProguardInReleaseBuilds = false
6367
* The preferred build flavor of JavaScriptCore (JSC)
6468
*
6569
* For example, to use the international variant, you can use:
66-
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
70+
* `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
6771
*
6872
* The international variant includes ICU i18n library and necessary data
6973
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
7074
* give correct results when using with locales other than en-US. Note that
7175
* this variant is about 6MiB larger per architecture than default.
7276
*/
73-
def jscFlavor = 'org.webkit:android-jsc:+'
77+
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
7478

7579
android {
7680
ndkVersion rootProject.ext.ndkVersion
7781
buildToolsVersion rootProject.ext.buildToolsVersion
7882
compileSdk rootProject.ext.compileSdkVersion
7983

80-
namespace "timezone.example"
84+
namespace "com.timezoneexample"
8185
defaultConfig {
82-
applicationId "timezone.example"
86+
applicationId "com.timezoneexample"
8387
minSdkVersion rootProject.ext.minSdkVersion
8488
targetSdkVersion rootProject.ext.targetSdkVersion
8589
versionCode 1
8690
versionName "1.0"
91+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
92+
buildConfigField "boolean", "IS_HERMES_ENABLED", hermesEnabled.toString()
8793
}
8894
signingConfigs {
8995
debug {
@@ -117,22 +123,3 @@ dependencies {
117123
implementation jscFlavor
118124
}
119125
}
120-
121-
def isNewArchitectureEnabled() {
122-
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
123-
}
124-
125-
if (isNewArchitectureEnabled()) {
126-
// Since our library doesn't invoke codegen automatically we need to do it here.
127-
tasks.register('invokeLibraryCodegen', Exec) {
128-
workingDir "$rootDir/../../"
129-
def isWindows = System.getProperty('os.name').toLowerCase().contains('windows')
130-
131-
if (isWindows) {
132-
commandLine 'cmd', '/c', 'npx bob build --target codegen'
133-
} else {
134-
commandLine 'sh', '-c', 'npx bob build --target codegen'
135-
}
136-
}
137-
preBuild.dependsOn invokeLibraryCodegen
138-
}

0 commit comments

Comments
 (0)