Commit 364ffbe2 authored by Denis Sedura's avatar Denis Sedura

[RNA-780] Extract LabelPreview

parent 19c070d9
......@@ -28,12 +28,15 @@ function enhanceItemDetails(Wine, Drink, AddToCartView) {
static propTypes = {
itemType: PropTypes.oneOf(['wine', 'drink']).isRequired,
storeId: PropTypes.number,
user: PropTypes.object,
item: PropTypes.object.isRequired,
inventory: PropTypes.object,
createUserFavorite: PropTypes.func.isRequired,
removeUserFavorite: PropTypes.func.isRequired,
}
static defaultProps = {
user: undefined,
storeId: undefined,
inventory: undefined,
}
......@@ -48,10 +51,9 @@ function enhanceItemDetails(Wine, Drink, AddToCartView) {
}
handlePressLabelPreview = () => {
// this.props.navigation.navigator.push('LabelPreview', {
// source: this.props.logo,
// })
console.log('LabelPreview')
const { itemType, item } = this.props
const { logo } = itemFormatter(itemType, item)
Router.push(null, Router.routes.labelPreview, { source: logo })
}
handlePressItemReviews = () => {
......
import React, { Component } from 'react'
import ImageSourcePropType from 'react-native/Libraries/Image/ImageSourcePropType'
import { Router } from 'tipsi-router'
function enhanceLabelPreview(ComposedComponent) {
return class Wrapper extends Component {
static propTypes = {
source: ImageSourcePropType,
}
static defaultProps = {
source: undefined,
}
state = { loading: false }
componentWillMount() {
Router.setTitle('Label Preview')
}
handleLoadStart = () => this.setState({ loading: true })
handleLoadEnd = () => this.setState({ loading: false })
handlePress = () => Router.pop()
render() {
return (
<ComposedComponent
{...this.state}
{...this.props}
handleLoadStart={this.handleLoadStart}
handleLoadEnd={this.handleLoadEnd}
handlePress={this.handlePress}
/>
)
}
}
}
export default enhanceLabelPreview
export { default as enhanceLabelPreview } from './LabelPreview'
......@@ -3,3 +3,4 @@ export { enhanceInitialComponent } from './InitialScreen'
export { enhanceAgeConfirmation } from './AgeConfirmation'
export { enhanceMain } from './Main'
export { enhanceItemDetails } from './ItemDetails'
export { enhanceLabelPreview } from './LabelPreview'
import { reduce, keys } from 'lodash'
import { enhanceAppComponent, enhanceItemDetails } from './Screens'
import { enhanceAppComponent, enhanceItemDetails, enhanceLabelPreview } from './Screens'
import { enhanceSearch } from './Screens/Search'
import { enhanceLogin } from './Screens/Login'
......@@ -20,6 +20,10 @@ const routesMap = {
path: 'login',
component: enhanceLogin,
},
labelPreview: {
path: 'labelPreview',
component: enhanceLabelPreview,
},
}
export function createRoutes(routes = {}) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment