react-native-navigation 7.26.0 → 7.27.1-snapshot.627
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/README.md +2 -0
- package/autolink/postlink/activityLinker.js +25 -1
- package/autolink/postlink/appDelegateLinker.js +3 -2
- package/autolink/postlink/path.js +9 -3
- package/lib/Mock/Layouts/ComponentNode.ts +31 -27
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/Presenter.java +1 -1
- package/lib/dist/Mock/Layouts/ComponentNode.js +23 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ class ActivityLinker {
|
|
|
8
8
|
this.activityPath = path.mainActivityJava;
|
|
9
9
|
this.extendNavigationActivitySuccess = false;
|
|
10
10
|
this.removeGetMainComponentNameSuccess = false;
|
|
11
|
+
this.removeCreateReactActivityDelegate = false;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
link() {
|
|
@@ -36,6 +37,8 @@ class ActivityLinker {
|
|
|
36
37
|
errorn(' ' + e.message);
|
|
37
38
|
}
|
|
38
39
|
|
|
40
|
+
activityContent = this._removeCreateReactActivityDelegate(activityContent);
|
|
41
|
+
|
|
39
42
|
fs.writeFileSync(this.activityPath, activityContent);
|
|
40
43
|
if (this.extendNavigationActivitySuccess && this.removeGetMainComponentNameSuccess) {
|
|
41
44
|
infon('MainActivity linked successfully!\n');
|
|
@@ -75,7 +78,7 @@ class ActivityLinker {
|
|
|
75
78
|
'import com.reactnativenavigation.NavigationActivity;'
|
|
76
79
|
);
|
|
77
80
|
}
|
|
78
|
-
if (this._hasAlreadyExtendReactActivity) {
|
|
81
|
+
if (this._hasAlreadyExtendReactActivity(activityContent)) {
|
|
79
82
|
warnn(' MainActivity already extends NavigationActivity');
|
|
80
83
|
return activityContent;
|
|
81
84
|
}
|
|
@@ -92,6 +95,27 @@ class ActivityLinker {
|
|
|
92
95
|
_hasAlreadyExtendReactActivity(activityContent) {
|
|
93
96
|
return /public\s+class\s+MainActivity\s+extends\s+ReactActivity\s*/.test(activityContent);
|
|
94
97
|
}
|
|
98
|
+
|
|
99
|
+
_removeCreateReactActivityDelegate(activityContent) {
|
|
100
|
+
if (this._hasCreateReactActivityDelegate(activityContent)) {
|
|
101
|
+
debugn(' Removing createReactActivityDelegate function');
|
|
102
|
+
return activityContent.replace(
|
|
103
|
+
/\/\*\*(\s+\*.+)+\s+@Override\s+protected ReactActivityDelegate createReactActivityDelegate\(\) {(\s*[\w*(,);])*\s*}/,
|
|
104
|
+
'',
|
|
105
|
+
);
|
|
106
|
+
} else {
|
|
107
|
+
warnn(
|
|
108
|
+
' createReactActivityDelegate is already not defined in MainActivity',
|
|
109
|
+
);
|
|
110
|
+
return activityContent;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
_hasCreateReactActivityDelegate(activityContent) {
|
|
115
|
+
return /\/\*\*(\s+\*.+)+\s+@Override\s+protected ReactActivityDelegate createReactActivityDelegate\(\) {(\s*[\w*(,);])*\s*}/.test(
|
|
116
|
+
activityContent,
|
|
117
|
+
);
|
|
118
|
+
}
|
|
95
119
|
}
|
|
96
120
|
|
|
97
121
|
module.exports = ActivityLinker;
|
|
@@ -104,7 +104,7 @@ class AppDelegateLinker {
|
|
|
104
104
|
return content.replace(
|
|
105
105
|
/RCTBridge.*];/,
|
|
106
106
|
'RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];\n' +
|
|
107
|
-
|
|
107
|
+
'[ReactNativeNavigation bootstrapWithBridge:bridge];'
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -146,6 +146,7 @@ class AppDelegateLinker {
|
|
|
146
146
|
|
|
147
147
|
const toRemove = [
|
|
148
148
|
/RCTRootView\s+\*rootView((.|\r|\s)*?)];\s+/,
|
|
149
|
+
/UIView \*rootView = RCTAppSetupDefaultRootView\(bridge, @".*", nil\);/,
|
|
149
150
|
/if \(@available\(iOS 13\.0, \*\)\)\s{\s+ rootView.backgroundColor((.|\r)*)];\s+}\s+else {[^}]*}/,
|
|
150
151
|
/self.window((.|\r)*)];\s+/,
|
|
151
152
|
/UIViewController\s\*rootViewController((.|\r)*)];\s+/,
|
|
@@ -169,7 +170,7 @@ class AppDelegateLinker {
|
|
|
169
170
|
' No elements could be removed. Check the manual installation docs to verify that everything is properly setup:\n https://wix.github.io/react-native-navigation/docs/installing#native-installation'
|
|
170
171
|
);
|
|
171
172
|
} else {
|
|
172
|
-
|
|
173
|
+
warnn(
|
|
173
174
|
'Some elements were removed. Check the manual installation docs to verify that everything is properly setup:\n https://wix.github.io/react-native-navigation/docs/installing#native-installation'
|
|
174
175
|
);
|
|
175
176
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
var glob = require('glob');
|
|
2
|
-
var ignoreFolders = {
|
|
2
|
+
var ignoreFolders = {
|
|
3
|
+
ignore: ['node_modules/**', '**/build/**', '**/Build/**', '**/DerivedData/**', '**/*-tvOS*/**'],
|
|
4
|
+
};
|
|
3
5
|
|
|
4
6
|
var manifestPath = glob.sync('**/AndroidManifest.xml', ignoreFolders)[0];
|
|
5
7
|
|
|
@@ -9,6 +11,10 @@ var mainApplicationJava = glob.sync('**/MainApplication.java', ignoreFolders)[0]
|
|
|
9
11
|
exports.mainApplicationJava = mainApplicationJava;
|
|
10
12
|
exports.rootGradle = mainApplicationJava.replace(/android\/app\/.*\.java/, 'android/build.gradle');
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
var reactNativeVersion = require('../../../react-native/package.json').version;
|
|
15
|
+
exports.appDelegate = glob.sync(
|
|
16
|
+
reactNativeVersion < '0.68.0' ? '**/AppDelegate.m' : '**/AppDelegate.mm',
|
|
17
|
+
ignoreFolders
|
|
18
|
+
)[0];
|
|
13
19
|
exports.podFile = glob.sync('**/Podfile', ignoreFolders)[0];
|
|
14
|
-
exports.plist = glob.sync('**/info.plist', ignoreFolders)[0];
|
|
20
|
+
exports.plist = glob.sync('**/info.plist', ignoreFolders)[0];
|
|
@@ -18,43 +18,47 @@ export default class ComponentNode extends ParentNode {
|
|
|
18
18
|
|
|
19
19
|
public componentDidAppear() {
|
|
20
20
|
if (this.componentDidMountOnce) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
setTimeout(() => {
|
|
22
|
+
events.invokeComponentWillAppear({
|
|
23
|
+
componentName: this.data.name,
|
|
24
|
+
componentId: this.nodeId,
|
|
25
|
+
componentType: 'Component',
|
|
26
|
+
});
|
|
27
|
+
events.invokeComponentDidAppear({
|
|
28
|
+
componentName: this.data.name,
|
|
29
|
+
componentId: this.nodeId,
|
|
30
|
+
componentType: 'Component',
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
this.buttonsDidAppear(
|
|
34
|
+
_.concat(
|
|
35
|
+
this.data.options.topBar?.rightButtons || [],
|
|
36
|
+
this.data.options.topBar?.leftButtons || []
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
|
+
this.titleChanged(undefined, this.data.options.topBar?.title);
|
|
40
|
+
}, 0);
|
|
41
|
+
} else {
|
|
42
|
+
this.componentDidAppearPending = true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public componentDidDisappear() {
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
events.invokeComponentDidDisappear({
|
|
27
49
|
componentName: this.data.name,
|
|
28
50
|
componentId: this.nodeId,
|
|
29
51
|
componentType: 'Component',
|
|
30
52
|
});
|
|
31
53
|
|
|
32
|
-
this.
|
|
54
|
+
this.buttonsDidDisappear(
|
|
33
55
|
_.concat(
|
|
34
56
|
this.data.options.topBar?.rightButtons || [],
|
|
35
57
|
this.data.options.topBar?.leftButtons || []
|
|
36
58
|
)
|
|
37
59
|
);
|
|
38
|
-
this.titleChanged(
|
|
39
|
-
}
|
|
40
|
-
this.componentDidAppearPending = true;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
public componentDidDisappear() {
|
|
45
|
-
events.invokeComponentDidDisappear({
|
|
46
|
-
componentName: this.data.name,
|
|
47
|
-
componentId: this.nodeId,
|
|
48
|
-
componentType: 'Component',
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
this.buttonsDidDisappear(
|
|
52
|
-
_.concat(
|
|
53
|
-
this.data.options.topBar?.rightButtons || [],
|
|
54
|
-
this.data.options.topBar?.leftButtons || []
|
|
55
|
-
)
|
|
56
|
-
);
|
|
57
|
-
this.titleChanged(this.data.options.topBar?.title);
|
|
60
|
+
this.titleChanged(this.data.options.topBar?.title);
|
|
61
|
+
}, 0);
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
titleChanged(oldTitle: any, newTitle?: any) {
|
|
@@ -97,7 +97,7 @@ public class Presenter {
|
|
|
97
97
|
int top = view.resolveCurrentOptions().statusBar.drawBehind.isTrue() ? 0 : SystemUiUtils.getStatusBarHeight(view.getActivity());
|
|
98
98
|
if (!(view instanceof ParentController)) {
|
|
99
99
|
MarginLayoutParams lp = (MarginLayoutParams) view.getView().getLayoutParams();
|
|
100
|
-
if (lp.topMargin != 0) top = 0;
|
|
100
|
+
if (lp != null && lp.topMargin != 0) top = 0;
|
|
101
101
|
}
|
|
102
102
|
ld.setLayerInset(0, 0, top, 0, 0);
|
|
103
103
|
view.getView().setBackground(ld);
|
|
@@ -16,31 +16,35 @@ class ComponentNode extends ParentNode_1.default {
|
|
|
16
16
|
}
|
|
17
17
|
componentDidAppear() {
|
|
18
18
|
if (this.componentDidMountOnce) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
setTimeout(() => {
|
|
20
|
+
EventsStore_1.events.invokeComponentWillAppear({
|
|
21
|
+
componentName: this.data.name,
|
|
22
|
+
componentId: this.nodeId,
|
|
23
|
+
componentType: 'Component',
|
|
24
|
+
});
|
|
25
|
+
EventsStore_1.events.invokeComponentDidAppear({
|
|
26
|
+
componentName: this.data.name,
|
|
27
|
+
componentId: this.nodeId,
|
|
28
|
+
componentType: 'Component',
|
|
29
|
+
});
|
|
30
|
+
this.buttonsDidAppear(lodash_1.default.concat(this.data.options.topBar?.rightButtons || [], this.data.options.topBar?.leftButtons || []));
|
|
31
|
+
this.titleChanged(undefined, this.data.options.topBar?.title);
|
|
32
|
+
}, 0);
|
|
31
33
|
}
|
|
32
34
|
else {
|
|
33
35
|
this.componentDidAppearPending = true;
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
componentDidDisappear() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
setTimeout(() => {
|
|
40
|
+
EventsStore_1.events.invokeComponentDidDisappear({
|
|
41
|
+
componentName: this.data.name,
|
|
42
|
+
componentId: this.nodeId,
|
|
43
|
+
componentType: 'Component',
|
|
44
|
+
});
|
|
45
|
+
this.buttonsDidDisappear(lodash_1.default.concat(this.data.options.topBar?.rightButtons || [], this.data.options.topBar?.leftButtons || []));
|
|
46
|
+
this.titleChanged(this.data.options.topBar?.title);
|
|
47
|
+
}, 0);
|
|
44
48
|
}
|
|
45
49
|
titleChanged(oldTitle, newTitle) {
|
|
46
50
|
if (oldTitle && oldTitle.component) {
|