react-native-controlled-mentions: renderSuggestions scrolling not working in android
Hi I want to scroll the suggestion list but i am facing issue with android and its working in ios, below is my code for renderSuggestions function
` const renderSuggestions = ({keyword, onSuggestionPress}) => { if ( keyword === null || keyword === undefined || mappedMembers.length === 0 ) { return null; } const suggestionArrayToRender = mappedMembers.filter(item => item.name.toLowerCase().includes(keyword.toLowerCase()), );
return (
<View
style={{
// backgroundColor: 'red',
width: 200,
borderColor: 'gray',
borderWidth: 0.5,
opacity: 1,
}}>
<ScrollView nestedScrollEnabled style={{flexGrow: 1, height: 200}}>
{suggestionArrayToRender
.filter(item =>
item.name.toLowerCase().includes(keyword.toLowerCase()),
)
.map(one => (
<Pressable
key={one.id}
onPress={() => onSuggestionPress(one)}
style={{padding: 12}}>
<Text style={{color: COLORS.textBlack}}>{one.name}</Text>
</Pressable>
))}
</ScrollView>
</View>
);
} `
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 17 (1 by maintainers)
Hey all!
Thanks for using the library and providing your feedbacks.
I’ve also encountered this problem in my projects. The most compromising solution was using the Portal pattern. You can use this component from the
react-native-paperlibrary, from a separate library@gorhom/portal, or you can implement this component yourself.Here is a very basic and simplified example that I used in production:
Please note that for iOS there’s no need to use
Portalas scrolling together withposition: 'absolute'works fine. Thus, you can use the following selector for root component inSuggestions: