lint script and some fixes

This commit is contained in:
Bart Akeley 2017-06-04 11:37:38 -05:00
parent 1e9fd7940b
commit 29cbffcf38
5 changed files with 11 additions and 9 deletions

View file

@ -4,6 +4,7 @@ import { View, TouchableOpacity, Text, TextInput } from 'react-native';
import Modal from 'react-native-modal';
import { pure } from 'recompose';
import style from '../ui-theme';
import { Icon } from 'react-native-material-ui';
export default pure(({ children, isVisible }) => (
<Modal isVisible={isVisible}>

View file

@ -4,13 +4,12 @@ import { getQuantityText } from '../helpers/QuantityHelpers';
import { Picker, View } from 'react-native';
import theme from '../ui-theme';
import { pure } from 'recompose';
import { type Quantity } from '../records/FoodItemRecord';
import { type Quantity, QUANTITIES } from '../records/FoodItemRecord';
const { quantityPicker: style } = theme;
const possibleQuantities = ['none', 'few', 'alot', 'plenty'];
const renderQuantityItem = (selectedQuantity: Quantity) => quantity => (
/* eslint-disable react/display-name */
const renderQuantityItem = (selectedQuantity: Quantity) => (quantity: Quantity) => (
<Picker.Item
key={quantity}
label={getQuantityText(quantity)}
@ -23,7 +22,7 @@ type QuantityPickerProps = { quantity: Quantity, onValueChange: Function, style:
const QuantityPicker = pure(({ quantity, onValueChange }: QuantityPickerProps) => (
<View style={{ flex: 1 }}>
<Picker selectedValue={quantity} onValueChange={onValueChange} style={[{ flex: 1 }, style]}>
{possibleQuantities.map(renderQuantityItem(quantity))}
{QUANTITIES.map(renderQuantityItem(quantity))}
</Picker>
</View>
));

View file

@ -3,7 +3,7 @@ import React, { Component } from 'react';
import { Image, View } from 'react-native';
import theme from '../ui-theme';
import { NameAndPlace } from '../components/ItemTile';
import { type FoodItem, type Quantity, QUANTIY_MANY } from '../records/FoodItemRecord';
import { type FoodItem, type Quantity, QUANTITY_MANY } from '../records/FoodItemRecord';
import typeof PlaceRecord from '../records/PlaceRecord';
import { compose, pure } from 'recompose';
import IconButton from '../components/IconButton';
@ -39,7 +39,7 @@ export class FoodItemDetail extends Component {
state = {
currentImage: 0,
quantity: QUANTIY_MANY,
quantity: QUANTITY_MANY,
};
// TODO placeholder implementation until we get a backend

View file

@ -3,8 +3,9 @@ import { Record } from 'immutable';
export const QUANTITY_NONE: 'none' = 'none';
export const QUANTITY_FEW: 'few' = 'few';
export const QUANTIY_MANY: 'many' = 'many';
export type Quantity = typeof QUANTITY_NONE | typeof QUANTITY_FEW | typeof QUANTIY_MANY;
export const QUANTITY_MANY: 'many' = 'many';
export type Quantity = typeof QUANTITY_NONE | typeof QUANTITY_FEW | typeof QUANTITY_MANY;
export const QUANTITIES = [QUANTITY_NONE, QUANTITY_FEW, QUANTITY_MANY];
export type FoodItem = {
id: ?number,

View file

@ -5,6 +5,7 @@
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"lint": "flow && eslint js",
"android": "react-native run-android"
},
"dependencies": {