
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
react-native-controlled-mentions
Advanced tools
Install the library using either Yarn:
yarn add react-native-controlled-mentions
or npm:
npm install --save react-native-controlled-mentions
import React, { FC, useState } from 'react';
import { Mentions, Suggestion } from 'react-native-controlled-mentions';
import { Pressable, Text, View } from 'react-native';
const suggestions = [
{id: '1', name: 'David Tabaka'},
{id: '2', name: 'Mary'},
{id: '3', name: 'Tony'},
{id: '4', name: 'Mike'},
{id: '5', name: 'Grey'},
];
type MentionSuggestionsProps = {
keyword?: string;
suggestions: Suggestion[];
onSuggestionPress: (suggestion: Suggestion) => void;
};
const MentionSuggestions: FC<MentionSuggestionsProps> = (
{
keyword,
suggestions,
onSuggestionPress,
},
) => keyword != null ? (
<View>
{suggestions
.filter(item => item.name.toLowerCase().includes(keyword.toLowerCase()))
.map(suggestion => (
<Pressable
key={suggestion.id}
style={{padding: 8}}
onPress={() => onSuggestionPress(suggestion)}
>
<Text>{suggestion.name}</Text>
</Pressable>
))
}
</View>
) : null;
const App = () => {
const [value, setValue] = useState('Hello @[David Tabaka](5)! How are you?');
return (
<Mentions
value={value}
onChange={setValue}
renderSuggestions={({keyword, onSuggestionPress}) => (
<MentionSuggestions
keyword={keyword}
suggestions={suggestions}
onSuggestionPress={onSuggestionPress}
/>
)}
/>
);
};
export { App };
The Mentions
component supports next props:
Prop name | Type | Required | Default value | Description |
---|---|---|---|---|
value | string | true | ||
onChange | function (value) | true | ||
renderSuggestions | function ({keyword, onSuggestionPress}) ReactNode | false | ||
trigger | string | false | '@' | |
inputRef | TextInput | false | ||
containerStyle | StyleProp | false |
FAQs
Fully controlled React Native mentions component
The npm package react-native-controlled-mentions receives a total of 11,978 weekly downloads. As such, react-native-controlled-mentions popularity was classified as popular.
We found that react-native-controlled-mentions demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.