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 3.0.0 to 3.1.0

42

index.js
import React, { Component, cloneElement } from 'react';
import { StyleSheet, View, AppRegistry } from 'react-native';
import StaticContainer from 'static-container';
import { Provider } from 'react-redux';

@@ -33,9 +34,13 @@ const styles = StyleSheet.create({

_siblings = {};
_stores = {};
_update = (id, element, callback) => {
_update = (id, element, callback, store) => {
const siblings = { ...this._siblings };
const stores = { ...this._stores };
if (siblings[id] && !element) {
delete siblings[id];
delete stores[id];
} else if (element) {
siblings[id] = element;
stores[id] = store;
}

@@ -45,2 +50,3 @@

this._siblings = siblings;
this._stores = stores;
this.forceUpdate(callback);

@@ -51,13 +57,23 @@ };

const siblings = this._siblings;
const stores = this._stores;
const elements = [];
Object.keys(siblings).forEach((key) => {
const element = siblings[key];
element && elements.push(
<StaticContainer
key={`root-sibling-${key}`}
shouldUpdate={!!this._updatedSiblings[key]}
>
{element}
</StaticContainer>
);
if (element) {
const sibling = (
<StaticContainer
key={`root-sibling-${key}`}
shouldUpdate={!!this._updatedSiblings[key]}
>
{element}
</StaticContainer>
);
const store = stores[key];
elements.push(store ? (
<Provider store={store} key={`root-sibling-${key}-provider`}>
{sibling}
</Provider>
) : sibling);
}
});

@@ -78,7 +94,7 @@ this._updatedSiblings = {};

export default class {
constructor(element, callback) {
constructor(element, callback, store) {
const id = uuid++;
function update(element, callback) {
function update(element, callback, store) {
triggers.forEach(function (trigger) {
trigger(id, element, callback);
trigger(id, element, callback, store);
});

@@ -93,3 +109,3 @@ };

update(element, callback);
update(element, callback, store);
this.update = update;

@@ -96,0 +112,0 @@ this.destroy = destroy;

{
"version": "3.0.0",
"version": "3.1.0",
"name": "react-native-root-siblings",

@@ -11,3 +11,4 @@ "repository": {

"dependencies": {
"static-container": "^1.0.0"
"static-container": "^1.0.0",
"react-redux": "*"
},

@@ -14,0 +15,0 @@ "keywords": [

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