Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.

Commit

Permalink
Merge pull request #38 from manijak/master
Browse files Browse the repository at this point in the history
iOS refactor, removing the Swift-pod
  • Loading branch information
NathanWalker authored Dec 21, 2016
2 parents 0850b6f + 231becc commit dac2ba0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
38 changes: 21 additions & 17 deletions cardview.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ import {PropertyMetadata} from 'ui/core/proxy';
import {Property, PropertyMetadataSettings} from 'ui/core/dependency-observable';
import { screen } from 'platform';
import * as uiUtils from 'ui/utils';
import style = require("ui/styling/style");
import style = require('ui/styling/style');


declare var MaterialCard: any, UIApplication: any, CGRectMake: any;
declare var UIView: any, UIApplication: any, CGRectMake: any, CGSizeMake: any;

export class CardView extends ContentView {
private _ios: MaterialCard;
private _ios: UIView;

constructor() {
super();
let width = screen.mainScreen.widthDIPs - 20;
this._ios = new MaterialCard(CGRectMake(10, 30, width, 0));

// Default values for MaterialCard
// radius = 2;
// shadowOffsetWidth = 0;
// shadowOffsetHeight = 2;
// shadowColor = new Color('#000').ios
// shadowOpacity = 0.4;
this._ios = new UIView(CGRectMake(10, 30, width, 0));
this._ios.layer.masksToBounds = false;

this.shadowColor = "black";
this.radius = "0";
this.shadowRadius = "1";
this.shadowOpacity = "0.2";
this.shadowOffsetHeight = "2";
this.shadowOffsetWidth = "0";
}

get ios(): any {
Expand All @@ -34,23 +34,27 @@ export class CardView extends ContentView {
}

set radius(value: string) {
this._ios.cornerRadius = +value;
this._ios.layer.cornerRadius = +value;
}

set shadowRadius(value: string) {
this._ios.layer.shadowRadius = +value;
}

set shadowOffsetWidth(value: string) {
this._ios.shadowOffsetWidth = +value;
this._ios.layer.shadowOffsetWidth = CGSizeMake(value, this._ios.layer.shadowOffset.height);
}

set shadowOffsetHeight(value: string) {
this._ios.shadowOffsetHeight = +value;
this._ios.layer.shadowOffsetHeight = CGSizeMake(this._ios.layer.shadowOffset.width, value);
}

set shadowColor(value: string) {
this._ios.shadowColor = new Color(value).ios;
this._ios.layer.shadowColor = new Color(value).ios.cgColor;
}

set shadowOpacity(value: string) {
this._ios.shadowOpacity = +value;
this._ios.layer.shadowOpacity = +value;
}

}
Expand Down
7 changes: 6 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export declare class CardView extends ContentView {
android: any /* android.support.v7.widget.CardView */;

/**
* Gets the native [ios widget](https://github.com/NathanWalker/MaterialCard) that represents the user interface for this component. Valid only when running on iOS.
* Gets the native [ios widget](UIView) that represents the user interface for this component. Valid only when running on iOS.
*/
ios: any /* MaterialCard */;

Expand All @@ -20,6 +20,11 @@ export declare class CardView extends ContentView {
*/
radius: any;

/**
* Gets or set the shadow radius of the card view.
*/
shadowRadius: any;

/**
* Gets or set the elevation of the card view. ** Valid only when running on Android OS **
*/
Expand Down
1 change: 0 additions & 1 deletion platforms/ios/Podfile

This file was deleted.

0 comments on commit dac2ba0

Please sign in to comment.