haya-select 1.0.58 → 1.0.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/src/select/index.jsx +9 -7
- package/src/select/option.jsx +7 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "haya-select",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.60",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"debounce": "^2.1.0",
|
|
14
14
|
"diggerize": "^1.0.4",
|
|
15
15
|
"fetching-object": "^1.0.1",
|
|
16
|
-
"
|
|
16
|
+
"react-native-render-html": "^6.3.4",
|
|
17
|
+
"set-state-compare": "^1.0.52"
|
|
17
18
|
},
|
|
18
19
|
"peerDependencies": {
|
|
19
20
|
"conjointment": ">= 0.1.4",
|
package/src/select/index.jsx
CHANGED
|
@@ -427,8 +427,8 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
|
|
|
427
427
|
icon={this.iconForOption(loadedOption)}
|
|
428
428
|
key={key}
|
|
429
429
|
option={loadedOption}
|
|
430
|
-
onOptionClicked={this.onOptionClicked}
|
|
431
|
-
presentOption={this.presentOption}
|
|
430
|
+
onOptionClicked={this.tt.onOptionClicked}
|
|
431
|
+
presentOption={this.tt.presentOption}
|
|
432
432
|
/>
|
|
433
433
|
)
|
|
434
434
|
}
|
|
@@ -765,16 +765,20 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
|
|
|
765
765
|
<View
|
|
766
766
|
dataSet={{
|
|
767
767
|
class: "option-presentation",
|
|
768
|
+
text: option.text,
|
|
768
769
|
toggleIcon: toggleOption?.icon,
|
|
769
770
|
toggleValue: toggleOption?.value,
|
|
770
771
|
value: option.value
|
|
771
772
|
}}
|
|
773
|
+
style={{flexDirection: "row"}}
|
|
772
774
|
>
|
|
773
775
|
{toggleOptions && !(option.value in toggled) &&
|
|
774
|
-
<View dataSet={{class: "toggle-icon-placeholder"}} style={{width:
|
|
776
|
+
<View dataSet={{class: "toggle-icon-placeholder"}} style={{width: 20}} />
|
|
775
777
|
}
|
|
776
778
|
{toggleOptions && (option.value in toggled) &&
|
|
777
|
-
<
|
|
779
|
+
<View style={{alignItems: "center", justifyContent: "center", width: 20}}>
|
|
780
|
+
<FontAwesomeIcon dataSet={{class: "toggle-icon"}} name={icon} />
|
|
781
|
+
</View>
|
|
778
782
|
}
|
|
779
783
|
{(() => {
|
|
780
784
|
if (mode == "current" && option.currentContent) {
|
|
@@ -787,7 +791,7 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
|
|
|
787
791
|
return <div dangerouslySetInnerHTML={{__html: digg(option, "html")}} />
|
|
788
792
|
} else {
|
|
789
793
|
return (
|
|
790
|
-
<Text dataSet={{class: "option-presentation-text"}} style={this.stylingFor("optionPresentationText", {whiteSpace: "nowrap"})}>
|
|
794
|
+
<Text dataSet={{class: "option-presentation-text"}} style={this.stylingFor("optionPresentationText", {flex: 1, whiteSpace: "nowrap"})}>
|
|
791
795
|
{option.text}
|
|
792
796
|
</Text>
|
|
793
797
|
)
|
|
@@ -803,8 +807,6 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
|
|
|
803
807
|
const currentValues = currentOptions?.map((currentOption) => currentOption.value)
|
|
804
808
|
const stateValues = this.s.currentOptions?.map((currentOption) => currentOption.value)
|
|
805
809
|
|
|
806
|
-
console.log("setCurrentFromGivenValues", {stateValues})
|
|
807
|
-
|
|
808
810
|
if (anythingDifferent(currentValues, stateValues)) {
|
|
809
811
|
this.setState({currentOptions})
|
|
810
812
|
}
|
package/src/select/option.jsx
CHANGED
|
@@ -4,9 +4,13 @@ import {shapeComponent, ShapeComponent} from "set-state-compare/src/shape-compon
|
|
|
4
4
|
import {View} from "react-native"
|
|
5
5
|
|
|
6
6
|
export default memo(shapeComponent(class Option extends ShapeComponent {
|
|
7
|
+
static defaultProps = {
|
|
8
|
+
disabled: false
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
static propTypes = {
|
|
8
12
|
currentOptionValues: PropTypes.array.isRequired,
|
|
9
|
-
disabled: PropTypes.bool,
|
|
13
|
+
disabled: PropTypes.bool.isRequired,
|
|
10
14
|
icon: PropTypes.string,
|
|
11
15
|
onOptionClicked: PropTypes.func.isRequired,
|
|
12
16
|
option: PropTypes.object.isRequired,
|
|
@@ -59,12 +63,12 @@ export default memo(shapeComponent(class Option extends ShapeComponent {
|
|
|
59
63
|
onPointerOut={this.tt.onPointerOut}
|
|
60
64
|
style={style}
|
|
61
65
|
>
|
|
62
|
-
{this.
|
|
66
|
+
{this.p.presentOption(option, "option")}
|
|
63
67
|
</View>
|
|
64
68
|
)
|
|
65
69
|
}
|
|
66
70
|
|
|
67
|
-
onClick = (e) => this.
|
|
71
|
+
onClick = (e) => this.p.onOptionClicked(e, this.props.option)
|
|
68
72
|
onPointerOver = () => this.setState({hover: true})
|
|
69
73
|
onPointerOut = () => this.setState({hover: false})
|
|
70
74
|
}))
|