diff --git a/src/container/ListingContainer/index.js b/src/container/ListingContainer/index.js index 856c72c..bcdacfc 100644 --- a/src/container/ListingContainer/index.js +++ b/src/container/ListingContainer/index.js @@ -645,7 +645,6 @@ export default class ListingContainer extends React.Component { this.props.taxesStore .edit(text, this.props.stateStore.listing_state[0].taxObjects) .then(result => { - // this.setState({ taxObjects: result.slice() }); this.props.stateStore.changeValue( "taxObjects", result.slice(), @@ -672,12 +671,13 @@ export default class ListingContainer extends React.Component { } }; - onEndReached = value => { - if (value === "itemStore") { + onEndReached = () => { + const { tabStatus } = this.props.stateStore.listing_state[0]; + if (tabStatus === "0") { this.props.itemStore.getFromDb(20); - } else if (value === "categoryStore") { + } else if (tabStatus === "1") { this.props.categoryStore.getFromDb(20); - } else if (value === "discountStore") { + } else if (tabStatus === "2") { this.props.discountStore.getFromDb(20); } }; @@ -695,7 +695,7 @@ export default class ListingContainer extends React.Component { currency={getCountryCode(this.props.printerStore)} onClick={this.onItemClick} onLongPress={this.onItemLongPress} - onEndReached={() => this.onEndReached("itemStore")} + onEndReached={this.onEndReached} > this.onEndReached("categoryStore")} + onEndReached={this.onEndReached} > this.onEndReached("discountStore")} + onEndReached={this.onEndReached} > - {strings.Color} + {this.colorPicker()} @@ -57,9 +60,9 @@ export default class ColorShapeInputComponent extends React.PureComponent { width: Dimensions.get("window").width / 15, }} > - {strings.Color}: + {strings.Color}: - {this.colorPicker()} + {this.colorPicker()} - {strings.Shape}: + {strings.Shape}: - + this.props.onChangeShape(text)} + onValueChange={this.props.onChangeShape} > @@ -85,15 +88,15 @@ export default class ColorShapeInputComponent extends React.PureComponent { {this.props.value[0].shape && this.props.value[0].color ? ( - + ) : ( - + )} ); @@ -115,10 +118,11 @@ const styles = StyleSheet.create({ borderWidth: 1.5, borderColor: "#D9D5DC", }, + col: { + justifyContent: "center", + }, text: { - color: "black", fontWeight: "bold", - marginBottom: 10, }, rightCol: { paddingLeft: 10, diff --git a/src/stories/components/IdleComponent.js b/src/stories/components/IdleComponent.js index 4e138ea..7049d3b 100644 --- a/src/stories/components/IdleComponent.js +++ b/src/stories/components/IdleComponent.js @@ -1,36 +1,21 @@ import * as React from "react"; +import { StyleSheet } from "react-native"; import { View, Text, Button } from "native-base"; import { currentLanguage } from "../../translations/CurrentLanguage"; import translation from "../.././translations/translation"; import LocalizedStrings from "react-native-localization"; let strings = new LocalizedStrings(translation); + const IdleComponent = props => ( - + {strings.setLanguage(currentLanguage().companyLanguage)} - - + + {strings.WouldYouLikeToCreateNew} {props.type}? - - - - {this.props.printerStatus} + + {" "} + {strings.PrintBarcode} - - ) : null} - + + + + {this.props.printerStatus} + + + ) : null} + - { - this.props.onAdd(this.state); - this.clear(); - }} - onEdit={() => { - this.props.onEdit(this.state); - this.clear(); - }} - onCancel={() => { - this.props.onCancel(); - this.clear(); - }} - text="Item" - /> - - ); - } + + + ); } } diff --git a/src/stories/screens/Listing/index.js b/src/stories/screens/Listing/index.js index 142adf1..021a1e4 100644 --- a/src/stories/screens/Listing/index.js +++ b/src/stories/screens/Listing/index.js @@ -9,7 +9,7 @@ import { Title, Right, } from "native-base"; -import { Dimensions, TouchableOpacity } from "react-native"; +import { TouchableOpacity } from "react-native"; import Icon from "react-native-vector-icons/FontAwesome"; import SearchComponent from "@components/SearchComponent"; @@ -20,14 +20,8 @@ import styles from "./styles"; import translation from "../../../translations/translation"; import LocalizedStrings from "react-native-localization"; let strings = new LocalizedStrings(translation); -// TODO: Make a future utils for measuring boys -export default class ItemListing extends React.PureComponent { - constructor(props) { - super(props); - const { width, height } = Dimensions.get("window"); - this.state = { width, height }; - } +export default class ItemListing extends React.PureComponent { navigate = () => { this.props.navigation.navigate("DrawerOpen"); }; @@ -36,12 +30,7 @@ export default class ItemListing extends React.PureComponent { this.props.itemMaintenanceStatusChange(true); }; - onLayout() { - const { width, height } = Dimensions.get("window"); - this.setState({ width, height }); - } - - renderSearch() { + renderSearch = () => { const { onChangeText, itemMaintenanceStatusChange } = this.props; return ( ); - } + }; - renderSearchButton() { + renderSearchButton = () => { return ( @@ -60,9 +49,9 @@ export default class ItemListing extends React.PureComponent { ); - } + }; - renderHeader() { + renderHeader = () => { return (
@@ -76,21 +65,20 @@ export default class ItemListing extends React.PureComponent { {this.props.tabStatus === 0 ? this.renderSearchButton() : }
); - } + }; + + _onChangeTab = ({ i, ref, from }) => { + this.props.changeTabStatus(i.toString()); + }; render() { strings.setLanguage(currentLanguage().companyLanguage); return ( - this.onLayout()}> + {this.props.itemMaintenanceStatus ? this.renderSearch() : this.renderHeader()} - - this.props.changeTabStatus(i.toString()) - } - > +