Skip to content

Commit 7f8dec1

Browse files
authored
Merge branch 'main' into patch-1
2 parents ac5326f + 030d296 commit 7f8dec1

Some content is hidden

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

45 files changed

+29849
-3207
lines changed

.bundle/config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BUNDLE_PATH: "vendor/bundle"
2+
BUNDLE_FORCE_RUBY_PLATFORM: 1

.circleci/config.yml

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2.1
33
# Default VM config to be used for macOS builds
44
macos_config: &macos_config
55
macos:
6-
xcode: 12.5.0
6+
xcode: 14.0.0
77
resource_class: macos.x86.medium.gen2
88
shell: /bin/bash --login -eo pipefail
99

@@ -45,22 +45,11 @@ commands:
4545

4646
jobs:
4747
install-dependencies:
48-
executor: default
48+
<<: *macos_config
4949
steps:
5050
- checkout
5151
- attach_project
52-
- restore_cache:
53-
keys:
54-
- dependencies-{{ checksum "package.json" }}
55-
- dependencies-
56-
- restore_cache:
57-
keys:
58-
- dependencies-example-{{ checksum "package.json" }}
59-
- dependencies-
60-
- restore_cache:
61-
keys:
62-
- dependencies-example-e2e-{{ checksum "example/e2e/package.json" }}
63-
- dependencies-example-e2e-
52+
6453
- run:
6554
name: Install dependencies
6655
command: |
@@ -256,22 +245,22 @@ workflows:
256245
<<: *run_always
257246
requires:
258247
- install-dependencies
259-
- android-e2e-test:
260-
<<: *run_always
261-
requires:
262-
- install-dependencies
263-
- lint
264-
- typescript
265-
- unit-tests
266-
- build-package
267-
- ios-e2e-test:
268-
<<: *run_always
269-
requires:
270-
- install-dependencies
271-
- lint
272-
- typescript
273-
- unit-tests
274-
- build-package
248+
# - android-e2e-test:
249+
# <<: *run_always
250+
# requires:
251+
# - install-dependencies
252+
# - lint
253+
# - typescript
254+
# - unit-tests
255+
# - build-package
256+
# - ios-e2e-test:
257+
# <<: *run_always
258+
# requires:
259+
# - install-dependencies
260+
# - lint
261+
# - typescript
262+
# - unit-tests
263+
# - build-package
275264
- release-to-npm:
276265
<<: *run_on_release
277266
context:
@@ -282,5 +271,5 @@ workflows:
282271
- typescript
283272
- unit-tests
284273
- build-package
285-
- ios-e2e-test
286-
- android-e2e-test
274+
# - ios-e2e-test
275+
# - android-e2e-test

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
16

.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.7.5

Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source 'https://rubygems.org'
2+
3+
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4+
ruby '2.7.5'
5+
6+
gem 'cocoapods', '~> 1.11', '>= 1.11.2'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ Sets a listener for listed events:
826826

827827
```javascript
828828
useEffect(() => {
829-
const listener = Intercom.addEventListener('IntercomUnreadConversationCountDidChangeNotification', ({count}) => alert(count);
829+
const listener = Intercom.addEventListener('IntercomUnreadConversationCountDidChangeNotification', ({count}) => alert(count));
830830
return () => {
831831
listener.remove();
832832
}
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
package com.rndiffapp.newarchitecture;
2+
3+
import android.app.Application;
4+
import androidx.annotation.NonNull;
5+
import com.facebook.react.PackageList;
6+
import com.facebook.react.ReactInstanceManager;
7+
import com.facebook.react.ReactNativeHost;
8+
import com.facebook.react.ReactPackage;
9+
import com.facebook.react.ReactPackageTurboModuleManagerDelegate;
10+
import com.facebook.react.bridge.JSIModulePackage;
11+
import com.facebook.react.bridge.JSIModuleProvider;
12+
import com.facebook.react.bridge.JSIModuleSpec;
13+
import com.facebook.react.bridge.JSIModuleType;
14+
import com.facebook.react.bridge.JavaScriptContextHolder;
15+
import com.facebook.react.bridge.ReactApplicationContext;
16+
import com.facebook.react.bridge.UIManager;
17+
import com.facebook.react.fabric.ComponentFactory;
18+
import com.facebook.react.fabric.CoreComponentsRegistry;
19+
import com.facebook.react.fabric.FabricJSIModuleProvider;
20+
import com.facebook.react.fabric.ReactNativeConfig;
21+
import com.facebook.react.uimanager.ViewManagerRegistry;
22+
import com.rndiffapp.BuildConfig;
23+
import com.rndiffapp.newarchitecture.components.MainComponentsRegistry;
24+
import com.rndiffapp.newarchitecture.modules.MainApplicationTurboModuleManagerDelegate;
25+
import java.util.ArrayList;
26+
import java.util.List;
27+
28+
/**
29+
* A {@link ReactNativeHost} that helps you load everything needed for the New Architecture, both
30+
* TurboModule delegates and the Fabric Renderer.
31+
*
32+
* <p>Please note that this class is used ONLY if you opt-in for the New Architecture (see the
33+
* `newArchEnabled` property). Is ignored otherwise.
34+
*/
35+
public class MainApplicationReactNativeHost extends ReactNativeHost {
36+
public MainApplicationReactNativeHost(Application application) {
37+
super(application);
38+
}
39+
40+
@Override
41+
public boolean getUseDeveloperSupport() {
42+
return BuildConfig.DEBUG;
43+
}
44+
45+
@Override
46+
protected List<ReactPackage> getPackages() {
47+
List<ReactPackage> packages = new PackageList(this).getPackages();
48+
// Packages that cannot be autolinked yet can be added manually here, for example:
49+
// packages.add(new MyReactNativePackage());
50+
// TurboModules must also be loaded here providing a valid TurboReactPackage implementation:
51+
// packages.add(new TurboReactPackage() { ... });
52+
// If you have custom Fabric Components, their ViewManagers should also be loaded here
53+
// inside a ReactPackage.
54+
return packages;
55+
}
56+
57+
@Override
58+
protected String getJSMainModuleName() {
59+
return "index";
60+
}
61+
62+
@NonNull
63+
@Override
64+
protected ReactPackageTurboModuleManagerDelegate.Builder
65+
getReactPackageTurboModuleManagerDelegateBuilder() {
66+
// Here we provide the ReactPackageTurboModuleManagerDelegate Builder. This is necessary
67+
// for the new architecture and to use TurboModules correctly.
68+
return new MainApplicationTurboModuleManagerDelegate.Builder();
69+
}
70+
71+
@Override
72+
protected JSIModulePackage getJSIModulePackage() {
73+
return new JSIModulePackage() {
74+
@Override
75+
public List<JSIModuleSpec> getJSIModules(
76+
final ReactApplicationContext reactApplicationContext,
77+
final JavaScriptContextHolder jsContext) {
78+
final List<JSIModuleSpec> specs = new ArrayList<>();
79+
80+
// Here we provide a new JSIModuleSpec that will be responsible of providing the
81+
// custom Fabric Components.
82+
specs.add(
83+
new JSIModuleSpec() {
84+
@Override
85+
public JSIModuleType getJSIModuleType() {
86+
return JSIModuleType.UIManager;
87+
}
88+
89+
@Override
90+
public JSIModuleProvider<UIManager> getJSIModuleProvider() {
91+
final ComponentFactory componentFactory = new ComponentFactory();
92+
CoreComponentsRegistry.register(componentFactory);
93+
94+
// Here we register a Components Registry.
95+
// The one that is generated with the template contains no components
96+
// and just provides you the one from React Native core.
97+
MainComponentsRegistry.register(componentFactory);
98+
99+
final ReactInstanceManager reactInstanceManager = getReactInstanceManager();
100+
101+
ViewManagerRegistry viewManagerRegistry =
102+
new ViewManagerRegistry(
103+
reactInstanceManager.getOrCreateViewManagers(reactApplicationContext));
104+
105+
return new FabricJSIModuleProvider(
106+
reactApplicationContext,
107+
componentFactory,
108+
ReactNativeConfig.DEFAULT_CONFIG,
109+
viewManagerRegistry);
110+
}
111+
});
112+
return specs;
113+
}
114+
};
115+
}
116+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.rndiffapp.newarchitecture.components;
2+
3+
import com.facebook.jni.HybridData;
4+
import com.facebook.proguard.annotations.DoNotStrip;
5+
import com.facebook.react.fabric.ComponentFactory;
6+
import com.facebook.soloader.SoLoader;
7+
8+
/**
9+
* Class responsible to load the custom Fabric Components. This class has native methods and needs a
10+
* corresponding C++ implementation/header file to work correctly (already placed inside the jni/
11+
* folder for you).
12+
*
13+
* <p>Please note that this class is used ONLY if you opt-in for the New Architecture (see the
14+
* `newArchEnabled` property). Is ignored otherwise.
15+
*/
16+
@DoNotStrip
17+
public class MainComponentsRegistry {
18+
static {
19+
SoLoader.loadLibrary("fabricjni");
20+
}
21+
22+
@DoNotStrip private final HybridData mHybridData;
23+
24+
@DoNotStrip
25+
private native HybridData initHybrid(ComponentFactory componentFactory);
26+
27+
@DoNotStrip
28+
private MainComponentsRegistry(ComponentFactory componentFactory) {
29+
mHybridData = initHybrid(componentFactory);
30+
}
31+
32+
@DoNotStrip
33+
public static MainComponentsRegistry register(ComponentFactory componentFactory) {
34+
return new MainComponentsRegistry(componentFactory);
35+
}
36+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package com.rndiffapp.newarchitecture.modules;
2+
3+
import com.facebook.jni.HybridData;
4+
import com.facebook.react.ReactPackage;
5+
import com.facebook.react.ReactPackageTurboModuleManagerDelegate;
6+
import com.facebook.react.bridge.ReactApplicationContext;
7+
import com.facebook.soloader.SoLoader;
8+
import java.util.List;
9+
10+
/**
11+
* Class responsible to load the TurboModules. This class has native methods and needs a
12+
* corresponding C++ implementation/header file to work correctly (already placed inside the jni/
13+
* folder for you).
14+
*
15+
* <p>Please note that this class is used ONLY if you opt-in for the New Architecture (see the
16+
* `newArchEnabled` property). Is ignored otherwise.
17+
*/
18+
public class MainApplicationTurboModuleManagerDelegate
19+
extends ReactPackageTurboModuleManagerDelegate {
20+
21+
private static volatile boolean sIsSoLibraryLoaded;
22+
23+
protected MainApplicationTurboModuleManagerDelegate(
24+
ReactApplicationContext reactApplicationContext, List<ReactPackage> packages) {
25+
super(reactApplicationContext, packages);
26+
}
27+
28+
protected native HybridData initHybrid();
29+
30+
native boolean canCreateTurboModule(String moduleName);
31+
32+
public static class Builder extends ReactPackageTurboModuleManagerDelegate.Builder {
33+
protected MainApplicationTurboModuleManagerDelegate build(
34+
ReactApplicationContext context, List<ReactPackage> packages) {
35+
return new MainApplicationTurboModuleManagerDelegate(context, packages);
36+
}
37+
}
38+
39+
@Override
40+
protected synchronized void maybeLoadOtherSoLibraries() {
41+
if (!sIsSoLibraryLoaded) {
42+
// If you change the name of your application .so file in the Android.mk file,
43+
// make sure you update the name here as well.
44+
SoLoader.loadLibrary("rndiffapp_appmodules");
45+
sIsSoLibraryLoaded = true;
46+
}
47+
}
48+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cmake_minimum_required(VERSION 3.13)
2+
3+
# Define the library name here.
4+
project(rndiffapp_appmodules)
5+
6+
# This file includes all the necessary to let you build your application with the New Architecture.
7+
include(${REACT_ANDROID_DIR}/cmake-utils/ReactNative-application.cmake)

0 commit comments

Comments
 (0)