Bring back photo captions
MatthewTurk247 opened this issue · 4 comments
MatthewTurk247 commented
- Open a command-line shell.
- Clone the project to your local machine with
git clone https://github.com/TheStanfordDaily/stanforddaily-mobile.git -b dev
and open the folder with your text editor of choice. - Create a branch off
dev
calledphoto-captions
. - Navigate to
screens > Post.js
. - Add a
Text
component immediately after the openingTriggeringView
tag and above the line that starts with{article["wps_subtitle"] !== "" ...
. - Populate with photo caption from feature image of the article. You may have to make another API call in the
useEffect
function. You can do so withModel.media(article["featured_media"]).get()
.
Nyadzayo commented
@MatthewTurk247 can you assign me the issue and i work on it
MatthewTurk247 commented
Sure thing! I will assign you and try to add a more detailed description today.
Nyadzayo commented
@MatthewTurk247 yeah that will be awesome the more the details the easier the task
MatthewTurk247 commented
Okay, I added a description above. I recommend writing something like this in useEffect
:
Model.media().id(article["featured_media"]).get().then(media => {
setCaption(decode(media.caption?.rendered).slice(3, -5))
})
The setCaption
line can be named whatever you see fit, but I wrote it that way because it will be easier to implement with a React hook.
On my end, I will be trying to get LayoutAnimation
to work so that the caption does not appear abruptly when loaded. Instead, I will make it fade in within 500 to 1200 milliseconds.