openReactionSelector deprecated improperly and new function openReactionPicker not functional
Describe the bug MessageSimple openReactionSelector has been deprecated but is not referencing the old functionality correctly. Even when making calls to the new openReactionPicker, the reaction picker is not opening in the correct location
- Set the onPress or onLongPress of MessageSimple as per docs
* Function that overrides default behaviour when message is long pressed
* e.g. if you would like to open reaction picker on message long press:
*
* ```
* import { MessageSimple } from 'stream-chat-react-native' // or 'stream-chat-expo'
* ...
* const MessageUIComponent = (props) => {
* return (
* <MessageSimple
* {...props}
* onLongPress={(thisArg, message, e) => {
* thisArg.openReactionSelector();
* }}
* )
* }
- Press a message and see that you get a deprecation warning but the reaction picker is not opened
- Instead make sure to reference thisArg.props.openReactionPicker() instead.
- Press a message and see that the reaction picker is not opened in the correct location (it is not properly setting the location of the modal.
Expected behavior Docs to be updated. Deprecated functions to still reference the correct code. The code to actually be functional.
THanks @cenzovit . Will fix it in next publish :)
Also, you use to be able to pass props along to MessageContent (because it was receiving the props from the parent MessageSimple); however, that no longer appears to be the case. We used to be able to set the delayLongPress attribute of the touchable.
Also, you use to be able to pass props along to MessageContent (because it was receiving the props from the parent MessageSimple); however, that no longer appears to be the case. We used to be able to set the delayLongPress attribute of the touchable.
@cenzovit thats strange. We still forward all the props to MessageContent - https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageSimple/index.js#L413
Can you should me your code please?
If you look at MessageContent you can see that only specific props are passed along (contentProps). Additional feedback, when wrapping the MessageInput in an InputAccessoryView, when a modal opens (in this case the reactionpicker), the accessory view / keyboard disappears and the reaction picker opens in the wrong spot
To clarify, the major issue is that the openReactionPicker() method does not open the reaction picker in the correct location. Formerly this could be worked around by calling _setReactionPickerPosition directly but this is no longer accessible as it has been moved from MessageSimple to ReactionPickerWrapper.
Can you should me a screen recording if possible? And also what code you are using?
The PR linked to this issue should fix your issues imo :)
Here is a screen recording: RPReplay_Final1587670041.MP4.zip
We're using 0.10.0 of stream-chat-react-native. Here is the function we call:
if (typeof thisArg?.props?.openReactionPicker === 'function') {
thisArg.props.openReactionPicker();
@cenzovit @bscharfstein can you please test once on 0.10.2 and let me know. I can see from your comments that the issues fixed in 0.10.2 are un-related to your issues. But just want to make sure you are still facing the issue on latest version before I dive again in this.
Unfortunately 0.10.2 does not fix the issue
nor does v0.10.3 as far as we can tell
Hey @bscharfstein pardon me, been busy with some pressing issue. I will take a look earlier next week on this :)
Hello, @bscharfstein and @cenzovit.
I've spent a couple of hours investigating the issues mentioned here to see if I could help, but I wasn't able to reproduce them entirely. If I understood correctly, there have been three problems reported:
- The
openReactionSelectorfunction was wrongly deprecated (meaning that the functionality was not there anymore). - Even after you worked around the first issue, the reaction
openReactionPickeritself is rendered in the wrong place when you call it. - @cenzovit mentions a third issue, where we no longer pass down some props to the MessageSimple user event handlers (
onPress,onLongPress).
I did some investigation on v0.11.0, to see if I could reproduce the issues mentioned. The first issue described, regarding the deprecation of the openReactionSelector function seems to be fixed. This issue could easily be replicated in v0.10.0 and is no longer present.
But I could not reproduce the second issue yet.
I do see from the code that the implementation relies on a couple of async events, and I can imagine some side effects that could lead to this issue in different places, though I didn't manage to force them to happen. @vishalnarkhede is going to have a new look at it next week, but while he's on that, I have a couple of questions:
- Are you using a custom
KeyboardAvoidingViewor something similar (i.e: setting to true thedisableKeyboardCompatibleViewprop and using your own implementation)? - Does the issue happen regardless of if you're building a release or a debug version of your application?
Other than that, if you could share an example with more context where you see the issue, this would be awesome.
closing as ReactionPicker does not seem to have these problems on the latest version of the sdk