react-native-navigation 7.30.0-alpha.1-snapshot.722 → 7.30.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.
Files changed (31) hide show
  1. package/ReactNativeNavigation.podspec +7 -7
  2. package/jest-setup.js +0 -3
  3. package/jest.config.js +1 -1
  4. package/lib/Mock/Components/NavigationButton.tsx +4 -2
  5. package/lib/android/app/build.gradle +6 -27
  6. package/lib/android/app/src/main/AndroidManifest.xml +2 -4
  7. package/lib/android/app/src/main/java/com/reactnativenavigation/NavigationActivity.java +5 -12
  8. package/lib/android/app/src/main/java/com/reactnativenavigation/options/TopBarOptions.java +8 -0
  9. package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenter.java +10 -4
  10. package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/ButtonController.kt +2 -0
  11. package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/ButtonPresenter.kt +6 -1
  12. package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/BaseViewAnimator.kt +3 -3
  13. package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/titlebar/IconBackgroundDrawable.kt +11 -9
  14. package/lib/dist/Mock/Components/NavigationButton.js +2 -1
  15. package/lib/dist/src/interfaces/Options.d.ts +2 -0
  16. package/lib/ios/RNNButtonOptions.h +3 -1
  17. package/lib/ios/RNNButtonOptions.m +7 -3
  18. package/lib/ios/RNNButtonsPresenter.h +6 -2
  19. package/lib/ios/RNNButtonsPresenter.m +16 -4
  20. package/lib/ios/RNNComponentPresenter.m +10 -2
  21. package/lib/ios/RNNIconDrawer.m +1 -1
  22. package/lib/ios/RNNTitleViewHelper.h +8 -0
  23. package/lib/ios/RNNTitleViewHelper.m +16 -0
  24. package/lib/ios/RNNTopBarOptions.h +2 -0
  25. package/lib/ios/RNNTopBarOptions.m +6 -0
  26. package/lib/ios/RNNUIBarButtonItem.h +2 -1
  27. package/lib/ios/RNNUIBarButtonItem.m +29 -6
  28. package/lib/ios/TopBarTitlePresenter.m +7 -0
  29. package/lib/src/interfaces/Options.ts +2 -0
  30. package/package.json +18 -19
  31. package/react-native.config.js +0 -3
@@ -21,13 +21,13 @@ Pod::Spec.new do |s|
21
21
  s.exclude_files = "lib/ios/ReactNativeNavigationTests/**/*.*", "lib/ios/OCMock/**/*.*"
22
22
  end
23
23
 
24
- s.subspec 'Fabric' do |ss|
25
- ss.xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/RCT-Folly\"",
26
- "OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1" }
27
- ss.dependency 'React-RCTFabric'
28
- ss.dependency 'React-Fabric'
29
- ss.dependency 'RCT-Folly/Fabric'
30
- end
24
+ # s.subspec 'Fabric' do |ss|
25
+ # ss.xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/RCT-Folly\"",
26
+ # "OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1" }
27
+ # ss.dependency 'React-RCTFabric'
28
+ # ss.dependency 'React-Fabric'
29
+ # ss.dependency 'RCT-Folly/Fabric'
30
+ # end
31
31
 
32
32
  s.dependency 'React-Core'
33
33
  s.dependency 'React-RCTImage'
package/jest-setup.js CHANGED
@@ -4,9 +4,6 @@ mockDetox(() => require('./playground/index'));
4
4
 
5
5
  beforeEach(() => {
6
6
  const { mockNativeComponents } = require('react-native-navigation/Mock');
7
- setTimeout = (func) => {
8
- func();
9
- };
10
7
  mockNativeComponents();
11
8
  mockUILib();
12
9
  });
package/jest.config.js CHANGED
@@ -1,7 +1,7 @@
1
1
  module.exports = {
2
2
  preset: 'react-native',
3
3
  transformIgnorePatterns: [
4
- 'node_modules/(?!(@react-native|react-native|react-native-ui-lib|react-native-animatable)/)',
4
+ 'node_modules/(?!(@react-native|react-native|react-native-ui-lib|react-native-animatable|react-native-reanimated)/)',
5
5
  ],
6
6
  transform: {
7
7
  '\\.[jt]sx?$': 'babel-jest',
@@ -45,8 +45,10 @@ export const NavigationButton = class extends Component<ButtonProps> {
45
45
  <TouchableOpacity
46
46
  onPress={() => {
47
47
  if (this.ref) {
48
- // @ts-ignore
49
- this.invokeOnClick(this.ref!._reactInternalFiber.return.stateNode);
48
+ this.invokeOnClick(
49
+ // @ts-ignore
50
+ (this.ref!._reactInternalFiber || this.ref!._reactInternals).return.stateNode
51
+ );
50
52
  }
51
53
 
52
54
  events.invokeNavigationButtonPressed({
@@ -12,9 +12,9 @@ def safeExtGetFallbackLowerBound(prop, fallback) {
12
12
  Math.max(safeExtGet(prop,fallback),fallback)
13
13
  }
14
14
 
15
- def DEFAULT_COMPILE_SDK_VERSION = 33
15
+ def DEFAULT_COMPILE_SDK_VERSION = 30
16
16
  def DEFAULT_MIN_SDK_VERSION = 21
17
- def DEFAULT_TARGET_SDK_VERSION = 33
17
+ def DEFAULT_TARGET_SDK_VERSION = 30
18
18
  def DEFAULT_KOTLIN_VERSION = "1.5.31"
19
19
  def DEFAULT_KOTLIN_STDLIB = 'kotlin-stdlib-jdk8'
20
20
  def kotlinVersion = safeExtGet("RNNKotlinVersion", DEFAULT_KOTLIN_VERSION)
@@ -22,7 +22,7 @@ def kotlinStdlib = safeExtGet('RNNKotlinStdlib',DEFAULT_KOTLIN_STDLIB )
22
22
  def kotlinCoroutinesCore = safeExtGet('RNNKotlinCoroutinesCore', '1.5.2')
23
23
  android {
24
24
  compileSdkVersion safeExtGetFallbackLowerBound('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
25
- buildToolsVersion = "33.0.0"
25
+
26
26
  defaultConfig {
27
27
  minSdkVersion safeExtGetFallbackLowerBound('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
28
28
  targetSdkVersion safeExtGetFallbackLowerBound('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
@@ -65,11 +65,11 @@ android {
65
65
  }
66
66
  }
67
67
  compileOptions {
68
- sourceCompatibility JavaVersion.VERSION_1_8
69
- targetCompatibility JavaVersion.VERSION_1_8
68
+ sourceCompatibility JavaVersion.VERSION_11
69
+ targetCompatibility JavaVersion.VERSION_11
70
70
  }
71
71
  kotlinOptions {
72
- jvmTarget = JavaVersion.VERSION_1_8
72
+ jvmTarget = JavaVersion.VERSION_11
73
73
  }
74
74
 
75
75
  flavorDimensions "RNN.reactNativeVersion"
@@ -167,27 +167,6 @@ List reactNativeVersionComponents(rnPackageJsonFile) {
167
167
  return reactNativeVersion.tokenize('-')[0].tokenize('.')
168
168
  }
169
169
 
170
- task installBuildToolsAndRenameD8IfNeeded {
171
- def buildToolsVersion = android.getBuildToolsVersion()
172
- def sdkDir = android.sdkDirectory
173
- def buildToolsDir = new File(sdkDir, "/build-tools/" + buildToolsVersion)
174
-
175
- if (!buildToolsDir.exists()) {
176
- def command = sdkDir.absolutePath + "/cmdline-tools/latest/bin/sdkmanager build-tools;" + buildToolsVersion
177
- command.execute().waitForProcessOutput(System.out, System.err)
178
- }
179
-
180
- def d8File = new File(buildToolsDir, "d8")
181
- def dxFile = new File(buildToolsDir, "dx")
182
- d8File.renameTo(dxFile)
183
-
184
- def buildToolsLibDir = new File(buildToolsDir, "lib")
185
- d8File = new File(buildToolsLibDir, "d8.jar")
186
- dxFile = new File(buildToolsLibDir, "dx.jar")
187
- d8File.renameTo(dxFile)
188
- }
189
- build.dependsOn installBuildToolsAndRenameD8IfNeeded
190
-
191
170
  dependencies {
192
171
 
193
172
  implementation "androidx.core:core-ktx:1.6.0"
@@ -1,9 +1,7 @@
1
1
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- xmlns:tools="http://schemas.android.com/tools"
3
- package="com.reactnativenavigation">
2
+ package="com.reactnativenavigation">
4
3
 
5
- <application
6
- android:enableOnBackInvokedCallback="true">
4
+ <application>
7
5
  <activity
8
6
  android:name="com.facebook.react.devsupport.DevSettingsActivity"
9
7
  android:exported="false"/>
@@ -22,7 +22,6 @@ import com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry;
22
22
  import com.reactnativenavigation.viewcontrollers.modal.ModalStack;
23
23
  import com.reactnativenavigation.viewcontrollers.navigator.Navigator;
24
24
 
25
- import androidx.activity.OnBackPressedCallback;
26
25
  import androidx.annotation.NonNull;
27
26
  import androidx.annotation.Nullable;
28
27
  import androidx.appcompat.app.AppCompatActivity;
@@ -48,7 +47,6 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
48
47
  );
49
48
  navigator.bindViews();
50
49
  getReactGateway().onActivityCreated(this);
51
- setBackPressedCallback();
52
50
  }
53
51
 
54
52
  @Override
@@ -105,6 +103,11 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
105
103
  getReactGateway().onActivityResult(this, requestCode, resultCode, data);
106
104
  }
107
105
 
106
+ @Override
107
+ public void onBackPressed() {
108
+ getReactGateway().onBackPressed();
109
+ }
110
+
108
111
  @Override
109
112
  public boolean onKeyUp(final int keyCode, final KeyEvent event) {
110
113
  return getReactGateway().onKeyUp(this, keyCode) || super.onKeyUp(keyCode, event);
@@ -149,14 +152,4 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
149
152
  public void onCatalystInstanceDestroy() {
150
153
  runOnUiThread(() -> navigator.destroyViews());
151
154
  }
152
-
153
- private void setBackPressedCallback() {
154
- OnBackPressedCallback callback = new OnBackPressedCallback(true) {
155
- @Override
156
- public void handleOnBackPressed() {
157
- getReactGateway().onBackPressed();
158
- }
159
- };
160
- getOnBackPressedDispatcher().addCallback(this, callback);
161
- }
162
155
  }
@@ -50,6 +50,8 @@ public class TopBarOptions {
50
50
  options.leftButtonColor = ThemeColour.parse(context, json.optJSONObject("leftButtonColor"));
51
51
  options.leftButtonDisabledColor = ThemeColour.parse(context, json.optJSONObject("leftButtonDisabledColor"));
52
52
  options.rightButtonDisabledColor = ThemeColour.parse(context, json.optJSONObject("rightButtonDisabledColor"));
53
+ options.leftButtonBackgroundColor = ThemeColour.parse(context, json.optJSONObject("leftButtonBackgroundColor"));
54
+ options.rightButtonBackgroundColor = ThemeColour.parse(context, json.optJSONObject("rightButtonBackgroundColor"));
53
55
 
54
56
  options.validate();
55
57
  return options;
@@ -76,6 +78,8 @@ public class TopBarOptions {
76
78
  public ThemeColour leftButtonColor = new NullThemeColour();
77
79
  public ThemeColour rightButtonDisabledColor = new NullThemeColour();
78
80
  public ThemeColour leftButtonDisabledColor = new NullThemeColour();
81
+ public ThemeColour rightButtonBackgroundColor = new NullThemeColour();
82
+ public ThemeColour leftButtonBackgroundColor = new NullThemeColour();
79
83
 
80
84
  public TopBarOptions copy() {
81
85
  TopBarOptions result = new TopBarOptions();
@@ -94,6 +98,8 @@ public class TopBarOptions {
94
98
  if (other.leftButtonColor.hasValue()) leftButtonColor = other.leftButtonColor;
95
99
  if (other.rightButtonDisabledColor.hasValue()) rightButtonDisabledColor = other.rightButtonDisabledColor;
96
100
  if (other.leftButtonDisabledColor.hasValue()) leftButtonDisabledColor = other.leftButtonDisabledColor;
101
+ if (other.rightButtonBackgroundColor.hasValue()) rightButtonBackgroundColor = other.rightButtonBackgroundColor;
102
+ if (other.leftButtonBackgroundColor.hasValue()) rightButtonBackgroundColor = other.rightButtonBackgroundColor;
97
103
 
98
104
  if (other.testId.hasValue()) testId = other.testId;
99
105
  if (other.visible.hasValue()) visible = other.visible;
@@ -122,6 +128,8 @@ public class TopBarOptions {
122
128
  if (!leftButtonColor.hasValue()) leftButtonColor = defaultOptions.leftButtonColor;
123
129
  if (!rightButtonDisabledColor.hasValue()) rightButtonDisabledColor = defaultOptions.rightButtonDisabledColor;
124
130
  if (!leftButtonDisabledColor.hasValue()) leftButtonDisabledColor = defaultOptions.leftButtonDisabledColor;
131
+ if (!rightButtonBackgroundColor.hasValue()) rightButtonBackgroundColor = defaultOptions.rightButtonBackgroundColor;
132
+ if (!leftButtonBackgroundColor.hasValue()) rightButtonBackgroundColor = defaultOptions.rightButtonBackgroundColor;
125
133
 
126
134
  if (!visible.hasValue()) visible = defaultOptions.visible;
127
135
  if (!animate.hasValue()) animate = defaultOptions.animate;
@@ -458,12 +458,12 @@ public class StackPresenter {
458
458
  private void mergeButtons(TopBarOptions options, TopBarOptions optionsToMerge, View child, StackController stack) {
459
459
  mergeRightButtons(options, optionsToMerge.buttons, child);
460
460
  mergeLeftButton(options, optionsToMerge.buttons, child);
461
- mergeLeftButtonsColor(child, optionsToMerge.leftButtonColor, optionsToMerge.leftButtonDisabledColor);
462
- mergeRightButtonsColor(child, optionsToMerge.rightButtonColor, optionsToMerge.rightButtonDisabledColor);
461
+ mergeLeftButtonsColor(child, optionsToMerge.leftButtonColor, optionsToMerge.leftButtonDisabledColor, optionsToMerge.leftButtonBackgroundColor);
462
+ mergeRightButtonsColor(child, optionsToMerge.rightButtonColor, optionsToMerge.rightButtonDisabledColor, optionsToMerge.rightButtonBackgroundColor);
463
463
  mergeBackButton(optionsToMerge.buttons, stack);
464
464
  }
465
465
 
466
- private void mergeLeftButtonsColor(View child, ThemeColour color, ThemeColour disabledColor) {
466
+ private void mergeLeftButtonsColor(View child, ThemeColour color, ThemeColour disabledColor, ThemeColour backgroundColor) {
467
467
  if (color.hasValue() || disabledColor.hasValue()) {
468
468
  Map<String, ButtonController> stringButtonControllerMap = componentLeftButtons.get(child);
469
469
  if (stringButtonControllerMap != null) {
@@ -474,12 +474,15 @@ public class StackPresenter {
474
474
  if (disabledColor.hasValue()) {
475
475
  btnController.applyDisabledColor(topBarController.getView().getLeftButtonBar(), disabledColor);
476
476
  }
477
+ if (backgroundColor.hasValue()) {
478
+ btnController.applyBackgroundColor(topBarController.getView().getLeftButtonBar(), backgroundColor);
479
+ }
477
480
  });
478
481
  }
479
482
  }
480
483
  }
481
484
 
482
- private void mergeRightButtonsColor(View child, ThemeColour color, ThemeColour disabledColor) {
485
+ private void mergeRightButtonsColor(View child, ThemeColour color, ThemeColour disabledColor, ThemeColour backgroundColor) {
483
486
  if (color.hasValue() || disabledColor.hasValue()) {
484
487
  Map<String, ButtonController> stringButtonControllerMap = componentRightButtons.get(child);
485
488
  if (stringButtonControllerMap != null) {
@@ -490,6 +493,9 @@ public class StackPresenter {
490
493
  if (disabledColor.hasValue()) {
491
494
  btnController.applyDisabledColor(topBarController.getView().getRightButtonBar(), disabledColor);
492
495
  }
496
+ if (backgroundColor.hasValue()) {
497
+ btnController.applyBackgroundColor(topBarController.getView().getRightButtonBar(), backgroundColor);
498
+ }
493
499
  });
494
500
  }
495
501
  }
@@ -81,6 +81,8 @@ open class ButtonController(activity: Activity,
81
81
 
82
82
  open fun applyDisabledColor(toolbar: Toolbar, disabledColour: ThemeColour) = this.menuItem?.let { presenter.applyDisabledColor(toolbar, it, disabledColour) }
83
83
 
84
+ open fun applyBackgroundColor(toolbar: Toolbar, color: ThemeColour) = this.menuItem?.let { presenter.applyBackgroundColor(toolbar, it, color) }
85
+
84
86
  fun addToMenu(buttonBar: ButtonBar, order: Int) {
85
87
  if (button.component.hasValue() && buttonBar.containsButton(menuItem, order)) return
86
88
  buttonBar.menu.removeItem(button.intId)
@@ -71,10 +71,15 @@ open class ButtonPresenter(private val context: Context, private val button: But
71
71
  }
72
72
  }
73
73
 
74
+ fun applyBackgroundColor(toolbar: Toolbar, menuItem: MenuItem, color: ThemeColour) {
75
+ button.iconBackground.color = color
76
+ applyIcon(menuItem)
77
+ }
78
+
74
79
  private fun applyAccessibilityLabel(menuItem: MenuItem) {
75
80
  if (button.accessibilityLabel.hasValue()) {
76
81
  if (button.component.hasValue()) {
77
- menuItem.actionView?.contentDescription = button.accessibilityLabel.get()
82
+ menuItem.actionView.contentDescription = button.accessibilityLabel.get()
78
83
  } else {
79
84
  MenuItemCompat.setContentDescription(menuItem, button.accessibilityLabel.get())
80
85
  }
@@ -43,17 +43,17 @@ open class BaseViewAnimator<T : View>(
43
43
  private inner class AnimatorListener(private val startState: AnimationState, private val endVisibility: Int) : AnimatorListenerAdapter() {
44
44
  var isCancelled = false
45
45
 
46
- override fun onAnimationStart(animation: Animator) {
46
+ override fun onAnimationStart(animation: Animator?) {
47
47
  view.resetViewProperties()
48
48
  view.visibility = View.VISIBLE
49
49
  animationState = startState
50
50
  }
51
51
 
52
- override fun onAnimationCancel(animation: Animator) {
52
+ override fun onAnimationCancel(animation: Animator?) {
53
53
  isCancelled = true
54
54
  }
55
55
 
56
- override fun onAnimationEnd(animation: Animator) {
56
+ override fun onAnimationEnd(animation: Animator?) {
57
57
  if (!isCancelled) {
58
58
  animationState = AnimationState.Idle
59
59
  view.visibility = endVisibility
@@ -68,15 +68,17 @@ class IconBackgroundDrawable(
68
68
  super.setBounds(r)
69
69
  }
70
70
 
71
- override fun onBoundsChange(bounds: Rect) {
72
- backgroundRect = Rect((bounds.width() - backgroundWidth) / 2,
73
- (bounds.height() - backgroundHeight) / 2,
74
- bounds.width() - (bounds.width() - backgroundWidth) / 2,
75
- bounds.height() - (bounds.height() - backgroundHeight) / 2)
76
- bitmapRect = Rect((bounds.width() - bitmapWidth) / 2,
77
- (bounds.height() - bitmapHeight) / 2,
78
- bounds.width() - (bounds.width() - bitmapWidth) / 2,
79
- bounds.height() - (bounds.height() - bitmapHeight) / 2)
71
+ override fun onBoundsChange(bounds: Rect?) {
72
+ if (bounds != null) {
73
+ backgroundRect = Rect((bounds.width() - backgroundWidth) / 2,
74
+ (bounds.height() - backgroundHeight) / 2,
75
+ bounds.width() - (bounds.width() - backgroundWidth) / 2,
76
+ bounds.height() - (bounds.height() - backgroundHeight) / 2)
77
+ bitmapRect = Rect((bounds.width() - bitmapWidth) / 2,
78
+ (bounds.height() - bitmapHeight) / 2,
79
+ bounds.width() - (bounds.width() - bitmapWidth) / 2,
80
+ bounds.height() - (bounds.height() - bitmapHeight) / 2)
81
+ }
80
82
  super.onBoundsChange(bounds)
81
83
  }
82
84
 
@@ -31,8 +31,9 @@ const NavigationButton = class extends react_1.Component {
31
31
  const props = react_native_navigation_1.Navigation.mock.store.getPropsForId(buttonComponentId);
32
32
  return (react_1.default.createElement(react_native_1.TouchableOpacity, { onPress: () => {
33
33
  if (this.ref) {
34
+ this.invokeOnClick(
34
35
  // @ts-ignore
35
- this.invokeOnClick(this.ref._reactInternalFiber.return.stateNode);
36
+ (this.ref._reactInternalFiber || this.ref._reactInternals).return.stateNode);
36
37
  }
37
38
  EventsStore_1.events.invokeNavigationButtonPressed({
38
39
  buttonId: button.id,
@@ -568,6 +568,8 @@ export interface OptionsTopBar {
568
568
  */
569
569
  leftButtonColor?: Color;
570
570
  rightButtonColor?: Color;
571
+ leftButtonBackgroundColor?: Color;
572
+ rightButtonBackgroundColor?: Color;
571
573
  leftButtonDisabledColor?: Color;
572
574
  rightButtonDisabledColor?: Color;
573
575
  /**
@@ -25,7 +25,7 @@
25
25
 
26
26
  - (RNNButtonOptions *)withDefault:(RNNButtonOptions *)defaultOptions;
27
27
 
28
- - (UIColor *)resolveColor;
28
+ - (Color *)resolveColor;
29
29
 
30
30
  - (RNNButtonOptions *)withDefaultColor:(Color *)color disabledColor:(Color *)disabledColor;
31
31
 
@@ -33,4 +33,6 @@
33
33
 
34
34
  - (BOOL)isEnabled;
35
35
 
36
+ - (UIControlState)state;
37
+
36
38
  @end
@@ -93,11 +93,11 @@
93
93
  return [self.enabled withDefault:YES];
94
94
  }
95
95
 
96
- - (UIColor *)resolveColor {
96
+ - (Color *)resolveColor {
97
97
  if (![_enabled withDefault:YES] && _disabledColor.hasValue)
98
- return _disabledColor.get;
98
+ return _disabledColor;
99
99
  else
100
- return [_color withDefault:nil];
100
+ return _color;
101
101
  }
102
102
 
103
103
  - (RNNButtonOptions *)withDefault:(RNNButtonOptions *)defaultOptions {
@@ -116,4 +116,8 @@
116
116
  return self;
117
117
  }
118
118
 
119
+ - (UIControlState)state {
120
+ return self.isEnabled ? UIControlStateNormal : UIControlStateDisabled;
121
+ }
122
+
119
123
  @end
@@ -20,9 +20,13 @@
20
20
  defaultDisabledColor:(Color *)defaultDisabledColor
21
21
  animated:(BOOL)animated;
22
22
 
23
- - (void)applyLeftButtonsColor:(UIColor *)color;
23
+ - (void)applyLeftButtonsColor:(Color *)color;
24
24
 
25
- - (void)applyRightButtonsColor:(UIColor *)color;
25
+ - (void)applyRightButtonsColor:(Color *)color;
26
+
27
+ - (void)applyLeftButtonsBackgroundColor:(Color *)color;
28
+
29
+ - (void)applyRightButtonsBackgroundColor:(Color *)color;
26
30
 
27
31
  - (void)componentWillAppear;
28
32
 
@@ -47,15 +47,27 @@
47
47
  defaultDisabledColor:defaultDisabledColor];
48
48
  }
49
49
 
50
- - (void)applyLeftButtonsColor:(UIColor *)color {
50
+ - (void)applyLeftButtonsColor:(Color *)color {
51
51
  for (RNNUIBarButtonItem *button in self.viewController.navigationItem.leftBarButtonItems) {
52
- [button applyColor:color];
52
+ [button mergeColor:color];
53
53
  }
54
54
  }
55
55
 
56
- - (void)applyRightButtonsColor:(UIColor *)color {
56
+ - (void)applyRightButtonsColor:(Color *)color {
57
57
  for (RNNUIBarButtonItem *button in self.viewController.navigationItem.rightBarButtonItems) {
58
- [button applyColor:color];
58
+ [button mergeColor:color];
59
+ }
60
+ }
61
+
62
+ - (void)applyRightButtonsBackgroundColor:(Color *)color {
63
+ for (RNNUIBarButtonItem *button in self.viewController.navigationItem.rightBarButtonItems) {
64
+ [button mergeBackgroundColor:color];
65
+ }
66
+ }
67
+
68
+ - (void)applyLeftButtonsBackgroundColor:(Color *)color {
69
+ for (RNNUIBarButtonItem *button in self.viewController.navigationItem.leftBarButtonItems) {
70
+ [button mergeBackgroundColor:color];
59
71
  }
60
72
  }
61
73
 
@@ -209,11 +209,19 @@
209
209
  }
210
210
 
211
211
  if (mergeOptions.topBar.leftButtonColor.hasValue) {
212
- [_buttonsPresenter applyLeftButtonsColor:mergeOptions.topBar.leftButtonColor.get];
212
+ [_buttonsPresenter applyLeftButtonsColor:mergeOptions.topBar.leftButtonColor];
213
213
  }
214
214
 
215
215
  if (mergeOptions.topBar.rightButtonColor.hasValue) {
216
- [_buttonsPresenter applyRightButtonsColor:mergeOptions.topBar.rightButtonColor.get];
216
+ [_buttonsPresenter applyRightButtonsColor:mergeOptions.topBar.rightButtonColor];
217
+ }
218
+
219
+ if (mergeOptions.topBar.rightButtonBackgroundColor.hasValue) {
220
+ [_buttonsPresenter applyRightButtonsBackgroundColor:mergeOptions.topBar.rightButtonBackgroundColor];
221
+ }
222
+
223
+ if (mergeOptions.topBar.leftButtonBackgroundColor.hasValue) {
224
+ [_buttonsPresenter applyLeftButtonsBackgroundColor:mergeOptions.topBar.leftButtonBackgroundColor];
217
225
  }
218
226
 
219
227
  if (mergeOptions.overlay.interceptTouchOutside.hasValue) {
@@ -29,7 +29,7 @@
29
29
  UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
30
30
  UIGraphicsEndImageContext();
31
31
 
32
- return [newImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
32
+ return newImage;
33
33
  }
34
34
 
35
35
  @end
@@ -8,6 +8,10 @@
8
8
 
9
9
  @property(nonatomic, strong) UILabel *subtitleLabel;
10
10
 
11
+ - (void)setTitleColor:(UIColor *)color;
12
+
13
+ - (void)setSubtitleColor:(UIColor *)color;
14
+
11
15
  @end
12
16
 
13
17
  @interface RNNTitleViewHelper : NSObject
@@ -21,4 +25,8 @@
21
25
 
22
26
  - (void)setup;
23
27
 
28
+ - (void)setTitleColor:(UIColor *)color;
29
+
30
+ - (void)setSubtitleColor:(UIColor *)color;
31
+
24
32
  @end
@@ -16,6 +16,14 @@
16
16
  self.frame.size.width, _subtitleLabel.frame.size.height)];
17
17
  }
18
18
 
19
+ - (void)setTitleColor:(UIColor *)color {
20
+ _titleLabel.textColor = color;
21
+ }
22
+
23
+ - (void)setSubtitleColor:(UIColor *)color {
24
+ _subtitleLabel.textColor = color;
25
+ }
26
+
19
27
  @end
20
28
 
21
29
  @interface RNNTitleViewHelper ()
@@ -170,4 +178,12 @@
170
178
  return titleLabel;
171
179
  }
172
180
 
181
+ - (void)setTitleColor:(UIColor *)color {
182
+ [_titleView setTitleColor:color];
183
+ }
184
+
185
+ - (void)setSubtitleColor:(UIColor *)color {
186
+ [_titleView setSubtitleColor:color];
187
+ }
188
+
173
189
  @end
@@ -20,6 +20,8 @@
20
20
  @property(nonatomic, strong) Color *rightButtonColor;
21
21
  @property(nonatomic, strong) Color *leftButtonDisabledColor;
22
22
  @property(nonatomic, strong) Color *rightButtonDisabledColor;
23
+ @property(nonatomic, strong) Color *leftButtonBackgroundColor;
24
+ @property(nonatomic, strong) Color *rightButtonBackgroundColor;
23
25
  @property(nonatomic, strong) Bool *drawBehind;
24
26
  @property(nonatomic, strong) Bool *noBorder;
25
27
  @property(nonatomic, strong) Color *borderColor;
@@ -14,6 +14,8 @@
14
14
  self.rightButtonColor = [ColorParser parse:dict key:@"rightButtonColor"];
15
15
  self.leftButtonDisabledColor = [ColorParser parse:dict key:@"leftButtonDisabledColor"];
16
16
  self.rightButtonDisabledColor = [ColorParser parse:dict key:@"rightButtonDisabledColor"];
17
+ self.leftButtonBackgroundColor = [ColorParser parse:dict key:@"leftButtonBackgroundColor"];
18
+ self.rightButtonBackgroundColor = [ColorParser parse:dict key:@"rightButtonBackgroundColor"];
17
19
  self.drawBehind = [BoolParser parse:dict key:@"drawBehind"];
18
20
  self.noBorder = [BoolParser parse:dict key:@"noBorder"];
19
21
  self.borderColor = [ColorParser parse:dict key:@"borderColor"];
@@ -63,6 +65,10 @@
63
65
  self.leftButtonDisabledColor = options.leftButtonDisabledColor;
64
66
  if (options.rightButtonDisabledColor.hasValue)
65
67
  self.rightButtonDisabledColor = options.rightButtonDisabledColor;
68
+ if (options.leftButtonBackgroundColor.hasValue)
69
+ self.leftButtonBackgroundColor = options.leftButtonBackgroundColor;
70
+ if (options.rightButtonBackgroundColor.hasValue)
71
+ self.rightButtonBackgroundColor = options.rightButtonBackgroundColor;
66
72
  if (options.drawBehind.hasValue)
67
73
  self.drawBehind = options.drawBehind;
68
74
  if (options.noBorder.hasValue)
@@ -26,7 +26,8 @@ typedef void (^RNNButtonPressCallback)(NSString *buttonId);
26
26
  - (instancetype)initWithSystemItem:(RNNButtonOptions *)buttonOptions
27
27
  onPress:(RNNButtonPressCallback)onPress;
28
28
 
29
- - (void)applyColor:(UIColor *)color;
29
+ - (void)mergeColor:(Color *)color;
30
+ - (void)mergeBackgroundColor:(Color *)color;
30
31
 
31
32
  - (void)notifyWillAppear;
32
33
  - (void)notifyDidAppear;
@@ -11,7 +11,10 @@
11
11
 
12
12
  @end
13
13
 
14
- @implementation RNNUIBarButtonItem
14
+ @implementation RNNUIBarButtonItem {
15
+ RNNIconCreator* _iconCreator;
16
+ RNNButtonOptions* _buttonOptions;
17
+ }
15
18
 
16
19
  - (instancetype)init {
17
20
  self = [super init];
@@ -52,7 +55,8 @@
52
55
  - (instancetype)initCustomIcon:(RNNButtonOptions *)buttonOptions
53
56
  iconCreator:(RNNIconCreator *)iconCreator
54
57
  onPress:(RNNButtonPressCallback)onPress {
55
- UIImage *icon = [iconCreator create:buttonOptions];
58
+ _iconCreator = iconCreator;
59
+ UIImage *icon = [_iconCreator create:buttonOptions];
56
60
  UIButton *button =
57
61
  [[UIButton alloc] initWithFrame:CGRectMake(0, 0, icon.size.width, icon.size.height)];
58
62
  [button addTarget:self
@@ -125,6 +129,7 @@
125
129
  }
126
130
 
127
131
  - (void)applyOptions:(RNNButtonOptions *)buttonOptions {
132
+ _buttonOptions = buttonOptions;
128
133
  self.buttonId = buttonOptions.identifier.get;
129
134
  self.accessibilityLabel = [buttonOptions.accessibilityLabel withDefault:nil];
130
135
  self.enabled = [buttonOptions.enabled withDefault:YES];
@@ -134,17 +139,35 @@
134
139
  [self applyDisabledTitleTextAttributes:buttonOptions];
135
140
  }
136
141
 
137
- - (void)applyColor:(UIColor *)color {
138
- if (color) {
142
+ - (void)applyColor:(Color *)color {
143
+ if (color.hasValue) {
139
144
  NSMutableDictionary *titleTextAttributes = [NSMutableDictionary
140
145
  dictionaryWithDictionary:[self titleTextAttributesForState:UIControlStateNormal]];
141
- [titleTextAttributes setValue:color forKey:NSForegroundColorAttributeName];
146
+ [titleTextAttributes setValue:color.get forKey:NSForegroundColorAttributeName];
142
147
  [self setTitleTextAttributes:titleTextAttributes forState:UIControlStateNormal];
143
148
  [self setTitleTextAttributes:titleTextAttributes forState:UIControlStateHighlighted];
144
149
  } else
145
150
  self.image = [self.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
146
151
 
147
- self.tintColor = color;
152
+ self.tintColor = color.get;
153
+ }
154
+
155
+ - (void)mergeBackgroundColor:(Color *)color {
156
+ _buttonOptions.iconBackground.color = color;
157
+ [self redrawIcon];
158
+ }
159
+
160
+ - (void)mergeColor:(Color *)color {
161
+ _buttonOptions.color = color;
162
+ [self applyColor:color];
163
+ [self redrawIcon];
164
+ }
165
+
166
+ - (void)redrawIcon {
167
+ if (_buttonOptions.icon.hasValue && [self.customView isKindOfClass:UIButton.class]) {
168
+ UIImage* icon = [_iconCreator create:_buttonOptions];
169
+ [(UIButton *)self.customView setImage:icon forState:_buttonOptions.state];
170
+ }
148
171
  }
149
172
 
150
173
  - (void)applyTitleTextAttributes:(RNNButtonOptions *)button {
@@ -33,6 +33,13 @@
33
33
  [self removeTitleComponents];
34
34
  self.boundViewController.navigationItem.title = resolvedOptions.title.text.get;
35
35
  }
36
+
37
+ if (options.title.color.hasValue) {
38
+ [_titleViewHelper setTitleColor:options.title.color.get];
39
+ }
40
+ if (options.subtitle.color.hasValue) {
41
+ [_titleViewHelper setSubtitleColor:options.subtitle.color.get];
42
+ }
36
43
  }
37
44
 
38
45
  - (void)setTitleViewWithSubtitle:(RNNTopBarOptions *)options {
@@ -637,6 +637,8 @@ export interface OptionsTopBar {
637
637
 
638
638
  leftButtonColor?: Color;
639
639
  rightButtonColor?: Color;
640
+ leftButtonBackgroundColor?: Color;
641
+ rightButtonBackgroundColor?: Color;
640
642
  leftButtonDisabledColor?: Color;
641
643
  rightButtonDisabledColor?: Color;
642
644
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-navigation",
3
- "version": "7.30.0-alpha.1-snapshot.722",
3
+ "version": "7.30.0",
4
4
  "description": "React Native Navigation - truly native navigation for iOS and Android",
5
5
  "license": "MIT",
6
6
  "nativePackage": true,
@@ -67,10 +67,10 @@
67
67
  "tslib": "1.9.3"
68
68
  },
69
69
  "devDependencies": {
70
- "pixelmatch": "^5.2.1",
71
- "pngjs": "^6.0.0",
70
+ "@babel/core": "7.15.8",
72
71
  "@babel/plugin-proposal-export-default-from": "7.10.1",
73
72
  "@babel/plugin-proposal-export-namespace-from": "7.10.1",
73
+ "@babel/runtime": "7.15.4",
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",
@@ -88,38 +88,37 @@
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": "^27.2.5",
91
+ "babel-jest": "^26.6.3",
92
92
  "clang-format": "^1.4.0",
93
- "detox": "19.12.6",
94
- "eslint": "7.3.0",
93
+ "detox": "19.12.1",
94
+ "detox-testing-library-rnn-adapter": "2.x.x",
95
+ "eslint": "7.32.0",
95
96
  "eslint-config-prettier": "6.11.0",
96
97
  "eslint-plugin-prettier": "3.1.4",
97
98
  "github-release-notes": "https://github.com/yogevbd/github-release-notes/tarball/e601b3dba72dcd6cba323c1286ea6dd0c0110b58",
98
99
  "husky": "4.2.5",
99
100
  "identity-obj-proxy": "3.0.0",
100
- "@babel/core": "7.15.8",
101
- "@babel/runtime": "7.15.4",
102
- "jest": "^27.2.5",
103
- "jest-circus": "^27.2.5",
101
+ "jest": "^26.6.3",
104
102
  "lint-staged": "10.2.11",
105
- "metro-react-native-babel-preset": "0.66.2",
103
+ "metro-react-native-babel-preset": "^0.70.3",
104
+ "pixelmatch": "^5.2.1",
105
+ "pngjs": "^6.0.0",
106
106
  "prettier": "2.1.2",
107
- "react": "17.0.2",
108
- "react-native": "0.66.3",
107
+ "react": "18.0.0",
108
+ "react-native": "0.69.5",
109
109
  "react-native-fast-image": "^8.3.4",
110
110
  "react-native-gesture-handler": "^1.6.1",
111
- "react-native-reanimated": "2.3.0-beta.2",
112
- "react-native-ui-lib": "5.11.0",
111
+ "react-native-reanimated": "2.10.0",
112
+ "react-native-ui-lib": "6.21.0",
113
113
  "react-redux": "5.x.x",
114
- "react-test-renderer": "16.13.1",
114
+ "react-test-renderer": "18.0.0",
115
115
  "redux": "3.x.x",
116
+ "remx": "3.x.x",
116
117
  "semver": "5.x.x",
117
118
  "shell-utils": "1.x.x",
118
119
  "ts-mockito": "^2.3.1",
119
120
  "typedoc": "0.x.x",
120
- "typescript": "4.4.3",
121
- "detox-testing-library-rnn-adapter": "2.x.x",
122
- "remx": "3.x.x"
121
+ "typescript": "4.4.3"
123
122
  },
124
123
  "husky": {
125
124
  "hooks": {
@@ -14,9 +14,6 @@ module.exports = {
14
14
  },
15
15
  },
16
16
  project: {
17
- ios: {
18
- project: './playground/ios/playground.xcworkspace',
19
- },
20
17
  android: {
21
18
  sourceDir: './playground/android/',
22
19
  },