reactivesearch icon indicating copy to clipboard operation
reactivesearch copied to clipboard

renderNoResults isn't working as expected

Open dres-cifuentes opened this issue 7 years ago • 4 comments

Issue Type: enhancement

Platform: Native

Description: I'm using renderNoResults in my ReactiveList component and it's not working as expected. I'm probably not doing using it properly but I didn't see any examples. I've tried:

<ReactiveList 
   renderNoResults={() => 'hello'}
  //and
   renderNoResults={() => <Text>helloooo</Text>}
/>

Screenshots:

Minimal reproduction of the problem with instructions:

Reactivesearch version: x.y.z 0.12.0

Browser: ios android

Anything else:

dres-cifuentes avatar Apr 24 '19 20:04 dres-cifuentes

I think we don't support this prop in native.

bietkul avatar Apr 25 '19 07:04 bietkul

@bietkul Line 472 in ReactiveList, Native version:

https://github.com/appbaseio/reactivesearch/blob/next/packages/native/src/components/result/ReactiveList.js

renderNoResults = () => {
		const type = typeof this.props.onNoResults;
		if (type === 'function') {
			return this.props.onNoResults();
		}
		return (
			<Text {...getInnerKey(this.props.innerProps, 'noResults')}>
				{type === 'string' ? this.props.onNoResults : 'No results found.'}
			</Text>
		);
	};

It's in there. Is it just not active?

dres-cifuentes avatar Apr 25 '19 13:04 dres-cifuentes

It's onNoResults in native.

bietkul avatar Apr 25 '19 13:04 bietkul

This works, thank you!!

onNoResults={() => <Text> Custom Message </Text>}

dres-cifuentes avatar Apr 25 '19 13:04 dres-cifuentes