// withHooks
// noPage
import esp from 'esoftplay/esp';
import useSafeState from 'esoftplay/state';


import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
import { LibPicture } from 'esoftplay/cache/lib/picture/import';
import { LibStyle } from 'esoftplay/cache/lib/style/import';

import React, { useMemo } from 'react';
import { Image, PixelRatio, TouchableOpacity, View } from 'react-native';


export interface MarketHome_section_productArgs {

}
export interface MarketHome_section_productProps {
  block: any
}
export default function m(props: MarketHome_section_productProps): any {

  const [wh, setWh] = useSafeState([LibStyle.width * 0.5, 23])

  useMemo(() => {
    Image.getSize(props.block.image_title, (w, h) => {
      const _wh = [(w / PixelRatio.get()) / (h / PixelRatio.get()) * 23, 23]
      setWh(_wh)
    })
  }, [])

  return (
    <View style={{ marginTop: 10, marginBottom: -10, marginLeft: 10, marginRight: 16, alignItems: 'center', flexDirection: 'row' }} >
      <LibPicture source={{ uri: props.block.image_title }} style={{ width: wh[0], height: wh[1] }} resizeMode="contain" />
      <View style={{ flex: 1 }} />
      {
        (props.block?.params?.more_module != '' && props.block?.show_more == 1) &&
        <TouchableOpacity onPress={() => (props.block?.params?.more_module != '' && props.block?.show_more == 1) ? LibNavigation.navigate(props.block?.params?.more_module, { url: props.block?.params?.more_url, title: props.block?.title }) : {}} >
          <LibPicture source={esp.assets('market/ic_btn_more_rounded.png')} style={{ height: 25, width: 25, resizeMode: 'contain' }} />
        </TouchableOpacity>
      }
    </View>
  )
}