react-native-navigation 7.23.1-snapshot.310 → 7.23.1-snapshot.315

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -250,9 +250,9 @@ open class TopBarController(private val animator: TopBarAnimator = TopBarAnimato
250
250
  }
251
251
  toRemove.forEach {
252
252
  buttonBar.removeButton(it.value.buttonIntId)
253
- btnControllers.remove(it.key)
254
253
  }
255
254
  toDestroy.values.forEach {
255
+ btnControllers.remove(it.id)
256
256
  it.destroy()
257
257
  }
258
258
  toAdd.forEach {
@@ -21,7 +21,7 @@ class LayoutTreeCrawler {
21
21
  node.data.passProps = undefined;
22
22
  }
23
23
  savePropsToStore(node) {
24
- this.store.updateProps(node.id, node.data.passProps);
24
+ this.store.setPendingProps(node.id, node.data.passProps);
25
25
  }
26
26
  assertComponentDataName(component) {
27
27
  if (!component.data.name) {
@@ -140,7 +140,7 @@ class OptionsProcessor {
140
140
  if (endsWith_1.default(key, 'Buttons')) {
141
141
  forEach_1.default(value, (button) => {
142
142
  if (button.passProps && button.id) {
143
- this.store.updateProps(button.id, button.passProps);
143
+ this.store.setPendingProps(button.id, button.passProps);
144
144
  button.passProps = undefined;
145
145
  }
146
146
  });
@@ -151,7 +151,7 @@ class OptionsProcessor {
151
151
  value.componentId = value.id ? value.id : this.uniqueIdProvider.generate('CustomComponent');
152
152
  this.store.ensureClassForName(value.name);
153
153
  if (value.passProps) {
154
- this.store.updateProps(value.componentId, value.passProps);
154
+ this.store.setPendingProps(value.componentId, value.passProps);
155
155
  }
156
156
  options[key].passProps = undefined;
157
157
  }
@@ -4,10 +4,12 @@ import { IWrappedComponent } from './ComponentWrapper';
4
4
  export declare class Store {
5
5
  private componentsByName;
6
6
  private propsById;
7
+ private pendingPropsById;
7
8
  private componentsInstancesById;
8
9
  private wrappedComponents;
9
10
  private lazyRegistratorFn;
10
11
  updateProps(componentId: string, props: any, callback?: () => void): void;
12
+ setPendingProps(componentId: string, newProps: any): void;
11
13
  getPropsForId(componentId: string): any;
12
14
  mergeNewPropsForId(componentId: string, newProps: any): void;
13
15
  clearComponent(componentId: string): void;
@@ -5,6 +5,7 @@ class Store {
5
5
  constructor() {
6
6
  this.componentsByName = {};
7
7
  this.propsById = {};
8
+ this.pendingPropsById = {};
8
9
  this.componentsInstancesById = {};
9
10
  this.wrappedComponents = {};
10
11
  }
@@ -15,7 +16,14 @@ class Store {
15
16
  component.setProps(props, callback);
16
17
  }
17
18
  }
19
+ setPendingProps(componentId, newProps) {
20
+ this.pendingPropsById[componentId] = newProps;
21
+ }
18
22
  getPropsForId(componentId) {
23
+ if (this.pendingPropsById[componentId]) {
24
+ this.propsById[componentId] = this.pendingPropsById[componentId];
25
+ delete this.pendingPropsById[componentId];
26
+ }
19
27
  return this.propsById[componentId] || {};
20
28
  }
21
29
  mergeNewPropsForId(componentId, newProps) {
@@ -35,7 +35,7 @@ export class LayoutTreeCrawler {
35
35
  }
36
36
 
37
37
  private savePropsToStore(node: LayoutNode) {
38
- this.store.updateProps(node.id, node.data.passProps);
38
+ this.store.setPendingProps(node.id, node.data.passProps);
39
39
  }
40
40
 
41
41
  private assertComponentDataName(component: LayoutNode) {
@@ -200,7 +200,7 @@ export class OptionsProcessor {
200
200
  if (endsWith(key, 'Buttons')) {
201
201
  forEach(value, (button) => {
202
202
  if (button.passProps && button.id) {
203
- this.store.updateProps(button.id, button.passProps);
203
+ this.store.setPendingProps(button.id, button.passProps);
204
204
  button.passProps = undefined;
205
205
  }
206
206
  });
@@ -212,7 +212,7 @@ export class OptionsProcessor {
212
212
  value.componentId = value.id ? value.id : this.uniqueIdProvider.generate('CustomComponent');
213
213
  this.store.ensureClassForName(value.name);
214
214
  if (value.passProps) {
215
- this.store.updateProps(value.componentId, value.passProps);
215
+ this.store.setPendingProps(value.componentId, value.passProps);
216
216
  }
217
217
  options[key].passProps = undefined;
218
218
  }
@@ -5,6 +5,7 @@ import { IWrappedComponent } from './ComponentWrapper';
5
5
  export class Store {
6
6
  private componentsByName: Record<string, ComponentProvider> = {};
7
7
  private propsById: Record<string, any> = {};
8
+ private pendingPropsById: Record<string, any> = {};
8
9
  private componentsInstancesById: Record<string, IWrappedComponent> = {};
9
10
  private wrappedComponents: Record<string, React.ComponentClass<any>> = {};
10
11
  private lazyRegistratorFn: ((lazyComponentRequest: string | number) => void) | undefined;
@@ -18,7 +19,15 @@ export class Store {
18
19
  }
19
20
  }
20
21
 
22
+ setPendingProps(componentId: string, newProps: any) {
23
+ this.pendingPropsById[componentId] = newProps;
24
+ }
25
+
21
26
  getPropsForId(componentId: string) {
27
+ if (this.pendingPropsById[componentId]) {
28
+ this.propsById[componentId] = this.pendingPropsById[componentId];
29
+ delete this.pendingPropsById[componentId];
30
+ }
22
31
  return this.propsById[componentId] || {};
23
32
  }
24
33
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-navigation",
3
- "version": "7.23.1-snapshot.310",
3
+ "version": "7.23.1-snapshot.315",
4
4
  "description": "React Native Navigation - truly native navigation for iOS and Android",
5
5
  "license": "MIT",
6
6
  "nativePackage": true,