AsyncSelect 不会更改加载消息,也不会更改选项消息(react-select 库)
AsyncSelect does not change loading message nor no option message (react-select library)
我一直在尝试自定义 react-select AsyncSelect 加载消息和没有选项消息,但到目前为止没有成功。
这是我当前的代码:
<AsyncSelect
noOptionsMessage={() => 'nothing found'}
LoadingMessage={() => 'searching...'}
cacheOptions
loadOptions={searchForPointsOfInterest}
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option}
defaultOptions
isRtl={true}
isClearable={true}
placeholder="example"
isLoading={isLoading}
onChange={onPointOfInterestChange}
defaultValue={props.area}
/>
我准备好了sandbox。请检查一下。除了错误的 loadingMessage
道具名称我没有看到错误。
应该是
<AsyncSelect
noOptionsMessage={() => 'nothing found'}
loadingMessage={() => 'searching...'} //minor type-O here
cacheOptions
loadOptions={searchForPointsOfInterest}
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option}
defaultOptions
isRtl={true}
isClearable={true}
placeholder="example"
isLoading={isLoading}
onChange={onPointOfInterestChange}
defaultValue={props.area} />
如果您的问题没有解决,请在您的问题中添加 loadOptions 和 onChange 的更多详细信息。
我一直在尝试自定义 react-select AsyncSelect 加载消息和没有选项消息,但到目前为止没有成功。
这是我当前的代码:
<AsyncSelect
noOptionsMessage={() => 'nothing found'}
LoadingMessage={() => 'searching...'}
cacheOptions
loadOptions={searchForPointsOfInterest}
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option}
defaultOptions
isRtl={true}
isClearable={true}
placeholder="example"
isLoading={isLoading}
onChange={onPointOfInterestChange}
defaultValue={props.area}
/>
我准备好了sandbox。请检查一下。除了错误的 loadingMessage
道具名称我没有看到错误。
应该是
<AsyncSelect
noOptionsMessage={() => 'nothing found'}
loadingMessage={() => 'searching...'} //minor type-O here
cacheOptions
loadOptions={searchForPointsOfInterest}
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option}
defaultOptions
isRtl={true}
isClearable={true}
placeholder="example"
isLoading={isLoading}
onChange={onPointOfInterestChange}
defaultValue={props.area} />
如果您的问题没有解决,请在您的问题中添加 loadOptions 和 onChange 的更多详细信息。