react-native-navigation 7.33.4 → 7.35.0
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/index.e2e.js +4 -0
- package/jest-setup.js +2 -0
- package/lib/Mock/Layouts/ComponentNode.ts +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/MotionEvent.kt +17 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleAndButtonsContainer.kt +4 -0
- package/lib/android/app/src/reactNative51/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +1 -0
- package/lib/android/app/src/reactNative55/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +1 -0
- package/lib/android/app/src/reactNative56/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +1 -0
- package/lib/android/app/src/reactNative57/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +1 -0
- package/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +1 -0
- package/lib/android/app/src/reactNative60/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +1 -0
- package/lib/android/app/src/reactNative62/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +1 -0
- package/lib/android/app/src/reactNative63/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +1 -0
- package/lib/android/app/src/reactNative68/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +1 -0
- package/lib/android/app/src/reactNative71/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +10 -54
- package/lib/dist/Mock/Layouts/ComponentNode.js +1 -1
- package/lib/dist/src/interfaces/NavigationComponent.d.ts +2 -2
- package/lib/dist/src/interfaces/NavigationComponentProps.d.ts +6 -0
- package/lib/dist/src/interfaces/NavigationFunctionComponent.d.ts +3 -3
- package/lib/ios/RNNBridgeModule.m +5 -1
- package/lib/src/interfaces/NavigationComponent.ts +2 -2
- package/lib/src/interfaces/NavigationComponentProps.ts +7 -0
- package/lib/src/interfaces/NavigationFunctionComponent.ts +3 -3
- package/package.json +11 -6
package/index.e2e.js
ADDED
package/jest-setup.js
CHANGED
|
@@ -13,7 +13,7 @@ export default class ComponentNode extends ParentNode {
|
|
|
13
13
|
|
|
14
14
|
public componentDidMount() {
|
|
15
15
|
this.componentDidMountOnce = true;
|
|
16
|
-
this.componentDidAppearPending && this.componentDidAppear();
|
|
16
|
+
this.componentDidAppearPending && setImmediate(() => this.componentDidAppear());
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
public componentDidAppear() {
|
|
@@ -3,11 +3,25 @@ package com.reactnativenavigation.utils
|
|
|
3
3
|
import android.graphics.Rect
|
|
4
4
|
import android.view.MotionEvent
|
|
5
5
|
import android.view.View
|
|
6
|
+
import android.view.ViewGroup
|
|
7
|
+
import com.reactnativenavigation.BuildConfig
|
|
6
8
|
|
|
7
9
|
val hitRect = Rect()
|
|
8
10
|
|
|
9
11
|
fun MotionEvent.coordinatesInsideView(view: View?): Boolean {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
if (BuildConfig.REACT_NATVE_VERSION_MINOR < 71) {
|
|
13
|
+
view ?: return false
|
|
14
|
+
view.getHitRect(hitRect)
|
|
15
|
+
return hitRect.contains(x.toInt(), y.toInt())
|
|
16
|
+
} else {
|
|
17
|
+
val viewGroup = (view as? ViewGroup)?.getChildAt(0) as? ViewGroup ?: return false
|
|
18
|
+
|
|
19
|
+
return if (viewGroup.childCount > 0) {
|
|
20
|
+
val content = viewGroup.getChildAt(0)
|
|
21
|
+
content.getHitRect(hitRect)
|
|
22
|
+
hitRect.contains(x.toInt(), y.toInt())
|
|
23
|
+
} else {
|
|
24
|
+
false
|
|
25
|
+
}
|
|
26
|
+
}
|
|
13
27
|
}
|
|
@@ -153,6 +153,10 @@ class TitleAndButtonsContainer(context: Context) : ViewGroup(context) {
|
|
|
153
153
|
val isCenter = titleComponentAlignment == Alignment.Center
|
|
154
154
|
val titleHeightMeasureSpec = MeasureSpec.makeMeasureSpec(containerHeight, MeasureSpec.AT_MOST)
|
|
155
155
|
val titleWidthMeasureSpec = makeTitleAtMostWidthMeasureSpec(containerWidth, rightBarWidth, leftBarWidth, isCenter)
|
|
156
|
+
if (titleComponent is TitleBarReactView) {
|
|
157
|
+
titleComponent.centered = isCenter
|
|
158
|
+
}
|
|
159
|
+
|
|
156
160
|
titleComponent.measure(titleWidthMeasureSpec, titleHeightMeasureSpec)
|
|
157
161
|
}
|
|
158
162
|
|
|
@@ -9,6 +9,7 @@ import com.reactnativenavigation.react.ReactView
|
|
|
9
9
|
@SuppressLint("ViewConstructor")
|
|
10
10
|
class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
|
|
11
11
|
componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
|
|
12
|
+
var centered: Boolean = false
|
|
12
13
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
13
14
|
super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec)
|
|
14
15
|
}
|
|
@@ -9,6 +9,7 @@ import com.reactnativenavigation.react.ReactView
|
|
|
9
9
|
@SuppressLint("ViewConstructor")
|
|
10
10
|
class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
|
|
11
11
|
componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
|
|
12
|
+
var centered: Boolean = false
|
|
12
13
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
13
14
|
super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec)
|
|
14
15
|
}
|
|
@@ -9,6 +9,7 @@ import com.reactnativenavigation.react.ReactView
|
|
|
9
9
|
@SuppressLint("ViewConstructor")
|
|
10
10
|
class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
|
|
11
11
|
componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
|
|
12
|
+
var centered: Boolean = false
|
|
12
13
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
13
14
|
super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec)
|
|
14
15
|
}
|
|
@@ -9,6 +9,7 @@ import com.reactnativenavigation.react.ReactView
|
|
|
9
9
|
@SuppressLint("ViewConstructor")
|
|
10
10
|
class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
|
|
11
11
|
componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
|
|
12
|
+
var centered: Boolean = false
|
|
12
13
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
13
14
|
super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec)
|
|
14
15
|
}
|
|
@@ -9,6 +9,7 @@ import com.reactnativenavigation.react.ReactView
|
|
|
9
9
|
@SuppressLint("ViewConstructor")
|
|
10
10
|
class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
|
|
11
11
|
componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
|
|
12
|
+
var centered: Boolean = false
|
|
12
13
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
13
14
|
super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec)
|
|
14
15
|
}
|
|
@@ -9,6 +9,7 @@ import com.reactnativenavigation.react.ReactView
|
|
|
9
9
|
@SuppressLint("ViewConstructor")
|
|
10
10
|
class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
|
|
11
11
|
componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
|
|
12
|
+
var centered: Boolean = false
|
|
12
13
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
13
14
|
super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec)
|
|
14
15
|
}
|
|
@@ -9,6 +9,7 @@ import com.reactnativenavigation.react.ReactView
|
|
|
9
9
|
@SuppressLint("ViewConstructor")
|
|
10
10
|
class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
|
|
11
11
|
componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
|
|
12
|
+
var centered: Boolean = false
|
|
12
13
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
13
14
|
super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec)
|
|
14
15
|
}
|
|
@@ -9,6 +9,7 @@ import com.reactnativenavigation.react.ReactView
|
|
|
9
9
|
@SuppressLint("ViewConstructor")
|
|
10
10
|
class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
|
|
11
11
|
componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
|
|
12
|
+
var centered: Boolean = false
|
|
12
13
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
13
14
|
super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec)
|
|
14
15
|
}
|
|
@@ -9,6 +9,7 @@ import com.reactnativenavigation.react.ReactView
|
|
|
9
9
|
@SuppressLint("ViewConstructor")
|
|
10
10
|
class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
|
|
11
11
|
componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
|
|
12
|
+
var centered: Boolean = false
|
|
12
13
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
13
14
|
super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec)
|
|
14
15
|
}
|
|
@@ -11,61 +11,17 @@ import com.reactnativenavigation.react.ReactView
|
|
|
11
11
|
@SuppressLint("ViewConstructor")
|
|
12
12
|
class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?,
|
|
13
13
|
componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) {
|
|
14
|
+
var centered: Boolean = false
|
|
14
15
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// See for more details https://github.com/wix/react-native-navigation/pull/7096
|
|
24
|
-
val measuredWidth = this.getLastRootViewChildMaxWidth()
|
|
25
|
-
|
|
26
|
-
return MeasureSpec.makeMeasureSpec(measuredWidth, MeasureSpec.EXACTLY)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
private fun interceptReactRootViewMeasureSpecHeight(heightMeasureSpec: Int): Int {
|
|
30
|
-
// This is a HACK.
|
|
31
|
-
// ReactRootView has problematic behavior when setting width to WRAP_CONTENT,
|
|
32
|
-
// It's causing infinite measurements, that hung up the UI.
|
|
33
|
-
// Intercepting largest child by height, and use its height as (parent) ReactRootView width fixed that.
|
|
34
|
-
// See for more details https://github.com/wix/react-native-navigation/pull/7096
|
|
35
|
-
val measuredHeight = this.getLastRootViewChild()?.height
|
|
36
|
-
|
|
37
|
-
return if (measuredHeight != null) MeasureSpec.makeMeasureSpec(measuredHeight, MeasureSpec.EXACTLY) else
|
|
38
|
-
heightMeasureSpec
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
private fun getLastRootViewChildMaxWidth(): Int {
|
|
42
|
-
if (rootViewGroup.children.count() == 0) {
|
|
43
|
-
return 0
|
|
44
|
-
}
|
|
45
|
-
var maxWidth = rootViewGroup.width
|
|
46
|
-
var next = rootViewGroup as Any
|
|
47
|
-
while(next is ViewGroup) { //try {
|
|
48
|
-
if (next.width > maxWidth) {
|
|
49
|
-
maxWidth = next.width
|
|
50
|
-
}
|
|
51
|
-
if (next.children.count() == 0) break
|
|
52
|
-
next.children.first().also { next = it }
|
|
53
|
-
}
|
|
54
|
-
return maxWidth
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
private fun getLastRootViewChild(): View? {
|
|
58
|
-
if (rootViewGroup.children.count() == 0) {
|
|
59
|
-
return null
|
|
60
|
-
}
|
|
61
|
-
var rootViewGroupLastChild: View = rootViewGroup
|
|
62
|
-
var next = rootViewGroup as Any
|
|
63
|
-
while(next is ViewGroup) { //try {
|
|
64
|
-
rootViewGroupLastChild = next
|
|
65
|
-
if (next.children.count() == 0) break
|
|
66
|
-
next.children.first().also { next = it }
|
|
16
|
+
var titleHeightMeasureSpec: Int
|
|
17
|
+
var titleWidthMeasureSpec: Int
|
|
18
|
+
if (centered) {
|
|
19
|
+
titleHeightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)
|
|
20
|
+
titleWidthMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)
|
|
21
|
+
} else {
|
|
22
|
+
titleHeightMeasureSpec = heightMeasureSpec
|
|
23
|
+
titleWidthMeasureSpec = widthMeasureSpec
|
|
67
24
|
}
|
|
68
|
-
|
|
69
|
-
return rootViewGroupLastChild
|
|
25
|
+
super.onMeasure(titleWidthMeasureSpec, titleHeightMeasureSpec)
|
|
70
26
|
}
|
|
71
27
|
}
|
|
@@ -12,7 +12,7 @@ class ComponentNode extends ParentNode_1.default {
|
|
|
12
12
|
}
|
|
13
13
|
componentDidMount() {
|
|
14
14
|
this.componentDidMountOnce = true;
|
|
15
|
-
this.componentDidAppearPending && this.componentDidAppear();
|
|
15
|
+
this.componentDidAppearPending && setImmediate(() => this.componentDidAppear());
|
|
16
16
|
}
|
|
17
17
|
componentDidAppear() {
|
|
18
18
|
if (this.componentDidMountOnce) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { NavigationButtonPressedEvent, SearchBarUpdatedEvent, SearchBarCancelPressedEvent, PreviewCompletedEvent, ScreenPoppedEvent, ComponentWillAppearEvent, ComponentDidAppearEvent, ComponentDidDisappearEvent } from './ComponentEvents';
|
|
3
|
-
import {
|
|
3
|
+
import { NavigationProps } from './NavigationComponentProps';
|
|
4
4
|
import { Options } from './Options';
|
|
5
|
-
export declare class NavigationComponent<Props = {}, State = {}, Snapshot = any> extends React.Component<Props &
|
|
5
|
+
export declare class NavigationComponent<Props = {}, State = {}, Snapshot = any> extends React.Component<Props & NavigationProps, State, Snapshot> {
|
|
6
6
|
/**
|
|
7
7
|
* Options used to apply a style configuration when the screen appears.
|
|
8
8
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { NavigationProps } from './NavigationComponentProps';
|
|
3
3
|
import { Options } from './Options';
|
|
4
|
-
export interface NavigationFunctionComponent<Props = {}> extends React.FunctionComponent<Props &
|
|
5
|
-
options?: ((props: Props &
|
|
4
|
+
export interface NavigationFunctionComponent<Props = {}> extends React.FunctionComponent<Props & NavigationProps> {
|
|
5
|
+
options?: ((props: Props & NavigationProps) => Options) | Options;
|
|
6
6
|
}
|
|
@@ -245,7 +245,11 @@ RCT_EXPORT_METHOD(getNavigationConstants
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getNavigationConstantsSync) {
|
|
248
|
-
|
|
248
|
+
__block NSDictionary *c;
|
|
249
|
+
RCTUnsafeExecuteOnMainQueueSync(^{
|
|
250
|
+
c = [Constants getConstants];
|
|
251
|
+
});
|
|
252
|
+
return c;
|
|
249
253
|
}
|
|
250
254
|
|
|
251
255
|
@end
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
ComponentDidAppearEvent,
|
|
10
10
|
ComponentDidDisappearEvent,
|
|
11
11
|
} from './ComponentEvents';
|
|
12
|
-
import {
|
|
12
|
+
import { NavigationProps } from './NavigationComponentProps';
|
|
13
13
|
import { Options } from './Options';
|
|
14
14
|
|
|
15
15
|
export class NavigationComponent<Props = {}, State = {}, Snapshot = any> extends React.Component<
|
|
16
|
-
Props &
|
|
16
|
+
Props & NavigationProps,
|
|
17
17
|
State,
|
|
18
18
|
Snapshot
|
|
19
19
|
> {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { NavigationProps } from './NavigationComponentProps';
|
|
3
3
|
import { Options } from './Options';
|
|
4
4
|
|
|
5
5
|
export interface NavigationFunctionComponent<Props = {}>
|
|
6
|
-
extends React.FunctionComponent<Props &
|
|
7
|
-
options?: ((props: Props &
|
|
6
|
+
extends React.FunctionComponent<Props & NavigationProps> {
|
|
7
|
+
options?: ((props: Props & NavigationProps) => Options) | Options;
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-navigation",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.35.0",
|
|
4
4
|
"description": "React Native Navigation - truly native navigation for iOS and Android",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"nativePackage": true,
|
|
@@ -88,10 +88,10 @@
|
|
|
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": "^
|
|
91
|
+
"babel-jest": "^27.0.0",
|
|
92
92
|
"clang-format": "^1.4.0",
|
|
93
93
|
"detox": "20.9.0",
|
|
94
|
-
"detox-testing-library-rnn-adapter": "2.
|
|
94
|
+
"detox-testing-library-rnn-adapter": "^2.0.3",
|
|
95
95
|
"eslint": "7.32.0",
|
|
96
96
|
"eslint-config-prettier": "6.11.0",
|
|
97
97
|
"eslint-plugin-prettier": "3.1.4",
|
|
@@ -130,8 +130,11 @@
|
|
|
130
130
|
"*.{h,m,mm}": "node ./scripts/check-clang-format"
|
|
131
131
|
},
|
|
132
132
|
"detox": {
|
|
133
|
-
"
|
|
134
|
-
|
|
133
|
+
"testRunner": {
|
|
134
|
+
"args": {
|
|
135
|
+
"config": "e2e/jest.config.js"
|
|
136
|
+
}
|
|
137
|
+
},
|
|
135
138
|
"artifacts": {
|
|
136
139
|
"plugins": {
|
|
137
140
|
"log": "all",
|
|
@@ -168,7 +171,8 @@
|
|
|
168
171
|
"ios.debug": {
|
|
169
172
|
"type": "ios.app",
|
|
170
173
|
"binaryPath": "playground/ios/DerivedData/playground/Build/Products/Debug-iphonesimulator/playground.app",
|
|
171
|
-
"
|
|
174
|
+
"start": "npm start -- --e2e",
|
|
175
|
+
"build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme playground -workspace playground/ios/playground.xcworkspace -sdk iphonesimulator -configuration Debug -derivedDataPath playground/ios/DerivedData/playground ONLY_ACTIVE_ARCH=YES -quiet -UseModernBuildSystem=YES"
|
|
172
176
|
},
|
|
173
177
|
"ios.release": {
|
|
174
178
|
"type": "ios.app",
|
|
@@ -178,6 +182,7 @@
|
|
|
178
182
|
"android.debug": {
|
|
179
183
|
"type": "android.apk",
|
|
180
184
|
"binaryPath": "playground/android/app/build/outputs/apk/debug/app-debug.apk",
|
|
185
|
+
"start": "npm start -- --e2e",
|
|
181
186
|
"build": "cd playground/android && ./gradlew app:assembleDebug app:assembleAndroidTest -DtestBuildType=debug"
|
|
182
187
|
},
|
|
183
188
|
"android.release": {
|