react-native-navigation 7.33.0 → 7.33.2

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.
package/jest-setup.js CHANGED
@@ -1,5 +1,26 @@
1
+ const RESET_MODULE_EXCEPTIONS = ['react', 'react-redux'];
2
+ const shonoActualRegistryCache = {};
3
+ RESET_MODULE_EXCEPTIONS.forEach((moduleName) => {
4
+ jest.doMock(
5
+ moduleName,
6
+ () => {
7
+ if (!shonoActualRegistryCache[moduleName]) {
8
+ shonoActualRegistryCache[moduleName] = jest.requireActual(moduleName);
9
+ }
10
+ return shonoActualRegistryCache[moduleName];
11
+ },
12
+ { virtual: true }
13
+ );
14
+ });
15
+
1
16
  const { mockDetox } = require('detox-testing-library-rnn-adapter');
2
17
 
18
+ jest.mock('react-native-gesture-handler', () => {
19
+ return {
20
+ gestureHandlerRootHOC: jest.fn(),
21
+ };
22
+ });
23
+
3
24
  mockDetox(() => require('./playground/index'));
4
25
 
5
26
  beforeEach(() => {
package/jest.config.js CHANGED
@@ -14,7 +14,7 @@ module.exports = {
14
14
  '<rootDir>/e2e/',
15
15
  '<rootDir>/autolink/',
16
16
  ],
17
- setupFilesAfterEnv: ['./jest-setup.js'],
17
+ setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect', './jest-setup.js'],
18
18
  testPathIgnorePatterns: ['/node_modules/'],
19
19
  moduleNameMapper: {
20
20
  'react-native-navigation/Mock': '<rootDir>/lib/Mock',
@@ -38,4 +38,5 @@ module.exports = {
38
38
  resetMocks: true,
39
39
  resetModules: true,
40
40
  coverageReporters: ['json', 'lcov', 'text', 'html'],
41
+ testEnvironment: 'node',
41
42
  };
@@ -46,7 +46,11 @@ export class NativeCommandsSender {
46
46
  }
47
47
 
48
48
  pop(commandId: string, componentId: string, _options?: object) {
49
- return new Promise((resolve) => {
49
+ return new Promise((resolve, reject) => {
50
+ if (!LayoutStore.getLayoutById(componentId)) {
51
+ reject(`Popping component failed - componentId '${componentId}' not found`);
52
+ return;
53
+ }
50
54
  const poppedChild = _.last(
51
55
  LayoutStore.getLayoutById(componentId).getStack().children
52
56
  ) as ComponentNode;
@@ -16,6 +16,7 @@ import androidx.annotation.Nullable;
16
16
  import androidx.annotation.VisibleForTesting;
17
17
  import androidx.coordinatorlayout.widget.CoordinatorLayout;
18
18
 
19
+ import com.reactnativenavigation.BuildConfig;
19
20
  import com.reactnativenavigation.options.Options;
20
21
  import com.reactnativenavigation.options.params.Bool;
21
22
  import com.reactnativenavigation.options.params.NullBool;
@@ -331,7 +332,19 @@ public abstract class ViewController<T extends ViewGroup> implements ViewTreeObs
331
332
 
332
333
  @Override
333
334
  public void onChildViewAdded(View parent, View child) {
334
- yellowBoxDelegate.onChildViewAdded(parent, child);
335
+ if (parent instanceof ViewGroup && child instanceof ViewGroup) {
336
+ ((ViewGroup) child).setOnHierarchyChangeListener(new ViewGroup.OnHierarchyChangeListener() {
337
+ @Override
338
+ public void onChildViewAdded(View parent, View child) {
339
+ yellowBoxDelegate.onChildViewAdded(parent, child);
340
+ }
341
+
342
+ @Override
343
+ public void onChildViewRemoved(View parent, View child) {
344
+
345
+ }
346
+ });
347
+ }
335
348
  }
336
349
 
337
350
  @Override
@@ -24,30 +24,23 @@ open class YellowBoxDelegate(private val context: Context, private val yellowBox
24
24
 
25
25
  open fun onChildViewAdded(parent: View, child: View?) {
26
26
  if (!context.isDebug()) return
27
- onYellowBoxAdded(child)
27
+ onYellowBoxAdded(parent, child)
28
28
  }
29
29
 
30
- fun onYellowBoxAdded(parent: View?) {
30
+ fun onYellowBoxAdded(parent: View?, child: View?) {
31
31
  if (isDestroyed) return
32
32
 
33
33
  this.parent = parent as ViewGroup
34
34
 
35
- parent.setOnHierarchyChangeListener(object : ViewGroup.OnHierarchyChangeListener {
36
- override fun onChildViewAdded(parent: View, child: View) {
37
- if (!yellowBoxHelper.isYellowBox(parent, child) && (isDestroyed || tempViews.contains(child))) return
38
- parent as ViewGroup
39
- for (i in 1 until parent.childCount) {
40
- yellowBoxViews.add(parent[i])
41
- parent.removeView(parent[i])
42
- var tempView = View(context)
43
- tempViews.add(tempView)
44
- parent.addView(tempView, i)
45
- }
46
- }
47
-
48
- override fun onChildViewRemoved(parent: View?, child: View?) {
49
- }
50
- })
35
+ if (!yellowBoxHelper.isYellowBox(parent, child) && (isDestroyed || tempViews.contains(child))) return
36
+ parent as ViewGroup
37
+ for (i in 1 until parent.childCount) {
38
+ yellowBoxViews.add(parent[i])
39
+ parent.removeView(parent[i])
40
+ var tempView = View(context)
41
+ tempViews.add(tempView)
42
+ parent.addView(tempView, i)
43
+ }
51
44
  }
52
45
 
53
46
  fun destroy() {
@@ -40,7 +40,11 @@ class NativeCommandsSender {
40
40
  });
41
41
  }
42
42
  pop(commandId, componentId, _options) {
43
- return new Promise((resolve) => {
43
+ return new Promise((resolve, reject) => {
44
+ if (!LayoutStore_1.LayoutStore.getLayoutById(componentId)) {
45
+ reject(`Popping component failed - componentId '${componentId}' not found`);
46
+ return;
47
+ }
44
48
  const poppedChild = lodash_1.default.last(LayoutStore_1.LayoutStore.getLayoutById(componentId).getStack().children);
45
49
  LayoutStore_1.LayoutStore.pop(componentId);
46
50
  resolve(poppedChild.nodeId);
@@ -6,12 +6,14 @@
6
6
  + (NSDictionary *)createWithFontFamily:(NSString *)fontFamily
7
7
  fontSize:(NSNumber *)fontSize
8
8
  fontWeight:(NSString *)fontWeight
9
- color:(UIColor *)color;
9
+ color:(UIColor *)color
10
+ centered:(BOOL)centered;
10
11
 
11
12
  + (NSDictionary *)createFromDictionary:(NSDictionary *)attributesDictionary
12
13
  fontFamily:(NSString *)fontFamily
13
14
  fontSize:(NSNumber *)fontSize
14
15
  fontWeight:(NSString *)fontWeight
15
- color:(UIColor *)color;
16
+ color:(UIColor *)color
17
+ centered:(BOOL)centered;
16
18
 
17
19
  @end
@@ -9,20 +9,23 @@
9
9
  + (NSDictionary *)createWithFontFamily:(NSString *)fontFamily
10
10
  fontSize:(NSNumber *)fontSize
11
11
  fontWeight:(NSString *)fontWeight
12
- color:(UIColor *)color {
12
+ color:(UIColor *)color
13
+ centered:(BOOL)centered {
13
14
  NSMutableDictionary *titleTextAttributes = [NSMutableDictionary new];
14
15
  return [self createFromDictionary:titleTextAttributes
15
16
  fontFamily:fontFamily
16
17
  fontSize:fontSize
17
18
  fontWeight:fontWeight
18
- color:color];
19
+ color:color
20
+ centered:centered];
19
21
  }
20
22
 
21
23
  + (NSDictionary *)createFromDictionary:(NSDictionary *)attributesDictionary
22
24
  fontFamily:(NSString *)fontFamily
23
25
  fontSize:(NSNumber *)fontSize
24
26
  fontWeight:(NSString *)fontWeight
25
- color:(UIColor *)color {
27
+ color:(UIColor *)color
28
+ centered:(BOOL)centered {
26
29
  NSMutableDictionary *titleTextAttributes =
27
30
  [NSMutableDictionary dictionaryWithDictionary:attributesDictionary];
28
31
  UIFont *currentFont = attributesDictionary[NSFontAttributeName];
@@ -36,7 +39,11 @@
36
39
  style:nil
37
40
  variant:nil
38
41
  scaleMultiplier:1.0];
39
- titleTextAttributes[NSParagraphStyleAttributeName] = NSParagraphStyle.defaultParagraphStyle;
42
+ NSMutableParagraphStyle *paragraphStyle = NSMutableParagraphStyle.new;
43
+ if (centered)
44
+ paragraphStyle.alignment = NSTextAlignmentCenter;
45
+
46
+ titleTextAttributes[NSParagraphStyleAttributeName] = paragraphStyle;
40
47
 
41
48
  return titleTextAttributes;
42
49
  }
@@ -5,7 +5,7 @@
5
5
  @implementation RNNTabBarItemCreator
6
6
 
7
7
  - (UITabBarItem *)createTabBarItem:(UITabBarItem *)mergeItem {
8
- return mergeItem ?: [UITabBarItem new];
8
+ return [UITabBarItem new];
9
9
  }
10
10
 
11
11
  - (UITabBarItem *)createTabBarItem:(RNNBottomTabOptions *)bottomTabOptions
@@ -96,7 +96,8 @@
96
96
  fontFamily:fontFamily
97
97
  fontSize:fontSize
98
98
  fontWeight:fontWeight
99
- color:textColor];
99
+ color:textColor
100
+ centered:NO];
100
101
  [self setTitleAttributes:tabItem titleAttributes:normalAttributes];
101
102
 
102
103
  NSDictionary *selectedAttributes = [RNNFontAttributesCreator
@@ -104,7 +105,8 @@
104
105
  fontFamily:fontFamily
105
106
  fontSize:fontSize
106
107
  fontWeight:fontWeight
107
- color:selectedTextColor];
108
+ color:selectedTextColor
109
+ centered:NO];
108
110
  [self setSelectedTitleAttributes:tabItem selectedTitleAttributes:selectedAttributes];
109
111
  }
110
112
 
@@ -111,7 +111,7 @@
111
111
  subtitleFrame.origin.y = subtitleFrame.size.height;
112
112
 
113
113
  UILabel *subtitleLabel = [[UILabel alloc] initWithFrame:subtitleFrame];
114
- subtitleLabel.textAlignment = NSTextAlignmentCenter;
114
+
115
115
  subtitleLabel.backgroundColor = [UIColor clearColor];
116
116
  subtitleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
117
117
 
@@ -119,7 +119,8 @@
119
119
  [RNNFontAttributesCreator createWithFontFamily:[_subtitleOptions.fontFamily withDefault:nil]
120
120
  fontSize:[_subtitleOptions.fontSize withDefault:@(12)]
121
121
  fontWeight:[_subtitleOptions.fontWeight withDefault:nil]
122
- color:[_subtitleOptions.color withDefault:nil]];
122
+ color:[_subtitleOptions.color withDefault:nil]
123
+ centered:YES];
123
124
  [subtitleLabel setAttributedText:[[NSAttributedString alloc] initWithString:self.subtitle
124
125
  attributes:fontAttributes]];
125
126
 
@@ -128,7 +129,7 @@
128
129
  labelframe.size = labelSize;
129
130
  subtitleLabel.frame = labelframe;
130
131
  [subtitleLabel sizeToFit];
131
-
132
+ subtitleLabel.textAlignment = NSTextAlignmentCenter;
132
133
  if (_subtitleOptions.color.hasValue) {
133
134
  UIColor *color = _subtitleOptions.color.get;
134
135
  subtitleLabel.textColor = color;
@@ -145,7 +146,6 @@
145
146
  titleFrame.size.height /= 2;
146
147
  }
147
148
  UILabel *titleLabel = [[UILabel alloc] initWithFrame:titleFrame];
148
- titleLabel.textAlignment = NSTextAlignmentCenter;
149
149
  titleLabel.backgroundColor = [UIColor clearColor];
150
150
 
151
151
  titleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
@@ -154,7 +154,8 @@
154
154
  [RNNFontAttributesCreator createWithFontFamily:[_titleOptions.fontFamily withDefault:nil]
155
155
  fontSize:[_titleOptions.fontSize withDefault:@(16)]
156
156
  fontWeight:[_titleOptions.fontWeight withDefault:nil]
157
- color:[_subtitleOptions.color withDefault:nil]];
157
+ color:[_subtitleOptions.color withDefault:nil]
158
+ centered:YES];
158
159
  [titleLabel setAttributedText:[[NSAttributedString alloc] initWithString:self.title
159
160
  attributes:fontAttributes]];
160
161
 
@@ -176,7 +176,8 @@
176
176
  createWithFontFamily:[button.fontFamily withDefault:nil]
177
177
  fontSize:[button.fontSize withDefault:@(17)]
178
178
  fontWeight:[button.fontWeight withDefault:nil]
179
- color:button.color.get]];
179
+ color:button.color.get
180
+ centered:NO]];
180
181
 
181
182
  [self setTitleTextAttributes:textAttributes forState:UIControlStateNormal];
182
183
  [self setTitleTextAttributes:textAttributes forState:UIControlStateHighlighted];
@@ -188,7 +189,8 @@
188
189
  createWithFontFamily:[button.fontFamily withDefault:nil]
189
190
  fontSize:[button.fontSize withDefault:@(17)]
190
191
  fontWeight:[button.fontWeight withDefault:nil]
191
- color:[button.disabledColor withDefault:nil]]];
192
+ color:[button.disabledColor withDefault:nil]
193
+ centered:NO]];
192
194
 
193
195
  [self setTitleTextAttributes:disabledTextAttributes forState:UIControlStateDisabled];
194
196
  }
@@ -145,7 +145,8 @@
145
145
  fontFamily:fontFamily
146
146
  fontSize:fontSize
147
147
  fontWeight:fontWeight
148
- color:fontColor];
148
+ color:fontColor
149
+ centered:YES];
149
150
 
150
151
  self.getAppearance.titleTextAttributes = titleTextAttributes;
151
152
  self.getScrollEdgeAppearance.titleTextAttributes = titleTextAttributes;
@@ -161,7 +162,8 @@
161
162
  fontFamily:fontFamily
162
163
  fontSize:fontSize
163
164
  fontWeight:fontWeight
164
- color:fontColor];
165
+ color:fontColor
166
+ centered:NO];
165
167
  self.getAppearance.largeTitleTextAttributes = largeTitleTextAttributes;
166
168
  self.getScrollEdgeAppearance.largeTitleTextAttributes = largeTitleTextAttributes;
167
169
  }
@@ -112,7 +112,8 @@
112
112
  fontFamily:fontFamily
113
113
  fontSize:fontSize
114
114
  fontWeight:fontWeight
115
- color:fontColor];
115
+ color:fontColor
116
+ centered:YES];
116
117
  }
117
118
 
118
119
  - (void)setLargeTitleAttributes:(RNNLargeTitleOptions *)largeTitleOptions {
@@ -126,7 +127,8 @@
126
127
  fontFamily:fontFamily
127
128
  fontSize:fontSize
128
129
  fontWeight:fontWeight
129
- color:fontColor];
130
+ color:fontColor
131
+ centered:NO];
130
132
  }
131
133
 
132
134
  - (void)componentDidAppear {
package/metro.config.js CHANGED
@@ -1,15 +1,4 @@
1
1
  module.exports = {
2
- projectRoot: `${__dirname}/playground`,
2
+ projectRoot: `${__dirname}`,
3
3
  watchFolders: [__dirname],
4
- resolver: {
5
- sourceExts: ['ts', 'tsx', 'js'],
6
- },
7
- transformer: {
8
- getTransformOptions: async () => ({
9
- transform: {
10
- experimentalImportSupport: false,
11
- inlineRequires: false,
12
- },
13
- }),
14
- },
15
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-navigation",
3
- "version": "7.33.0",
3
+ "version": "7.33.2",
4
4
  "description": "React Native Navigation - truly native navigation for iOS and Android",
5
5
  "license": "MIT",
6
6
  "nativePackage": true,
@@ -67,17 +67,17 @@
67
67
  "tslib": "1.9.3"
68
68
  },
69
69
  "devDependencies": {
70
- "@babel/core": "7.15.8",
70
+ "@babel/core": "^7.20.0",
71
71
  "@babel/plugin-proposal-export-default-from": "7.10.1",
72
72
  "@babel/plugin-proposal-export-namespace-from": "7.10.1",
73
- "@babel/runtime": "7.15.4",
73
+ "@babel/runtime": "^7.20.0",
74
74
  "@babel/types": "7.15.6",
75
75
  "@react-native-community/blur": "^3.6.0",
76
76
  "@react-native-community/datetimepicker": "^3.4.7",
77
77
  "@react-native-community/eslint-config": "2.0.0",
78
78
  "@react-native-community/netinfo": "^5.9.4",
79
- "@testing-library/jest-native": "^4.0.1",
80
- "@testing-library/react-native": "^7.2.0",
79
+ "@testing-library/jest-native": "^5.4.2",
80
+ "@testing-library/react-native": "^12.0.1",
81
81
  "@types/detox": "17.14.3",
82
82
  "@types/hoist-non-react-statics": "^3.0.1",
83
83
  "@types/jasmine": "3.5.10",
@@ -88,9 +88,9 @@
88
88
  "@types/react-test-renderer": "16.9.2",
89
89
  "@typescript-eslint/eslint-plugin": "4.33.0",
90
90
  "@typescript-eslint/parser": "4.33.0",
91
- "babel-jest": "^26.6.3",
91
+ "babel-jest": "^29.5.0",
92
92
  "clang-format": "^1.4.0",
93
- "detox": "19.12.1",
93
+ "detox": "20.9.0",
94
94
  "detox-testing-library-rnn-adapter": "2.x.x",
95
95
  "eslint": "7.32.0",
96
96
  "eslint-config-prettier": "6.11.0",
@@ -98,20 +98,20 @@
98
98
  "github-release-notes": "https://github.com/yogevbd/github-release-notes/tarball/e601b3dba72dcd6cba323c1286ea6dd0c0110b58",
99
99
  "husky": "4.2.5",
100
100
  "identity-obj-proxy": "3.0.0",
101
- "jest": "^26.6.3",
101
+ "jest": "^27.5.1",
102
102
  "lint-staged": "10.2.11",
103
103
  "metro-react-native-babel-preset": "^0.70.3",
104
104
  "pixelmatch": "^5.2.1",
105
105
  "pngjs": "^6.0.0",
106
106
  "prettier": "2.1.2",
107
- "react": "18.0.0",
108
- "react-native": "0.69.7",
109
- "react-native-fast-image": "^8.3.4",
110
- "react-native-gesture-handler": "^1.6.1",
111
- "react-native-reanimated": "2.10.0",
112
- "react-native-ui-lib": "6.21.0",
107
+ "react": "18.2.0",
108
+ "react-native": "0.71.8",
109
+ "react-native-fast-image": "^8.6.3",
110
+ "react-native-gesture-handler": "^2.10.1",
111
+ "react-native-reanimated": "2.14.1",
112
+ "react-native-ui-lib": "7.3.6",
113
113
  "react-redux": "5.x.x",
114
- "react-test-renderer": "18.0.0",
114
+ "react-test-renderer": "18.2.0",
115
115
  "redux": "3.x.x",
116
116
  "remx": "3.x.x",
117
117
  "semver": "5.x.x",