-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HOLD] Chat / Cycle attachments when the user presses the left/right keys #1038
Comments
Invited two contributors to accept offer on Upwork |
Hi, I've looked through the code and have a few methods of implementation. Both include me writing a function that gets the next attachment from the sorted actions array. How I pass that function down to the attachment modal has 2 possibilities. Either I pass the function down through the action object, the HTML component and into the attachment modal or I write a react context and attempt to bypass all the unnecessary prop definitions. |
Another update. Seems the react-native-render-html module doesn't work when passing props to renderers for some reason. the passProps value is always undefined. |
Could i ask why "react-native-render-html": "^6.0.0-alpha.10", is being used? it seems to be missing a lot of features of the current v5 code. |
Hi, @ThatOneAwkwardGuy you can see more of the context around that upgrade in this PR: #882 I hope that helps! |
At this point, it's not, no. We haven't developed best practices for using hooks yet, and until we do that we would like to avoid using them. I'm reading up more about this issue so that I'm more familiar with the proposal being discussed. It seems that the modal itself needs access to the report actions array (specifically the actions that are attachments That will allow the modal to access all the report actions without needing to use hooks or to do a lot of prop-drilling. Does that help at all? |
Yes it really does, I was going through all m ideas on getting the actions array to the Modal |
After playing around with the code more, there is a problem with the structure of the components. I've written a function that gets the next attachment and cycles around if there aren't any more at the end of the list. However, the problem is that the attachments provide HTML which is passed to renderHTML. since any change in the fragment (i.e swapping it out for the next one) will cause a re-render of the renderHTML component there will also be a rerender of the AttachmentModal which is inside the renderHTML component. I'll attempt to refactor the code so that there is a singular modal for rendering attachments and it is outside of the entire flatlist of actions. |
Completed my solution, just cleaning up the code. Hopefully, you'll find it acceptable. Had to move the Attachment Modal to ReportActionsView and pass a function to the TouchableOpacity wrapping the attachments you can click to then launch the modal with the necessary data to display on the modal. Happy to answer any questions once I have the code pushed |
…pensify#1038 Refactored code and moved Attachment modal so only one is created for ReportView and one for the compose view. Then setAttachmentModalData sets modal data in higher component and is passed down to Attachmentmodal
Hi, |
@HasaanA16 I've got a few questions about your proposed solution:
|
The functional component I propose allows the user to click on the paper click icon where he will see the option of selecting image from the device. Copy the code from my proposed solution and update your component with it. From react-native-image-crop picker I used the functionality to select multiple images and save their record too as other modules doesn't provide this functionality. I intended to use the carousel but I didn't. |
It looks like this issue is for enabling a user to cycle through already uploaded attachments via the existing AttachmentModal, so I don't think we need to add another image picker (we're already using an AttachmentPicker).
This sounds like you're updating the attachment picker component to be able to scroll through just the attachments that were selected by an image picker after clicking the paper clip icon. Just to confirm, will your ScrollList also enable users to click on an existing attachment in the chat, and then preview all other already existing attachments in the chat by using the arrow keys on web? |
No, this ScrollList allows the user to preview and navigate through images before sending them. If you require I can update this component with a modal where user can preview while navigating already sent attachments. |
Yes, please provide a proposal for allowing the user to navigate between already existing attachments on the chat via the AttachmentModal. Updating the attachment picker to allow for multiple file uploads isn't necessary for this issue. |
sure.! I am on it, will ping you in day or two with the changes that you require and hopefully you will like it. |
I talked this over with @chiragsalian and I think he makes a good point that the carousel (i.e. cycling) behavior is unnecessary in this context, as there is unlikely to be a context where you need to loop back to the first image you ever uploaded. i think we can probably cut this behavior. |
As you say so, its your call. So should I not make any changes to the code ? Also let me know if there is something I can do here. |
To clarify, I just mean the part of the behavior where the attachments loop -- instead, when you are at the latest attachment in the chat, pressing right on your keyboard should not loop you to the first image you uploaded. |
Leaving a quick summary of where we're at with suggested next steps for this issue… This issue didn’t really have clear steps on how to complete it so there was a lot of back and forth on the best way to implement. Ultimately, we didn't feel that we had the best possible solution. But we do have a better idea of the scope of this issue and what kinds of problems we will face to solve it. Problems
Suggested course of action:
|
I've used react-native-image-crop module which will allow user to select single or multiple attachment.. Also I can share video, if you guys want to have a look at it. |
Hey, @HasaanA16 I think it would be best if we paused working on this until we resolve my comment above. Anyways, I'm confused about your proposal since you are describing what we already have, but mentioned multiple attachments which should not be supported.
|
Hi, sorry for the delayed response. I did not get it. I pushed my code in a separate branch so that you could test it as there were errors in chat functionality. What do you require exactly ? Did you test my code? |
Putting this issue on HOLD while we sort out #1038 (comment). |
@marcaaron Hi folks! RNRH maintainer here. As I have some free time, I'm crafting a quote for Expansify, migrating RNRH to version 6.0.0-beta.6 with a few optimizations and I stumbled on this thread looking for issues related to my lib. If I remember well, back to alpha.10, an equivalent of |
@jboniface, this Monthly task hasn't been acted upon in 6 weeks; closing. If you disagree, feel encouraged to reopen it -- but pick your least important issue to close instead. |
If you haven’t already, check out our contributing guidelines for onboarding!
Platform - version:
All platforms, 280
Action Performed (reproducible steps):
Expected Result:
The attachments present in the chat should cycle when the user is viewing the modal and presses the left/right arrows on their keyboard
Actual Result:
The attachments do not cycle
Notes/Photos/Videos:
View the job on Upwork here.
The text was updated successfully, but these errors were encountered: