New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-root-siblings

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-root-siblings - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

109

lib/AppRegistryInjection.js

@@ -13,65 +13,70 @@ import { StyleSheet, View, AppRegistry } from 'react-native';

const emitter = new EventEmitter();
let emitter = AppRegistry.rootSiblingsEmitter;
// inject modals into app entry component
const originRegister = AppRegistry.registerComponent;
if (!(emitter instanceof EventEmitter)) {
emitter = new EventEmitter();
// inject modals into app entry component
const originRegister = AppRegistry.registerComponent;
AppRegistry.registerComponent = function (appKey, getAppComponent) {
const siblings = new Map();
const updates = new Set();
AppRegistry.registerComponent = function (appKey, getAppComponent) {
const siblings = new Map();
const updates = new Set();
return originRegister(appKey, function () {
const OriginAppComponent = getAppComponent();
return originRegister(appKey, function () {
const OriginAppComponent = getAppComponent();
return class extends Component {
static displayName = `Root(${appKey})`;
return class extends Component {
static displayName = `Root(${appKey})`;
componentWillMount() {
this._update = this._update.bind(this);
emitter.addListener('siblings.update', this._update);
};
componentWillMount() {
this._update = this._update.bind(this);
emitter.addListener('siblings.update', this._update);
};
componentWillUnmount() {
emitter.removeListener('siblings.update', this._update);
siblings.clear();
updates.clear();
};
componentWillUnmount() {
emitter.removeListener('siblings.update', this._update);
siblings.clear();
updates.clear();
};
_update(id, element, callback) {
if (siblings.has(id) && !element) {
siblings.delete(id);
} else {
siblings.set(id, element);
}
updates.add(id);
this.forceUpdate(callback);
};
_update(id, element, callback) {
if (siblings.has(id) && !element) {
siblings.delete(id);
} else {
siblings.set(id, element);
}
updates.add(id);
this.forceUpdate(callback);
};
render() {
const elements = [];
siblings.forEach((element, id) => {
elements.push(
<StaticContainer
key={`root-sibling-${id}`}
shouldUpdate={updates.has(id)}
>
{element}
</StaticContainer>
render() {
const elements = [];
siblings.forEach((element, id) => {
elements.push(
<StaticContainer
key={`root-sibling-${id}`}
shouldUpdate={updates.has(id)}
>
{element}
</StaticContainer>
);
});
updates.clear();
return (
<View style={styles.container}>
<StaticContainer shouldUpdate={false}>
<OriginAppComponent {...this.props} />
</StaticContainer>
{elements}
</View>
);
});
updates.clear();
return (
<View style={styles.container}>
<StaticContainer shouldUpdate={false}>
<OriginAppComponent {...this.props} />
</StaticContainer>
{elements}
</View>
);
};
};
};
});
};
});
};
AppRegistry.rootSiblingsEmitter = emitter;
}
export default emitter;
{
"version": "1.2.0",
"version": "1.2.1",
"name": "react-native-root-siblings",

@@ -4,0 +4,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc