Skip to content

Commit 7eb8f7a

Browse files
committed
Add independent sample for new arch in samples/
1 parent 9a4bb47 commit 7eb8f7a

Some content is hidden

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

68 files changed

+266
-226
lines changed

example/.gitignore

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

example/android/app/src/main/res/values/strings.xml

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

example/app.json

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

example/babel.config.js

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

example/index.js

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

example/metro.config.js

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

example/package.json

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

example/react-native.config.js

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

ios/InappRnSdk.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,12 @@ - (void)setOverrides:(JS::NativeInappRnSdk::Overrides &)overrides resolve:(nonnu
195195
@"status": status,
196196
@"replyId": replyId
197197
}];
198-
} _logSession:^(NSString * _Nonnull appId, NSString * _Nonnull providerId, NSString * _Nonnull sessionId, NSString * _Nonnull replyId) {
198+
} _logSession:^(NSString * _Nonnull appId, NSString * _Nonnull providerId, NSString * _Nonnull sessionId, NSString * _Nonnull logType) {
199199
[self emitOnSessionLogs:@{
200200
@"appId": appId,
201201
@"providerId": providerId,
202202
@"sessionId": sessionId,
203-
@"replyId": replyId
203+
@"logType": logType
204204
}];
205205
}]];
206206
}
File renamed without changes.
File renamed without changes.

samples/example_new_arch/.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native',
4+
};

samples/example_new_arch/.gitignore

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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
76+
.env
77+
Gemfile.lock
78+
Podfile.lock
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
arrowParens: 'avoid',
3+
bracketSameLine: true,
4+
bracketSpacing: false,
5+
singleQuote: true,
6+
trailingComma: 'all',
7+
};
File renamed without changes.
File renamed without changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
show: jest.fn(),
3+
};

example/android/app/build.gradle renamed to samples/example_new_arch/android/app/build.gradle

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,23 @@ def enableProguardInReleaseBuilds = false
6363
* The preferred build flavor of JavaScriptCore (JSC)
6464
*
6565
* For example, to use the international variant, you can use:
66-
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
66+
* `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
6767
*
6868
* The international variant includes ICU i18n library and necessary data
6969
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
7070
* give correct results when using with locales other than en-US. Note that
7171
* this variant is about 6MiB larger per architecture than default.
7272
*/
73-
def jscFlavor = 'org.webkit:android-jsc:+'
73+
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
7474

7575
android {
7676
ndkVersion rootProject.ext.ndkVersion
7777
buildToolsVersion rootProject.ext.buildToolsVersion
7878
compileSdk rootProject.ext.compileSdkVersion
7979

80-
namespace "reclaimprotocol.inapp_rn_sdk.example"
80+
namespace "org.reclaimprotocol.example"
8181
defaultConfig {
82-
applicationId "reclaimprotocol.inapp_rn_sdk.example"
82+
applicationId "org.reclaimprotocol.example"
8383
minSdkVersion rootProject.ext.minSdkVersion
8484
targetSdkVersion rootProject.ext.targetSdkVersion
8585
versionCode 1
@@ -117,22 +117,3 @@ dependencies {
117117
implementation jscFlavor
118118
}
119119
}
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-
}

example/android/app/src/main/java/reclaimprotocol/inapp_rn_sdk/example/MainActivity.kt renamed to samples/example_new_arch/android/app/src/main/java/org/reclaimprotocol/example/MainActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package reclaimprotocol.inapp_rn_sdk.example
1+
package org.reclaimprotocol.example
22

33
import com.facebook.react.ReactActivity
44
import com.facebook.react.ReactActivityDelegate
@@ -11,7 +11,7 @@ class MainActivity : ReactActivity() {
1111
* Returns the name of the main component registered from JavaScript. This is used to schedule
1212
* rendering of the component.
1313
*/
14-
override fun getMainComponentName(): String = "InappRnSdkExample"
14+
override fun getMainComponentName(): String = "example_new_arch"
1515

1616
/**
1717
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]

example/android/app/src/main/java/reclaimprotocol/inapp_rn_sdk/example/MainApplication.kt renamed to samples/example_new_arch/android/app/src/main/java/org/reclaimprotocol/example/MainApplication.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package reclaimprotocol.inapp_rn_sdk.example
1+
package org.reclaimprotocol.example
22

33
import android.app.Application
44
import com.facebook.react.PackageList
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="app_name">example_new_arch</string>
3+
</resources>

example/android/build.gradle renamed to samples/example_new_arch/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ buildscript {
33
buildToolsVersion = "35.0.0"
44
minSdkVersion = 24
55
compileSdkVersion = 35
6-
targetSdkVersion = 34
6+
targetSdkVersion = 35
77
ndkVersion = "27.1.12297006"
88
kotlinVersion = "2.0.21"
99
}

example/android/gradle.properties renamed to samples/example_new_arch/android/gradle.properties

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,3 @@ newArchEnabled=true
3737
# Use this property to enable or disable the Hermes JS engine.
3838
# If set to false, you will be using JSC instead.
3939
hermesEnabled=true
40-
41-
newArchEnabled=true

example/android/gradle/wrapper/gradle-wrapper.properties renamed to samples/example_new_arch/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

example/android/gradlew renamed to samples/example_new_arch/android/gradlew

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ done
8686
# shellcheck disable=SC2034
8787
APP_BASE_NAME=${0##*/}
8888
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89-
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90-
' "$PWD" ) || exit
89+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
9190

9291
# Use the maximum available, or set MAX_FD != -1 to use that value.
9392
MAX_FD=maximum

example/android/settings.gradle renamed to samples/example_new_arch/android/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
22
plugins { id("com.facebook.react.settings") }
33
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
4-
rootProject.name = 'reclaimprotocol.inapp_rn_sdk.example'
4+
rootProject.name = 'example_new_arch'
55
include ':app'
66
includeBuild('../node_modules/@react-native/gradle-plugin')
77
dependencyResolutionManagement {

samples/example_new_arch/app.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "example_new_arch",
3+
"displayName": "example_new_arch"
4+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
presets: ['module:@react-native/babel-preset'],
3+
plugins: [
4+
["module:react-native-dotenv", {
5+
"envName": "APP_ENV",
6+
"moduleName": "@env",
7+
"path": ".env"
8+
}]
9+
]
10+
};

samples/example_new_arch/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @format
3+
*/
4+
5+
import {AppRegistry} from 'react-native';
6+
import App from './src/App';
7+
import {name as appName} from './app.json';
8+
9+
AppRegistry.registerComponent(appName, () => App);
File renamed without changes.

example/ios/Podfile renamed to samples/example_new_arch/ios/Podfile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
ENV['RCT_NEW_ARCH_ENABLED'] = '1'
2-
31
# Resolve react_native_pods.rb with node to allow for hoisting
42
require Pod::Executable.execute_command('node', ['-p',
53
'require.resolve(
@@ -16,7 +14,7 @@ if linkage != nil
1614
use_frameworks! :linkage => linkage.to_sym
1715
end
1816

19-
target 'InappRnSdkExample' do
17+
target 'example_new_arch' do
2018
config = use_native_modules!
2119

2220
use_react_native!(
@@ -25,10 +23,6 @@ target 'InappRnSdkExample' do
2523
:app_path => "#{Pod::Config.instance.installation_root}/.."
2624
)
2725

28-
pre_install do |installer|
29-
system("cd ../../ && npx bob build --target codegen")
30-
end
31-
3226
post_install do |installer|
3327
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
3428
react_native_post_install(

0 commit comments

Comments
 (0)