Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# React Native Multi-Instance Development Environment
# Install with: brew bundle

# Core development tools
brew "clang-format"
brew "ccache"

# Additional useful tools for React Native development
brew "node"
brew "watchman"
brew "git"
brew "git-lfs"

# Optional but helpful tools
# brew "llvm" # Full LLVM toolchain (includes clang-format)
# brew "cmake" # For building native modules
# brew "ninja" # Fast build system
# brew "pkg-config" # Package configuration tool
2 changes: 2 additions & 0 deletions apps/recursive/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ function App({depth = 1}: AppProps): React.JSX.Element {
jsBundleSource="index"
moduleName="App" // Recursively load App itself
initialProperties={{depth: depth + 1}}
onMessage={msg => console.log('message', msg)}
onError={e => console.error('error', e)}
/>
</View>
) : (
Expand Down
32 changes: 28 additions & 4 deletions apps/side-by-side/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1649,10 +1649,34 @@ PODS:
- ReactCommon/turbomodule/core
- SocketRocket
- React-MultInstance (0.0.1):
- boost
- DoubleConversion
- fast_float
- fmt
- glog
- hermes-engine
- RCT-Folly
- RCT-Folly/Fabric
- RCTRequired
- RCTTypeSafety
- React-Core
- React-RCTAppDelegate
- ReactAppDependencyProvider
- ReactCommon
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-hermes
- React-ImageManager
- React-jsi
- React-NativeModulesApple
- React-RCTFabric
- React-renderercss
- React-rendererdebug
- React-utils
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- SocketRocket
- Yoga
- React-NativeModulesApple (0.80.1):
- boost
- DoubleConversion
Expand Down Expand Up @@ -2553,7 +2577,7 @@ SPEC CHECKSUMS:
React-logger: 984ebd897afad067555d081deaf03f57c4315723
React-Mapbuffer: 0c045c844ce6d85cde53e85ab163294c6adad349
React-microtasksnativemodule: d9499269ad1f484ae71319bac1d9231447f2094e
React-MultInstance: 316d4720cde73e6462eced209c7916e2353135be
React-MultInstance: 84b1242d0fbc23770b2c534afc89ddc6235c13a6
React-NativeModulesApple: 983f3483ef0a3446b56d490f09d579fba2442e17
React-oscompat: 114036cd8f064558c9c1a0c04fc9ae5e1453706a
React-perflogger: e7287fee27c16e3c8bd4d470f2361572b63be16b
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"scripts": {
"ios": "bun run ios --filter=@apps/side-by-side",
"android": "bun run android --filter=@apps/side-by-side",
"lint": "eslint .",
"lint": "eslint . && bun --filter=react-native-multinstance lint",
"format": "eslint . --fix && bun --filter=react-native-multinstance format",
"test": "jest"
},
"devDependencies": {
Expand Down
95 changes: 95 additions & 0 deletions packages/react-native-multinstance/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Config from RN repo https://github.com/facebook/react-native/blob/main/.clang-format

---
AccessModifierOffset: -1
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ForEachMacros: [ FOR_EACH_RANGE, FOR_EACH, ]
IncludeCategories:
- Regex: '^<.*\.h(pp)?>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
QualifierAlignment: Left
---
Language: ObjC
ColumnLimit: 120
BreakBeforeBraces: WebKit
PointerAlignment: Right
...
21 changes: 12 additions & 9 deletions packages/react-native-multinstance/React-MultInstance.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ require "json"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))

header_search_paths = [
"\"$(PODS_TARGET_SRCROOT)/ReactCommon\"",
"\"$(PODS_ROOT)/Headers/Private/React-Core\"",
"\"$(PODS_ROOT)/Headers/Private/Yoga\"",
"\"$(PODS_ROOT)/Headers/Public/ReactCodegen\"",
]

Pod::Spec.new do |s|
s.name = "React-MultInstance"
s.version = package["version"]
Expand All @@ -12,14 +19,10 @@ Pod::Spec.new do |s|
s.platforms = { :ios => "12.4" }
s.source = { :git => "https://github.com/callstackincubator/react-native-multinstance.git", :tag => "#{s.version}" }
s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
s.dependency "React-Core"
s.dependency "React-RCTAppDelegate"
s.dependency "ReactAppDependencyProvider"
s.dependency "ReactCommon"
s.pod_target_xcconfig = {
"DEFINES_MODULE" => "YES",
"GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) FOLLY_NO_CONFIG FOLLY_CFG_NO_COROUTINES",
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
install_modules_dependencies(s)
s.pod_target_xcconfig = {
"HEADER_SEARCH_PATHS" => header_search_paths,
# "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
}
end
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#import <React-RCTAppDelegate/RCTDefaultReactNativeFactoryDelegate.h>
#import <React/RCTComponent.h>
#import <react/renderer/components/RNMultInstanceSpec/EventEmitters.h>

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -19,8 +20,9 @@ NS_ASSUME_NONNULL_BEGIN
*/
@interface SandboxReactNativeDelegate : RCTDefaultReactNativeFactoryDelegate

@property (nonatomic, copy, nullable) RCTDirectEventBlock onMessageHost;
@property (nonatomic, copy, nullable) RCTDirectEventBlock onErrorHost;
@property (nonatomic) std::shared_ptr<const facebook::react::SandboxReactNativeViewEventEmitter> eventEmitter;
@property (nonatomic, assign) BOOL hasOnMessageHandler;
@property (nonatomic, assign) BOOL hasOnErrorHandler;

/**
* Sets the list of allowed TurboModules for this sandbox instance.
Expand All @@ -37,9 +39,9 @@ NS_ASSUME_NONNULL_BEGIN

/**
* Posts a message to the JavaScript runtime.
* @param message Dictionary containing the message data
* @param message String containing the JSON.stringified message
*/
- (void)postMessage:(NSDictionary *)message;
- (void)postMessage:(NSString *)message;

@end

Expand Down
Loading
Loading