-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Adding support for objectFit a partial equivalent to the resize…
…Mode style and prop of <Image>. (#34576) Summary: This PR aims to add support for objectFit a partial equivalent to the resizeMode style and prop of Image. ## Changelog [General] [Added] - Add support for objectFit style of Image. Pull Request resolved: #34576 Test Plan: 1. Open the RNTester app and navigate to the Image page 2. See the Object Fit section. ![Screenshot_1662112702](https://user-images.githubusercontent.com/8868908/188115315-5d5aa971-93ba-4437-a54b-c5ea69b00c08.png) Reviewed By: rickhanlonii Differential Revision: D39261176 Pulled By: jacdebug fbshipit-source-id: 1eefd76b6c11ed5fc52b2c524ad78c91051077f6
- Loading branch information
1 parent
4d04b1d
commit b2452ab
Showing
6 changed files
with
100 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
* @format | ||
*/ | ||
|
||
type ResizeMode = 'cover' | 'contain' | 'stretch' | 'repeat' | 'center'; | ||
|
||
export function convertObjectFitToResizeMode(objectFit: string): ResizeMode { | ||
const objectFitMap = { | ||
contain: 'contain', | ||
cover: 'cover', | ||
fill: 'stretch', | ||
'scale-down': 'contain', | ||
}; | ||
return objectFitMap[objectFit]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters