Fully controlled React Native mentions component
In that release was rethought and re-designed logic for rendering mentions, suggestions and core logic for parsing mention values. In fact, we have no need to render all this stuff in the MentionInput
component. And more – we don't need the MentionInput
component as well. It's enough to provide just a few props directly to the TextInput component.
Now you will be able to use hook for control mention state. The main idea – suggestions rendering now will be fully controlled by user and is extracted from MentionInput
component.
useMentions
hook that allows to render suggestions separately from TextInput
component (#40, #44, #65, #75)david:123
. #52, #70, #80)@@
, ##
etc. #38, #51)TextInput
(#66)@[David Tabaka](123)
to {@}[David Tabaka](123)
containerStyle
prop from the MentionInput
componentinputRef
prop from the MentionInput
component, use traditional ref
nowrenderSuggestions
and isBottomMentionSuggestionsRender
from the PartType
(new Config
type)MentionSuggestionsProps -> SuggestionsProvidedProps
onSuggestionPress -> onSelect
PartType -> Config
isTriggerPartType -> isTriggerConfig
getMentionValue -> getTriggerValue
replaceMentionValues -> replaceTriggerValues
To play with this alpha
pre-release, please switch to this branch for docs and examples. Also, you can install alpha
version using next commands:
yarn add react-native-controlled-mentions@alpha
// or
npm install --save react-native-controlled-mentions@alpha
value
is null
(#36))
after mention part (#24)partTypes
property for defining a list of possible mention or pattern types for parsing (e. g. URLs) (#13)mentionTypes
renamed to partTypes
MentionType
changed to PartType
which can be either MentionPartType
or PatternPartType
New types defined in README.md.
renderSuggestions
, trigger
, isInsertSpaceAfterMention
, mentionTextStyle
is now moved to mentionTypes
propertymentionRegEx
changed a little bigPlease see the example app in /example
folder to get more details.
Fixed bugs:
Fixed
onSelectionChange
forwarding (#8)Fixed