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

A way provide user to hide color history #39

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/HoloColorPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export class HoloColorPicker extends React.PureComponent {
resizeMode='contain'
style={[styles.pickerImage]}
/>
<View style={[styles.pickerIndicator, computed.pickerIndicator]} />
<View style={[styles.pickerIndicator, computed.pickerIndicator]} />
</View>
{oldColor &&
<TouchableOpacity
Expand All @@ -179,7 +179,7 @@ export class HoloColorPicker extends React.PureComponent {
activeOpacity={0.7}
/>
}
{!oldColor &&
{!oldColor && this.props.hideOldColor === false &&
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe here the prop does not make sense, since it has the setting hideOldColor to true has the same effect as not setting oldColor.

And missing default prop with === would change the default behaviour, however I believe it shouldn't be here at all (if I am not mistaken)

<TouchableOpacity
style={[styles.selectedFullPreview, computed.selectedFullPreview]}
onPress={this._onColorSelected}
Expand Down Expand Up @@ -213,6 +213,7 @@ HoloColorPicker.propTypes = {
onOldColorSelected: PropTypes.func,
hideSliders: PropTypes.bool,
sliderComponent: PropTypes.elementType,
hideOldColor: PropTypes.bool,
}

const makeComputedStyles = ({
Expand Down
6 changes: 5 additions & 1 deletion src/TriangleColorPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ export class TriangleColorPicker extends React.PureComponent {
</View>
}
</View>
<View style={[styles.colorPreviews, computed.colorPreviews]}>
{ this.props.hideOldColor === false &&
Copy link
Contributor

Choose a reason for hiding this comment

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

and here... I believe the property won't hide old color but "both" colors - maybe wrong name? hideColorPreview?

<View style={[styles.colorPreviews, computed.colorPreviews]}>
{oldColor &&
<TouchableOpacity
style={[styles.colorPreview, { backgroundColor: oldColor }]}
Expand All @@ -278,6 +279,7 @@ export class TriangleColorPicker extends React.PureComponent {
activeOpacity={0.7}
/>
</View>
}
</View>
)
}
Expand All @@ -295,10 +297,12 @@ TriangleColorPicker.propTypes = {
onColorSelected: PropTypes.func,
onOldColorSelected: PropTypes.func,
rotationHackFactor: PropTypes.number,
hideOldColor: PropTypes.bool,
}

TriangleColorPicker.defaultProps = {
rotationHackFactor: 100,
hideOldColor: false,
}

function getPickerProperties(pickerSize) {
Expand Down