Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
react-native-shared-bridge
Advanced tools
A manager to share an RCTBridge across the application.
A manager to share an RCTBridge
across the application. The shared bridge manager is responsible for injecting the React Native bundle and creating RCTRooViews
s which rendering React Native components and can be used as a root view of a UIViewController
.
This project is currently in beta.
Core APIs are subject to change. We encourage people to try this library out and provide us feedback as we get it to a stable state.
$ npm install react-native-shared-bridge --save
$ react-native link react-native-shared-bridge
Libraries
➜ Add Files to [your project's name]
node_modules
➜ react-native-shared-bridge
and add MSRSharedBridge.xcodeproj
libMSRSharedBridge.a
to your project's Build Phases
➜ Link Binary With Libraries
Cmd+R
)<android/app/src/main/java/[...]/MainApplication.java
import net.mischneider.MSRSharedBridgePackage;
to the imports at the top of the filenew MSRSharedBridgePackage()
to the list returned by the getPackages()
methodandroid/settings.gradle
:
include ':react-native-shared-bridge'
project(':react-native-shared-bridge').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-shared-bridge/android')
android/app/build.gradle
:
compile project(':react-native-shared-bridge')
The following example shows how to use MSRSharedBaridge
to create root views for a MSRReactNativeViewController
which is responsible for showing a React Native component.
@interface MSRReactNativeViewController ()
@property (nonatomic, copy) NSString *moduleName;
@property (nonatomic, copy) NSDictionary<NSString *, id> *initialProperties;
@end
@implementation MSRReactNativeViewController
#pragma mark - Lifecycle
- (instancetype)initWithModuleName:(NSString *)moduleName initialProperties:(NSDictionary<NSString *, id> *)initialProperties
{
self = [super initWithNibName:nil bundle:nil];
if (self != nil) {
_moduleName = [moduleName copy];
_initialProperties = [initialProperties copy];
}
return self;
}
RCT_NOT_IMPLEMENTED(-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil)
RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder:(nonnull NSCoder *)aDecoder)
#pragma mark - UIViewController
- (void)loadView
{
// Uses the shared bridge to set the root view
self.view = [MSRSharedBridge.sharedBridge viewForModuleName:self.moduleName initialProperties:self.initialProperties];
}
@end
Copyright 2018 Michael Schneider
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
FAQs
A manager to share an RCTBridge across the application.
We found that react-native-shared-bridge demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.