forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 149
add normalize/processColorObject.js for ios and macos #146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a9cdffe
add normalize/processColorObject.js for ios and macos
marlenecota 1ef11c3
run prettier
marlenecota abae00f
Fix NativeColorType reference in normalizeColorObject
marlenecota 0d4729b
return null in normalizeColorObject for invalid objects
marlenecota f4b30bf
import NativeOrDynamicColorType from normalizeColorObject
marlenecota 5bcecc1
remove strict-local
marlenecota c99eea9
add normalize/processColorObject.android.js
marlenecota dad7b54
normalize/processColorObject param
marlenecota bad984d
missed one NativeOrDynamicColorType import
marlenecota 5dc4c9d
NativeOrDynamicColorType as processColorObject's return type
marlenecota c00a2d7
ignore macos files in android's flowconfig
marlenecota ce1a272
Move normalizeColor require
marlenecota e199a91
Add/fix TODO(macOS ISS#2323203) comments
marlenecota File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,22 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
* @flow | ||
*/ | ||
// [TODO(macOS ISS#2323203) | ||
'use strict'; | ||
|
||
export type NativeOrDynamicColorType = {}; | ||
|
||
function normalizeColorObject( | ||
color: NativeOrDynamicColorType, | ||
): ?(number | NativeOrDynamicColorType) { | ||
return null; | ||
} | ||
|
||
module.exports = normalizeColorObject; | ||
// ]TODO(macOS ISS#2323203) |
This file contains hidden or 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,45 @@ | ||
/** | ||
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
* @flow | ||
*/ | ||
// [TODO(macOS ISS#2323203) | ||
'use strict'; | ||
|
||
export type NativeOrDynamicColorType = { | ||
semantic?: string, | ||
dynamic?: { | ||
light: ?(string | number | NativeOrDynamicColorType), | ||
dark: ?(string | number | NativeOrDynamicColorType), | ||
}, | ||
}; | ||
|
||
function normalizeColorObject( | ||
color: NativeOrDynamicColorType, | ||
): ?(number | NativeOrDynamicColorType) { | ||
if ('semantic' in color) { | ||
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// a macos semantic color | ||
return color; | ||
} else if ('dynamic' in color && color.dynamic !== undefined) { | ||
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const normalizeColor = require('normalizeColor'); | ||
|
||
// a dynamic, appearance aware color | ||
const dynamic = color.dynamic; | ||
const dynamicColor: NativeOrDynamicColorType = { | ||
dynamic: { | ||
light: normalizeColor(dynamic.light), | ||
dark: normalizeColor(dynamic.dark), | ||
}, | ||
}; | ||
return dynamicColor; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
module.exports = normalizeColorObject; | ||
// ]TODO(macOS ISS#2323203) |
This file contains hidden or 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,45 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
* @flow | ||
*/ | ||
// [TODO(macOS ISS#2323203) | ||
'use strict'; | ||
|
||
const normalizeColor = require('normalizeColor'); | ||
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
export type NativeOrDynamicColorType = { | ||
semantic?: string, | ||
dynamic?: { | ||
light: ?(string | number | NativeOrDynamicColorType), | ||
dark: ?(string | number | NativeOrDynamicColorType), | ||
}, | ||
}; | ||
|
||
function normalizeColorObject( | ||
color: NativeOrDynamicColorType, | ||
): ?(number | NativeOrDynamicColorType) { | ||
if ('semantic' in color) { | ||
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// a macos semantic color | ||
return color; | ||
} else if ('dynamic' in color && color.dynamic !== undefined) { | ||
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
marlenecota marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// a dynamic, appearance aware color | ||
const dynamic = color.dynamic; | ||
const dynamicColor: NativeOrDynamicColorType = { | ||
dynamic: { | ||
light: normalizeColor(dynamic.light), | ||
dark: normalizeColor(dynamic.dark), | ||
}, | ||
}; | ||
return dynamicColor; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
module.exports = normalizeColorObject; | ||
// ]TODO(macOS ISS#2323203) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.