Skip to content
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

[ActionSheetIOS] Add tintColor for buttons. #4590

Closed

Conversation

christopherdro
Copy link
Contributor

Closes #3374

@facebook-github-bot
Copy link
Contributor

By analyzing the blame information on this pull request, we identified @nicklockwood, @vjeux and @tadeuzagallo to be potential reviewers.

@facebook-github-bot facebook-github-bot added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Dec 6, 2015
@@ -12,6 +12,7 @@
'use strict';

var RCTActionSheetManager = require('NativeModules').ActionSheetManager;
var processColor = require('processColor');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this under invariant, keep them grouped and alphabetically ordered

@facebook-github-bot
Copy link
Contributor

@christopherdro updated the pull request.

@christopherdro
Copy link
Contributor Author

@ide Thanks for your comments. Just updated the PR with a few of those changes.


if (processedTintColor) {
options.tintColor = processedTintColor;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can just be collapsed to

options.tintColor = processColor(options.tintColor);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea this was made based on @ide comment here.
#4590 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

He's right that you shouldn't call processColor() multiple times, but I also don't think there's any benefit to checking its result before assigning it.

In the code as you've written it, if options.tintColor is some invalid string that causes processedTintColor to return null or zero, you're actually leaving options.tintColor as the original string instead of overwriting it with transparent, which will then crash the native code that's expecting a number instead of a string.

It's perfectly safe to just write

options.tintColor = processColor(options.tintColor);

That should ensure that whatever garbage value options.tintColor goes in as, it will come out as a sanitised value. If for some reason it doesn't, that should be fixed in processColor.js, not in ActionSheetIOS.js.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicklockwood Thanks again for taking a look.

@facebook-github-bot
Copy link
Contributor

@christopherdro updated the pull request.

@mkonicek
Copy link
Contributor

mkonicek commented Dec 7, 2015

@facebook-github-bot import

@facebook-github-bot
Copy link
Contributor

Thanks for importing. If you are an FB employee go to https://our.intern.facebook.com/intern/opensource/github/pull_request/146659502363867/int_phab to review.

facebook-github-bot pushed a commit that referenced this pull request Nov 6, 2017
Summary:
This pr adds documentation for the tintColor addition of #4590

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

The tintColor was missing from the documentation but works perfectly fine.

Added a tintColor to showActionSheetWithOptions and showShareActionSheetWithOptions in the app i am building right now.

[DOCS][MINOR][ActionSheetIOS] - Added documentation for tintColor in ActionSheet.
Closes #16679

Differential Revision: D6248070

Pulled By: shergin

fbshipit-source-id: a2276f50b42ff2c5858008f3641c9607f248744a
cdlewis pushed a commit to cdlewis/react-native that referenced this pull request Nov 19, 2017
Summary:
This pr adds documentation for the tintColor addition of facebook#4590

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

The tintColor was missing from the documentation but works perfectly fine.

Added a tintColor to showActionSheetWithOptions and showShareActionSheetWithOptions in the app i am building right now.

[DOCS][MINOR][ActionSheetIOS] - Added documentation for tintColor in ActionSheet.
Closes facebook#16679

Differential Revision: D6248070

Pulled By: shergin

fbshipit-source-id: a2276f50b42ff2c5858008f3641c9607f248744a
hramos pushed a commit to facebook/react-native-website that referenced this pull request Dec 11, 2017
* Document `tintColor` option for ActionSheetIOS

also:
- fixed the `showActionSheetWithOptions` example

This option was added in facebook/react-native#4590

FYI, this is not even documented in the comments
https://github.com/facebook/react-native/blob/master/Libraries/ActionSheetIOS/ActionSheetIOS.js#L28

Are the docs generated from the code? Should I update that instead?

* add tintColor option in docs/ folder as well
risenforward pushed a commit to risenforward/proactive-web that referenced this pull request Jan 4, 2019
* Document `tintColor` option for ActionSheetIOS

also:
- fixed the `showActionSheetWithOptions` example

This option was added in facebook/react-native#4590

FYI, this is not even documented in the comments
https://github.com/facebook/react-native/blob/master/Libraries/ActionSheetIOS/ActionSheetIOS.js#L28

Are the docs generated from the code? Should I update that instead?

* add tintColor option in docs/ folder as well
JackWillie added a commit to JackWillie/react-native-website that referenced this pull request Nov 27, 2022
* Document `tintColor` option for ActionSheetIOS

also:
- fixed the `showActionSheetWithOptions` example

This option was added in facebook/react-native#4590

FYI, this is not even documented in the comments
https://github.com/facebook/react-native/blob/master/Libraries/ActionSheetIOS/ActionSheetIOS.js#L28

Are the docs generated from the code? Should I update that instead?

* add tintColor option in docs/ folder as well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Platform: iOS iOS applications.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants