Authored by 于良

品牌搜索 review by 草莓

... ... @@ -20,11 +20,8 @@ import YH_SearchBar from '../../../common/components/YH_SearchBar';
import ChannelFliter from './ChannelFliter';
import AllBrandListCell from './AllBrandListCell';
import NewHotBannerListCell from './NewHotBannerListCell';
<<<<<<< HEAD
import BrandSearch from './BrandSearch';
=======
import LoadingIndicator from '../../../common/components/LoadingIndicator';
>>>>>>> 922f50ee4cba09108dd8fc7fb3fbe67f376b7f74
export default class Brand extends Component {
... ... @@ -75,9 +72,15 @@ export default class Brand extends Component {
activeOpacity={1}
onPress={() => {
this.props.onPressSearch && this.props.onPressSearch();
// this.searchBar && this.searchBar.focus();
}}
>
<YH_SearchBar editable={false} />
<YH_SearchBar
ref={(c) => {
this.searchBar = c;
}}
editable={false}
/>
</TouchableOpacity>
{banner?<BrandSwiper resource={banner} onPressSlideItem={this.props.onPressSlideItem}/>:null}
{custom_brands?<BannerReourceList resource={custom_brands} onPressSlideItem={this.props.onPressSlideItem}/>:null}
... ... @@ -109,11 +112,8 @@ export default class Brand extends Component {
render() {
let {
<<<<<<< HEAD
showSearch,
=======
isFetching,
>>>>>>> 922f50ee4cba09108dd8fc7fb3fbe67f376b7f74
brandFliter,
channelFliter,
brandListForBoy,
... ... @@ -176,7 +176,10 @@ export default class Brand extends Component {
renderHeader={this.renderHeader}
/>
{showSearch ? <BrandSearch style={styles.search} data={search}/> : null}
{showSearch ? <BrandSearch
data={search}
onTextChange={this.props.onTextChange}
onClickCancel={this.props.onClickCancel} /> : null}
<LoadingIndicator
isVisible={isFetching}
... ... @@ -217,8 +220,4 @@ let styles = StyleSheet.create({
width,
backgroundColor: '#e5e5e5',
},
search: {
},
});
... ...
... ... @@ -74,6 +74,8 @@ export default class SearchKeyword extends Component {
ref={(c) => {
this.searchBar = c;
}}
onClickCancel={this.props.onClickCancel}
onTextChange={this.props.onTextChange}
/>
<ListView
contentContainerStyle={styles.contentContainer}
... ...
... ... @@ -52,7 +52,8 @@ class BrandContainer extends Component {
this._onChannelPressFliter = this._onChannelPressFliter.bind(this);
this._onPressSearch = this._onPressSearch.bind(this);
this._onPressClearHistory = this._onPressClearHistory.bind(this);
this._onClickCancelSearch = this._onClickCancelSearch.bind(this);
this._onSearchTextChange = this._onSearchTextChange.bind(this);
}
componentDidMount() {
... ... @@ -66,13 +67,8 @@ class BrandContainer extends Component {
}
<<<<<<< HEAD
_onPressSlideItem(url) {
console.log('aaa');
=======
_onPressSlideItem(url){
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
>>>>>>> 922f50ee4cba09108dd8fc7fb3fbe67f376b7f74
}
_onPressFilter(value) {
... ... @@ -124,6 +120,14 @@ class BrandContainer extends Component {
this.props.actions.clearSearchHistory();
}
_onClickCancelSearch() {
this.props.actions.setShowSearch(!this.props.brand.showSearch);
}
_onSearchTextChange(text) {
this.props.actions.filteBrandForKeyword(text);
}
render() {
let {
showSearch,
... ... @@ -162,6 +166,8 @@ class BrandContainer extends Component {
search={search}
onPressSearch={this._onPressSearch}
onPressClearHistory={this._onPressClearHistory}
onClickCancel={this._onClickCancelSearch}
onTextChange={this._onSearchTextChange}
/>
</View>
);
... ...
... ... @@ -471,4 +471,14 @@ function parseHotKeyword(json) {
return {
list,
};
}
export function filteBrandForKeyword(text) {
return (dispatch, getState) => {
let {app, brand} = getState();
let {search} = brand;
};
}
\ No newline at end of file
... ...
... ... @@ -39,19 +39,19 @@ export default class YH_SearchBar extends Component {
}
_onBeginEditing(e) {
console.log(e)
this.props.onBeginEditing && this.props.onBeginEditing(e.nativeEvent);
}
_onEndEditing(e) {
console.log(e)
this.props.onEndEditing && this.props.onEndEditing(e.nativeEvent);
}
_onTextChange(e) {
console.log(e)
this.props.onTextChange && this.props.onTextChange(e.nativeEvent);
}
_onClickCancel(e) {
console.log(e)
this.props.onClickCancel && this.props.onClickCancel(e.nativeEvent);
}
blur() {
... ...