HomePhabricator
Diffusion Comm c768750741aa

[native] Add thumbHash prop to image components

Description

[native] Add thumbHash prop to image components

Summary:
This diff exposes the expo-image's placeholder prop (docs). For <LoadableImage> and <RemoteImage> it is passed directly for flexibility.
For encrypted images, the thumbHash is encrypted so it must be decrypted before creating a placeholder. For non-encrypted images, it can be passed directly.

The part where multimedia.react.js receives the thumbhash prop will be added in next diffs whenkeyserver support is added.

Depends on D7761

Test Plan:
Here are a few thumbhash examples that you can pass to the prop:

// these are raw, non-encrypted thumbhash strings
const thumbhashes = [
  '1EgOHYQImHiZZ4iCe3eWeAinolA8',
  '5xcSHQZpeI94KIenaHhoh2ufo/Y4',
  'EQgKHQZlh2122Hb4dm2Gh2hwkQc3',
  'GTSBBIAmOIlphnApR+P7ijmPhYUIR4h3Bg',
  'JRkaPQh4d394V4doeHd3h3iAgAcI',
  'TwgOFQKniXV1+JeYh3u2mLZ1b1v3',
  'YGkKHQKnh392CGdXpXVoeptu0IgF',
  'E9cJVRB6h493R3iIeHmXZ3hwhAg3',
];
const thumbhash = thumbhashes[Math.random() % thumbhashes.length];
const placeholder = { thumbhash };
`

Simulator Screen Shot - iPhone 14 Pro - 2023-05-09 at 17.31.58.png (2×1 px, 399 KB)

Reviewers: ginsu, atul, inka

Reviewed By: atul

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D7765

Details

Provenance
bartekAuthored on May 3 2023, 2:58 AM
Reviewer
atul
Differential Revision
D7765: [native] Add thumbHash prop to image components
Parents
rCOMMb1ecdd8e60c5: [native] Add utils to encrypt/decrypt base64 string
Branches
Unknown
Tags
Unknown