Files
react-native/Libraries/Components/View/ReactNativeStyleAttributes.js
T
Nishan 9f3a3e13cc feat: flex gap bindings (#34974)
Summary:
This PR adds React native binding for https://github.com/facebook/yoga/pull/1116

## Changelog

[General] [Added] - Flex gap yoga bindings

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

Pull Request resolved: https://github.com/facebook/react-native/pull/34974

Test Plan:
Run rn tester app and go to view example. You'll find a flex gap example. Example location - `packages/rn-tester/js/examples/View/ViewExample.js`

### Tested on
- [x] iOS Fabric
- [x] iOS non-fabric
- [x] Android Fabric
- [x] Android non-fabric

To test on non-fabric Android, I just switched these booleans. Let me know if there's anything else I might have missed.

<img width="674" alt="Screenshot 2022-10-14 at 3 30 48 AM" src="https://user-images.githubusercontent.com/23293248/195718971-7aee4e7e-dbf0-4452-9d47-7925919c61dc.png">

Reviewed By: mdvacca

Differential Revision: D40527474

Pulled By: NickGerleman

fbshipit-source-id: 81c2c97c76f58fad3bb40fb378aaf8b6ebd30d63
2022-10-20 14:53:32 -07:00

157 lines
3.5 KiB
JavaScript

/**
* 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.
*
* @format strict-local
* @flow
*/
import type {AnyAttributeType} from '../../Renderer/shims/ReactNativeTypes';
import processAspectRatio from '../../StyleSheet/processAspectRatio';
import processColor from '../../StyleSheet/processColor';
import processFontVariant from '../../StyleSheet/processFontVariant';
import processTransform from '../../StyleSheet/processTransform';
import sizesDiffer from '../../Utilities/differ/sizesDiffer';
const colorAttributes = {process: processColor};
const ReactNativeStyleAttributes: {[string]: AnyAttributeType, ...} = {
/**
* Layout
*/
alignContent: true,
alignItems: true,
alignSelf: true,
aspectRatio: {process: processAspectRatio},
borderBottomWidth: true,
borderEndWidth: true,
borderLeftWidth: true,
borderRightWidth: true,
borderStartWidth: true,
borderTopWidth: true,
columnGap: true,
borderWidth: true,
bottom: true,
direction: true,
display: true,
end: true,
flex: true,
flexBasis: true,
flexDirection: true,
flexGrow: true,
flexShrink: true,
flexWrap: true,
gap: true,
height: true,
justifyContent: true,
left: true,
margin: true,
marginBottom: true,
marginEnd: true,
marginHorizontal: true,
marginLeft: true,
marginRight: true,
marginStart: true,
marginTop: true,
marginVertical: true,
maxHeight: true,
maxWidth: true,
minHeight: true,
minWidth: true,
overflow: true,
padding: true,
paddingBottom: true,
paddingEnd: true,
paddingHorizontal: true,
paddingLeft: true,
paddingRight: true,
paddingStart: true,
paddingTop: true,
paddingVertical: true,
position: true,
right: true,
rowGap: true,
start: true,
top: true,
width: true,
zIndex: true,
/**
* Shadow
*/
elevation: true,
shadowColor: colorAttributes,
shadowOffset: {diff: sizesDiffer},
shadowOpacity: true,
shadowRadius: true,
/**
* Transform
*/
transform: {process: processTransform},
/**
* View
*/
backfaceVisibility: true,
backgroundColor: colorAttributes,
borderBottomColor: colorAttributes,
borderBottomEndRadius: true,
borderBottomLeftRadius: true,
borderBottomRightRadius: true,
borderBottomStartRadius: true,
borderColor: colorAttributes,
borderCurve: true,
borderEndColor: colorAttributes,
borderLeftColor: colorAttributes,
borderRadius: true,
borderRightColor: colorAttributes,
borderStartColor: colorAttributes,
borderStyle: true,
borderTopColor: colorAttributes,
borderTopEndRadius: true,
borderTopLeftRadius: true,
borderTopRightRadius: true,
borderTopStartRadius: true,
opacity: true,
pointerEvents: true,
/**
* Text
*/
color: colorAttributes,
fontFamily: true,
fontSize: true,
fontStyle: true,
fontVariant: {process: processFontVariant},
fontWeight: true,
includeFontPadding: true,
letterSpacing: true,
lineHeight: true,
textAlign: true,
textAlignVertical: true,
textDecorationColor: colorAttributes,
textDecorationLine: true,
textDecorationStyle: true,
textShadowColor: colorAttributes,
textShadowOffset: true,
textShadowRadius: true,
textTransform: true,
userSelect: true,
verticalAlign: true,
writingDirection: true,
/**
* Image
*/
overlayColor: colorAttributes,
resizeMode: true,
tintColor: colorAttributes,
objectFit: true,
};
module.exports = ReactNativeStyleAttributes;