<|start_filename|>app/views/settings/elements/stock-cell.js<|end_filename|>
import React from 'react';
import {
  StyleSheet,
  Text,
  View,
} from 'react-native';

// Flux
import StockActions from '../../../actions/stock-action';

// 3rd party libraries
import Icon from 'react-native-vector-icons/MaterialIcons';

export default class StockCell extends React.Component {
  _onPressDelete(symbol) {
    console.log('_onPressDelete', symbol);
    StockActions.deleteStock(symbol);
  }

  render() {
    return (
      <View style={styles.container}>
        <Icon
          style={styles.deleteIcon}
          name="remove-circle"
          color="red"
          size={22}
          onPress={() => this._onPressDelete(this.props.stock.symbol)} />
        <View style={styles.stock}>
          <View style={styles.symbol}>
            <Text style={styles.symbolText}>
              {this.props.stock.symbol}
            </Text>
            <Text style={styles.marketText}>
              {this.props.watchlistResult && this.props.watchlistResult[this.props.stock.symbol] && this.props.watchlistResult[this.props.stock.symbol].StockExchange}
            </Text>
          </View>
          <View style={styles.name}>
            <Text style={styles.nameText}>
              {this.props.watchlistResult && this.props.watchlistResult[this.props.stock.symbol] && this.props.watchlistResult[this.props.stock.symbol].Name}
            </Text>
          </View>
        </View>
        <Icon style={styles.move} name="menu" color="white" size={22} />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: 'black',
    flexDirection: 'row',
    justifyContent: 'center',
    marginHorizontal: 15,
    height: 65,
    borderBottomColor: '#CCCCCC',
    borderBottomWidth: StyleSheet.hairlineWidth,
  },
  deleteIcon: {
    flex: 1,
    alignSelf: 'center',
  },
  deleteText: {
    fontSize: 15,
    color: '#FC3D39',
    textAlign: 'left',
    marginTop: 20,
    marginBottom: 10,
    marginRight: 10,
  },
  stock: {
    flex: 8,
    flexDirection: 'column',
  },
  symbol: {
    flex: 1,
    flexDirection: 'row',
  },
  symbolText: {
    fontSize: 15,
    color: 'white',
    textAlign: 'left',
    marginTop: 10,
    marginBottom: 5,
    marginRight: 10,
  },
  marketText: {
    fontSize: 15,
    color: '#A6A6A6',
    textAlign: 'left',
    marginTop: 10,
    marginBottom: 5,
    marginRight: 10,
  },
  name: {
    flex: 1,
  },
  nameText: {
    fontSize: 10,
    color: 'white',
    textAlign: 'left',
    marginTop: 5,
    marginBottom: 5,
    marginRight: 10,
  },
  move: {
    flex: 1,
    alignSelf: 'center',
  },
  moveText: {
    fontSize: 15,
    color: 'white',
    textAlign: 'left',
    marginTop: 20,
    marginBottom: 10,
    marginRight: 10,
  },
});


<|start_filename|>app/utils/rss.js<|end_filename|>
module.exports = function(url) {
  const GOOGLE_FEED_API_URL = 'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=-1&q=';
  url = GOOGLE_FEED_API_URL + encodeURIComponent(url);

  return fetch(url).then((res) => res.json());
};


<|start_filename|>index.ios.js<|end_filename|>
import {
  AppRegistry,
  StatusBar,
} from 'react-native';
import Finance from './Finance';

StatusBar.setBarStyle('light-content', true);

AppRegistry.registerComponent('Finance', () => Finance);


<|start_filename|>app/utils/functions.js<|end_filename|>
/* @flow */
exports.dynamicSort = function(property: string) : Function {
  var sortOrder = 1;
  if (property[0] === '-') {
    sortOrder = -1;
    property = property.substr(1);
  }
  return function(a, b) {
    var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0;
    return result * sortOrder;
  };
};

exports.removeObjectfromArray = function(array: Array<Object>, key: string, value: string | number) : Array<Object> {
  return array.filter((el) => el[key] !== value);
};

exports.changeObjectinArray = function(array: Array<Object>, key: string, oldValue: string | number, newValue: string | number) : Array<Object> {
  array.forEach((item) => {
    if (item[key] === oldValue) {
      item[key] = newValue;
    }
  });
  return array;
};

exports.moveObjectinArray = function(array: Array<Object>, key: string, step: number) : Array<Object> {
  let index = array.map((item) => item.symbol).indexOf(key);
  let value = array[index];
  let newPos = index + step;

  if (newPos < 0) {
    newPos = 0;
  } else if (newPos > array.length) {
    newPos = array.length;
  }

  array.splice(index,1);
  array.splice(newPos, 0, value);
  return array;
};


<|start_filename|>index.android.js<|end_filename|>
import {
  AppRegistry
} from 'react-native';
import Finance from './Finance';

AppRegistry.registerComponent('Finance', () => Finance);


<|start_filename|>app/utils/data.js<|end_filename|>
/* @flow */
exports.mock = [{
  AfterHoursChangeRealtime: null,
  AnnualizedGain: null,
  Ask: "114.76",
  AskRealtime: null,
  AverageDailyVolume: "59604800",
  Bid: "114.44",
  BidRealtime: null,
  BookValue: "22.03",
  Change: "-0.29",
  ChangeFromFiftydayMovingAverage: "1.72",
  ChangeFromTwoHundreddayMovingAverage: "-8.43",
  ChangeFromYearHigh: "-19.83",
  ChangeFromYearLow: "22.71",
  ChangePercentRealtime: null,
  ChangeRealtime: null,
  Change_PercentChange: "-0.29 - -0.25%",
  ChangeinPercent: "-0.25%",
  Commission: null,
  Currency: "USD",
  DaysHigh: "116.69",
  DaysLow: "114.02",
  DaysRange: "114.02 - 116.69",
  DaysRangeRealtime: null,
  DaysValueChange: null,
  DaysValueChangeRealtime: null,
  DividendPayDate: "8/13/2015",
  DividendShare: "2.08",
  DividendYield: "1.82",
  EBITDA: "77.88B",
  EPSEstimateCurrentYear: "9.13",
  EPSEstimateNextQuarter: "3.18",
  EPSEstimateNextYear: "9.77",
  EarningsShare: "8.65",
  ErrorIndicationreturnedforsymbolchangedinvalid: null,
  ExDividendDate: "8/6/2015",
  FiftydayMovingAverage: "112.99",
  HighLimit: null,
  HoldingsGain: null,
  HoldingsGainPercent: null,
  HoldingsGainPercentRealtime: null,
  HoldingsGainRealtime: null,
  HoldingsValue: null,
  HoldingsValueRealtime: null,
  LastTradeDate: "9/25/2015",
  LastTradePriceOnly: "114.71",
  LastTradeRealtimeWithTime: null,
  LastTradeTime: "4:00pm",
  LastTradeWithTime: "4:00pm - <b>114.71</b>",
  LowLimit: null,
  MarketCapRealtime: null,
  MarketCapitalization: "654.16B",
  MoreInfo: null,
  Name: "<NAME>.",
  Notes: null,
  OneyrTargetPrice: "145.77",
  Open: "116.36",
  OrderBookRealtime: null,
  PEGRatio: "0.86",
  PERatio: "13.27",
  PERatioRealtime: null,
  PercebtChangeFromYearHigh: "-14.74%",
  PercentChange: "-0.25%",
  PercentChangeFromFiftydayMovingAverage: "+1.52%",
  PercentChangeFromTwoHundreddayMovingAverage: "-6.85%",
  PercentChangeFromYearLow: "+24.68%",
  PreviousClose: "115.00",
  PriceBook: "5.22",
  PriceEPSEstimateCurrentYear: "12.56",
  PriceEPSEstimateNextYear: "11.74",
  PricePaid: null,
  PriceSales: "2.92",
  SharesOwned: null,
  ShortRatio: "1.05",
  StockExchange: "NMS",
  Symbol: "AAPL",
  TickerTrend: null,
  TradeDate: null,
  TwoHundreddayMovingAverage: "123.14",
  Volume: "56151926",
  YearHigh: "134.54",
  YearLow: "92.00",
  YearRange: "92.00 - 134.54",
  symbol: "AAPL",
}, {
  AfterHoursChangeRealtime: null,
  AnnualizedGain: null,
  Ask: "612.60",
  AskRealtime: null,
  AverageDailyVolume: "2552810",
  Bid: "611.12",
  BidRealtime: null,
  BookValue: "163.07",
  Change: "-13.83",
  ChangeFromFiftydayMovingAverage: "-16.75",
  ChangeFromTwoHundreddayMovingAverage: "39.49",
  ChangeFromYearHigh: "-66.67",
  ChangeFromYearLow: "125.74",
  ChangePercentRealtime: null,
  ChangeRealtime: null,
  Change_PercentChange: "-13.83 - -2.21%",
  ChangeinPercent: "-2.21%",
  Commission: null,
  Currency: "USD",
  DaysHigh: "629.77",
  DaysLow: "611.00",
  DaysRange: "611.00 - 629.77",
  DaysRangeRealtime: null,
  DaysValueChange: null,
  DaysValueChangeRealtime: null,
  DividendPayDate: null,
  DividendShare: null,
  DividendYield: null,
  EBITDA: "22.62B",
  EPSEstimateCurrentYear: "28.88",
  EPSEstimateNextQuarter: "8.11",
  EPSEstimateNextYear: "33.75",
  EarningsShare: "21.22",
  ErrorIndicationreturnedforsymbolchangedinvalid: null,
  ExDividendDate: null,
  FiftydayMovingAverage: "628.72",
  HighLimit: null,
  HoldingsGain: null,
  HoldingsGainPercent: null,
  HoldingsGainPercentRealtime: null,
  HoldingsGainRealtime: null,
  HoldingsValue: null,
  HoldingsValueRealtime: null,
  LastTradeDate: "9/25/2015",
  LastTradePriceOnly: "611.97",
  LastTradeRealtimeWithTime: null,
  LastTradeTime: "4:00pm",
  LastTradeWithTime: "4:00pm - <b>611.97</b>",
  LowLimit: null,
  MarketCapRealtime: null,
  MarketCapitalization: "419.53B",
  MoreInfo: null,
  Name: "<NAME>.",
  Notes: null,
  OneyrTargetPrice: "645.00",
  Open: "629.77",
  OrderBookRealtime: null,
  PEGRatio: "1.22",
  PERatio: "28.83",
  PERatioRealtime: null,
  PercebtChangeFromYearHigh: "-9.82%",
  PercentChange: "-2.21%",
  PercentChangeFromFiftydayMovingAverage: "-2.66%",
  PercentChangeFromTwoHundreddayMovingAverage: "+6.90%",
  PercentChangeFromYearLow: "+25.86%",
  PreviousClose: "625.80",
  PriceBook: "3.84",
  PriceEPSEstimateCurrentYear: "21.19",
  PriceEPSEstimateNextYear: "18.13",
  PricePaid: null,
  PriceSales: "6.16",
  SharesOwned: null,
  ShortRatio: "1.90",
  StockExchange: "NMS",
  Symbol: "GOOG",
  TickerTrend: null,
  TradeDate: null,
  TwoHundreddayMovingAverage: "572.48",
  Volume: "2174009",
  YearHigh: "678.64",
  YearLow: "486.23",
  YearRange: "486.23 - 678.64",
  symbol: "GOOG",
}];
