Skip to content

Marshalling code has no effect when run #5637

@mrdavidrees

Description

@mrdavidrees

I have looked at almost every available article about changing the action bar background to translucent. (amongst other things). It wasn't until I stumbled on someone else's struggles here that I thought this could be a legitimate bug.

I have established that this code is running, verified that it is not being applied by debugging in Xcode and placed the code in many different parts of the application run time.
I need to get at least one example of marshalling to work in order to have confidence that we can use nativescript in our future apps.

Which platform(s) does your issue occur on?

iOS

All NativeScript components versions information
┌──────────────────┬─────────────────┬────────────────┬─────────────┐
│ Component        │ Current version │ Latest version │ Information │
│ nativescript     │ 3.4.3           │ 3.4.3          │ Up to date  │
│ tns-core-modules │ 3.4.1           │ 3.4.1          │ Up to date  │
│ tns-android      │ 3.4.2           │ 3.4.2          │ Up to date  │
│ tns-ios          │ 3.4.1           │ 3.4.1          │ Up to date  │
└──────────────────┴─────────────────┴────────────────┴─────────────┘

Here is the code that has no effect.

declare var UIImage: any;
declare var UIColor: any;
declare var UIBarMetrics: any;
declare var NSDictionary: any;
declare var NSForegroundColorAttributeName: any;

---

ngOnInit() {
    if (this.page.ios) {
      console.log("This code is running") //Successfully printed

      this.page.actionBarHidden = false;
      this.page.statusBarStyle = "dark";
      this.page.backgroundSpanUnderStatusBar = true;

      var navigationBar = topmost().ios.controller.navigationBar;
      navigationBar.barTintColor = UIColor.colorWithRedGreenBlueAlpha(
        0.011,
        0.278,
        0.576,
        1
      );
      navigationBar.titleTextAttributes = new NSDictionary(
        [UIColor.whiteColor],
        [NSForegroundColorAttributeName]
      );
      navigationBar.barStyle = 1;
      navigationBar.tintColor = UIColor.whiteColor;
      navigationBar.setBackgroundImageForBarMetrics(
        UIImage.new(),
        UIBarMetrics.Default
      );
      navigationBar.shadowImage = UIImage.new();
      navigationBar.translucent = false;

     console.log("This code did run") //Successfully printed
    }
  }

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions