@momo-kits/step 0.0.43-beta.28 → 0.0.43-beta.31
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/Step.constants.js +1 -0
- package/Step.horizontal.js +5 -4
- package/Step.js +2 -2
- package/Step.vertical.js +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const IS_VALID_URL = /((\w+:\/\/\S+)|(\w+[\.:]\w+\S+))[^\s,\.]/
|
package/Step.horizontal.js
CHANGED
|
@@ -2,6 +2,7 @@ import { Colors, IconSource, Image, Text } from '@momo-kits/core';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import React, { Component } from 'react';
|
|
4
4
|
import { View, StyleSheet, Dimensions, ScrollView } from 'react-native';
|
|
5
|
+
import { IS_VALID_URL } from 'Step.constants';
|
|
5
6
|
|
|
6
7
|
const CIRCLE_SIZE = 24;
|
|
7
8
|
const SCREEN_WIDTH = Dimensions.get('window').width;
|
|
@@ -154,15 +155,15 @@ export default class HorizontalStep extends Component {
|
|
|
154
155
|
circleBorderColor = '',
|
|
155
156
|
isActiveState = false,
|
|
156
157
|
circleUnchecked = false,
|
|
157
|
-
iconActive =
|
|
158
|
-
iconUnchecked =
|
|
158
|
+
iconActive = '',
|
|
159
|
+
iconUnchecked = '',
|
|
159
160
|
icon = {},
|
|
160
161
|
index = 0,
|
|
161
162
|
}) => {
|
|
162
163
|
let resultComponent = <></>;
|
|
163
164
|
if (!isActiveState) {
|
|
164
165
|
if (circleUnchecked) {
|
|
165
|
-
if (
|
|
166
|
+
if (IS_VALID_URL.test(iconUnchecked)) {
|
|
166
167
|
resultComponent = this._renderCircleImage({
|
|
167
168
|
icon,
|
|
168
169
|
circleColor,
|
|
@@ -185,7 +186,7 @@ export default class HorizontalStep extends Component {
|
|
|
185
186
|
} else {
|
|
186
187
|
// This is active case
|
|
187
188
|
// If icon diff "" & regex http or https url so will render image component
|
|
188
|
-
if (
|
|
189
|
+
if (IS_VALID_URL.test(iconActive)) {
|
|
189
190
|
resultComponent = this._renderCircleImage({
|
|
190
191
|
icon,
|
|
191
192
|
circleColor,
|
package/Step.js
CHANGED
|
@@ -45,9 +45,9 @@ Step.defaultProps = {
|
|
|
45
45
|
titles: [],
|
|
46
46
|
currentStep: 0,
|
|
47
47
|
isVertical: false,
|
|
48
|
-
iconActive:
|
|
48
|
+
iconActive: IconSource.ic_check_24,
|
|
49
49
|
iconChecked: IconSource.ic_check_24,
|
|
50
|
-
iconUnchecked:
|
|
50
|
+
iconUnchecked: IconSource.ic_check_24,
|
|
51
51
|
circleColorActive: '#d82d8b',
|
|
52
52
|
circleColorChecked: '#ffadd2',
|
|
53
53
|
circleColorUnchecked: Colors.black_06,
|
package/Step.vertical.js
CHANGED
|
@@ -2,6 +2,7 @@ import { Colors, IconSource, Image, Text } from '@momo-kits/core';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import React, { Component } from 'react';
|
|
4
4
|
import { View, StyleSheet, ScrollView } from 'react-native';
|
|
5
|
+
import { IS_VALID_URL } from 'Step.constants';
|
|
5
6
|
|
|
6
7
|
const CIRCLE_SIZE = 24;
|
|
7
8
|
|
|
@@ -142,7 +143,7 @@ export default class VerticalStep extends Component {
|
|
|
142
143
|
let resultComponent = <></>;
|
|
143
144
|
if (!isActiveState) {
|
|
144
145
|
if (circleUnchecked) {
|
|
145
|
-
if (
|
|
146
|
+
if (IS_VALID_URL.test(iconUnchecked)) {
|
|
146
147
|
resultComponent = this._renderCircleImage({
|
|
147
148
|
icon,
|
|
148
149
|
circleColor,
|
|
@@ -165,7 +166,7 @@ export default class VerticalStep extends Component {
|
|
|
165
166
|
} else {
|
|
166
167
|
// This is active case
|
|
167
168
|
// If icon diff "" & regex http or https url so will render image component
|
|
168
|
-
if (
|
|
169
|
+
if (IS_VALID_URL.test(iconActive)) {
|
|
169
170
|
resultComponent = this._renderCircleImage({
|
|
170
171
|
icon,
|
|
171
172
|
circleColor,
|