TheStanfordDaily/stanforddaily-mobile

Bring back photo captions

MatthewTurk247 opened this issue · 4 comments

  1. Open a command-line shell.
  2. 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.
  3. Create a branch off dev called photo-captions.
  4. Navigate to screens > Post.js.
  5. Add a Text component immediately after the opening TriggeringView tag and above the line that starts with {article["wps_subtitle"] !== "" ....
  6. 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 with Model.media(article["featured_media"]).get().

@MatthewTurk247 can you assign me the issue and i work on it

Sure thing! I will assign you and try to add a more detailed description today.

@MatthewTurk247 yeah that will be awesome the more the details the easier the task

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.