方法
#setAfterSearchInputComponent(AfterSearchInputComponent)
您可以使用它在搜索栏之后添加一个组件。
参数:
的名字 | 类型 | 描述 |
---|---|---|
AfterSearchInputComponent |
React.ComponentType。<AfterSearchInputComponent> |
例子
const CustomAfterSearchInputComponent = props => {return 请在搜索栏中输入一个词开始搜索 }
#setBeforeSearchInputComponent(BeforeSearchInputComponent)
您可以使用它在搜索栏之前添加一个组件。
参数:
的名字 | 类型 | 描述 |
---|---|---|
BeforeSearchInputComponent |
React.ComponentType。<BeforeSearchInputComponent> |
例子
const custombeforesearchchinputcomponent = props => {return 请在搜索栏中输入一个词开始搜索 }
#setSearchInputComponent(SearchInputComponent可以为空)
将搜索栏组件替换为自定义搜索组件
参数:
的名字 | 类型 | 属性 | 描述 |
---|---|---|---|
SearchInputComponent |
React.ComponentType。<SearchInputComponent> | <空> |
例子
...从“react-native-reanimated”中导入Animated;export const applyCustomCode = externalCodeSetup => {const CustomSearchInputComponent = (props) => {const {global, colors, searchTerm, setSearchTerm, inputProps} = props;const customInputProps ={…inputProps,占位符:“通过键入“bar”,“foo”等单词搜索列表……'}返回<动画。View style={[{flexDirection: "row", alignItems: "center"}]} > < textput style={[global. txt]}searchBarText, {color:颜色。{setSearchTerm} value={searchTerm} placeholderTextColor={color . txt . txt . txt . txt . txt . txt . txt . txt。searchColor} autoCapitalize={"none"} returnKeyType="done" highlightColorAndroid="transparent" autoCorrect={true} autoFocus={false}{…customInputProps} / > < /动画。查看>}externalcodeseup . searchscreenapihooks . setsearchchinputcomponent (customsearchchinputcomponent)}