Skip to content

Commit

Permalink
Extend ColorValue Flow type to include numbers
Browse files Browse the repository at this point in the history
Summary:
Adds `number` to the `ColorValue` union type.

Per our docs, React Native supports specifying colours as RGBA values packed into ints: https://reactnative.dev/docs/colors#color-ints. It looks like this case was missed in D6226807 (da04796) when we started typing the `StyleSheet` API with Flow.

Changelog: [General][Fixed] - Support numeric color values in StyleSheet's Flow types

Reviewed By: yungsters

Differential Revision: D34140748

fbshipit-source-id: 5bfe2995a473260926fa3c8b6926bb841615d393
  • Loading branch information
motiz88 authored and facebook-github-bot committed Feb 11, 2022
1 parent 89c3aac commit 83b1975
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Libraries/StyleSheet/StyleSheetTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const AnimatedNode = require('../Animated/nodes/AnimatedNode');

import type {NativeColorValue} from './PlatformColorValueTypes';

export type ____ColorValue_Internal = null | string | NativeColorValue;
export type ____ColorValue_Internal = null | string | number | NativeColorValue;

export type ColorArrayValue = null | $ReadOnlyArray<____ColorValue_Internal>;
export type PointValue = {|
Expand Down

0 comments on commit 83b1975

Please sign in to comment.