Since the css linear-gradient isn’t part of NativeScript core yet I went looking for the ability to do this online. I found a git conversation over at https://github.com/NativeScript/NativeScript/issues/539 that discussed and shared some code.
The code doesn’t work on iOS as expected. There were some typos in the code that need to be adjusted and wrong variables. I’ve made those adjustments and you can copy below a functioning version.
var gradients = require("~/grad-bg.js");
Import the function via the require method. Then in your page loaded function call the function on your view. Make sure to set the view’s id in your xml file and use that id here as the second parameter: