Authored by chenl

修改了筛选的样式,增加了SearchBar的android兼容。

... ... @@ -129,7 +129,7 @@ let styles = StyleSheet.create({
backgroundColor: '#ffffff',
borderTopColor: '#e0e0e0',
borderLeftColor: '#ffffff',
borderBottomColor: '#e0e0e0',
borderBottomColor: '#ffffff',
borderWidth: 0.5,
},
leftContentContainer: {
... ...
import React from 'react';
import ReactNative from 'react-native';
import {Platform} from 'react-native';
const {
PropTypes,
... ... @@ -12,6 +13,8 @@ const {
const YH_SearchBarView = ReactNative.requireNativeComponent('YH_SearchBarView', null);
var UIManager = require('UIManager');
export default class YH_SearchBar extends Component {
static propTypes = {
placeholder: PropTypes.string,
... ... @@ -59,15 +62,40 @@ export default class YH_SearchBar extends Component {
}
blur() {
return NativeModules.YH_SearchBarViewManager.blur(ReactNative.findNodeHandle(this));
if (Platform.OS === 'ios') {
return NativeModules.YH_SearchBarViewManager.blur(ReactNative.findNodeHandle(this));
}
else{
return UIManager.dispatchViewManagerCommand(
ReactNative.findNodeHandle(this),
UIManager.YH_SearchBarView.Commands.blur, null
);
}
}
focus() {
return NativeModules.YH_SearchBarViewManager.focus(ReactNative.findNodeHandle(this));
if (Platform.OS === 'ios') {
return NativeModules.YH_SearchBarViewManager.focus(ReactNative.findNodeHandle(this));
}
else{
return UIManager.dispatchViewManagerCommand(
ReactNative.findNodeHandle(this),
UIManager.YH_SearchBarView.Commands.focus, null
);
}
}
unFocus() {
return NativeModules.YH_SearchBarViewManager.unFocus(ReactNative.findNodeHandle(this));
if (Platform.OS === 'ios') {
return NativeModules.YH_SearchBarViewManager.unFocus(ReactNative.findNodeHandle(this));
}
else{
return UIManager.dispatchViewManagerCommand(
ReactNative.findNodeHandle(this),
UIManager.YH_SearchBarView.Commands.unFocus, null
);
}
}
render() {
... ... @@ -80,7 +108,6 @@ export default class YH_SearchBar extends Component {
onEndEditing={this._onEndEditing}
onTextChange={this._onTextChange}
onClickCancel={this._onClickCancel}
/>
);
}
... ...