mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
597a1ff60b
Summary: This PR implements logical border block color properties as requested on https://github.com/facebook/react-native/issues/34425. This implementation includes the addition of the following style properties - `borderBlockColor`, equivalent to `borderTopColor` and `borderBottomColor`. - `borderBlockEndColor`, equivalent to `borderBottomColor`. - `borderBlockStartColor`, equivalent to `borderTopColor`. ## Changelog [GENERAL] [ADDED] - Add logical border block color properties Pull Request resolved: https://github.com/facebook/react-native/pull/35999 Test Plan: 1. Open the RNTester app and navigate to the `View` page 2. Test the new style properties through the `Logical Border Color` section <table> <tr> <td>Android</td> <td>iOS</td> </tr> <tr> <td><video src="https://user-images.githubusercontent.com/11707729/215384882-5b96518e-ad70-4157-a7f3-130f488cc41c.mov" alt="1" width="360px" /> </td> <td> <video src="https://user-images.githubusercontent.com/11707729/215392728-cfc6a097-26c1-4ffe-ab0e-f0a5a71a902d.mov"2" width="360px" /> </td> </tr> </table> Reviewed By: cipolleschi Differential Revision: D42849911 Pulled By: jacdebug fbshipit-source-id: 822cff5264689c42031d496105537032b5cd31ef
129 lines
3.9 KiB
JavaScript
129 lines
3.9 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.
|
|
*
|
|
* @flow strict-local
|
|
* @format
|
|
*/
|
|
|
|
import type {
|
|
HostComponent,
|
|
PartialViewConfig,
|
|
} from '../../Renderer/shims/ReactNativeTypes';
|
|
|
|
import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry';
|
|
import codegenNativeCommands from '../../Utilities/codegenNativeCommands';
|
|
import Platform from '../../Utilities/Platform';
|
|
import {type ViewProps as Props} from './ViewPropTypes';
|
|
import * as React from 'react';
|
|
|
|
export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
|
|
Platform.OS === 'android'
|
|
? {
|
|
uiViewClassName: 'RCTView',
|
|
validAttributes: {
|
|
// ReactClippingViewManager @ReactProps
|
|
removeClippedSubviews: true,
|
|
|
|
// ReactViewManager @ReactProps
|
|
accessible: true,
|
|
hasTVPreferredFocus: true,
|
|
nextFocusDown: true,
|
|
nextFocusForward: true,
|
|
nextFocusLeft: true,
|
|
nextFocusRight: true,
|
|
nextFocusUp: true,
|
|
|
|
borderRadius: true,
|
|
borderTopLeftRadius: true,
|
|
borderTopRightRadius: true,
|
|
borderBottomRightRadius: true,
|
|
borderBottomLeftRadius: true,
|
|
borderTopStartRadius: true,
|
|
borderTopEndRadius: true,
|
|
borderBottomStartRadius: true,
|
|
borderBottomEndRadius: true,
|
|
borderEndEndRadius: true,
|
|
borderEndStartRadius: true,
|
|
borderStartEndRadius: true,
|
|
borderStartStartRadius: true,
|
|
borderStyle: true,
|
|
hitSlop: true,
|
|
pointerEvents: true,
|
|
nativeBackgroundAndroid: true,
|
|
nativeForegroundAndroid: true,
|
|
needsOffscreenAlphaCompositing: true,
|
|
|
|
borderWidth: true,
|
|
borderLeftWidth: true,
|
|
borderRightWidth: true,
|
|
borderTopWidth: true,
|
|
borderBottomWidth: true,
|
|
borderStartWidth: true,
|
|
borderEndWidth: true,
|
|
|
|
borderColor: {
|
|
process: require('../../StyleSheet/processColor').default,
|
|
},
|
|
borderLeftColor: {
|
|
process: require('../../StyleSheet/processColor').default,
|
|
},
|
|
borderRightColor: {
|
|
process: require('../../StyleSheet/processColor').default,
|
|
},
|
|
borderTopColor: {
|
|
process: require('../../StyleSheet/processColor').default,
|
|
},
|
|
borderBottomColor: {
|
|
process: require('../../StyleSheet/processColor').default,
|
|
},
|
|
borderStartColor: {
|
|
process: require('../../StyleSheet/processColor').default,
|
|
},
|
|
borderEndColor: {
|
|
process: require('../../StyleSheet/processColor').default,
|
|
},
|
|
borderBlockColor: {
|
|
process: require('../../StyleSheet/processColor').default,
|
|
},
|
|
borderBlockEndColor: {
|
|
process: require('../../StyleSheet/processColor').default,
|
|
},
|
|
borderBlockStartColor: {
|
|
process: require('../../StyleSheet/processColor').default,
|
|
},
|
|
|
|
focusable: true,
|
|
overflow: true,
|
|
backfaceVisibility: true,
|
|
},
|
|
}
|
|
: {
|
|
uiViewClassName: 'RCTView',
|
|
};
|
|
|
|
const ViewNativeComponent: HostComponent<Props> =
|
|
NativeComponentRegistry.get<Props>('RCTView', () => __INTERNAL_VIEW_CONFIG);
|
|
|
|
interface NativeCommands {
|
|
+hotspotUpdate: (
|
|
viewRef: React.ElementRef<HostComponent<mixed>>,
|
|
x: number,
|
|
y: number,
|
|
) => void;
|
|
+setPressed: (
|
|
viewRef: React.ElementRef<HostComponent<mixed>>,
|
|
pressed: boolean,
|
|
) => void;
|
|
}
|
|
|
|
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
supportedCommands: ['hotspotUpdate', 'setPressed'],
|
|
});
|
|
|
|
export default ViewNativeComponent;
|
|
|
|
export type ViewNativeComponentType = HostComponent<Props>;
|