SearchScreenApi

SearchScreenApi()

屏幕屏幕钩子。实例名称:searchScreenApiHooks

你可以使用这个钩子在你的应用程序中自定义搜索栏选项。例如,你可以在搜索栏之前/之后添加一个组件,或者用一个自定义搜索组件替换搜索栏。

构造函数

新SearchScreenApi()

例子
externalCodeSetup.searchScreenApiHooks.METHOD_NAME

方法

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)}
Baidu