Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
render() {
if (this.props.element.getAttribute('hide') === 'true') {
return null;
}
const unselectedStyle = StyleSheet.flatten(
createStyleProp(this.props.element, this.props.stylesheets, {
selected: false,
}),
);
const selectedStyle = StyleSheet.flatten(
createStyleProp(this.props.element, this.props.stylesheets, {
selected: true,
}),
);
const props = {
ios_backgroundColor: unselectedStyle
? unselectedStyle.backgroundColor
: null,
trackColor: {
true: selectedStyle ? selectedStyle.backgroundColor : null,
false: unselectedStyle ? unselectedStyle.backgroundColor : null,
stylesheets,
{
...options,
styleAttr: 'modal-style',
},
);
const cancelTextStyle: Array> = createStyleProp(
element,
stylesheets,
{
...options,
pressed: this.state.cancelPressed,
styleAttr: 'modal-text-style',
},
);
const doneTextStyle: Array> = createStyleProp(
element,
stylesheets,
{
...options,
pressed: this.state.donePressed,
styleAttr: 'modal-text-style',
},
);
const cancelLabel: string =
element.getAttribute('cancel-label') || 'Cancel';
const doneLabel: string = element.getAttribute('done-label') || 'Done';
return (
renderPickerModal = (): ReactNode => {
const element: Element = this.props.element;
const stylesheets: StyleSheets = this.props.stylesheets;
const options: HvComponentOptions = this.props.options;
const modalStyle: Array> = createStyleProp(
element,
stylesheets,
{
...options,
styleAttr: 'modal-style',
},
);
const cancelTextStyle: Array> = createStyleProp(
element,
stylesheets,
{
...options,
pressed: this.state.cancelPressed,
styleAttr: 'modal-text-style',
},
);
renderAndroid = (): ReactNode => {
const element: Element = this.props.element;
const stylesheets: StyleSheets = this.props.stylesheets;
const options: HvComponentOptions = this.props.options;
const fieldStyle: StyleSheetType<*> = createStyleProp(
element,
stylesheets,
{
...options,
styleAttr: 'field-style',
},
);
const textStyle: StyleSheetType<*> = createStyleProp(element, stylesheets, {
...options,
styleAttr: 'field-text-style',
});
const pickerComponent = this.renderPicker(textStyle);
return ;
};
renderPickerModaliOS = (): ReactNode => {
if (Platform.OS === 'android') {
return null;
}
const element: Element = this.props.element;
const stylesheets: StyleSheets = this.props.stylesheets;
const options: HvComponentOptions = this.props.options;
const modalStyle: Array> = createStyleProp(
element,
stylesheets,
{
...options,
styleAttr: 'modal-style',
},
);
const cancelTextStyle: Array> = createStyleProp(
element,
stylesheets,
{
...options,
pressed: this.state.cancelPressed,
styleAttr: 'modal-text-style',
},
);
renderLabel = (formatter: Function): ReactNode => {
const element: Element = this.props.element;
const value: ?Date = this.state.value;
const stylesheets: StyleSheets = this.props.stylesheets;
const options: HvComponentOptions = this.props.options;
const placeholderTextColor: ?DOMString = element.getAttribute(
'placeholderTextColor',
);
const focused: boolean = this.state.focused;
const pressed: boolean = this.state.fieldPressed;
const fieldTextStyle = createStyleProp(element, stylesheets, {
...options,
focused,
pressed,
styleAttr: 'field-text-style',
});
if (!value && placeholderTextColor) {
fieldTextStyle.push({ color: placeholderTextColor });
}
const labelFormat = element.getAttribute('label-format');
const label: string = value
? formatter(value, labelFormat)
: element.getAttribute('placeholder') || '';
return ;
};
const element: Element = this.props.element;
const stylesheets: StyleSheets = this.props.stylesheets;
const options: HvComponentOptions = this.props.options;
if (element.getAttribute('hide') === 'true') {
return null;
}
const focused: boolean = this.state.focused;
const pressed: boolean = this.state.fieldPressed;
const props = createProps(element, stylesheets, {
...options,
focused,
pressed,
styleAttr: 'field-style',
});
const fieldTextStyle = createStyleProp(element, stylesheets, {
...options,
focused,
pressed,
styleAttr: 'field-text-style',
});
const value: ?DOMString = element.getAttribute('value');
const placeholderTextColor: ?DOMString = element.getAttribute(
'placeholderTextColor',
);
if (!value && placeholderTextColor) {
fieldTextStyle.push({ color: placeholderTextColor });
}
const label: string = value
? this.getLabelForValue(value) || value
: element.getAttribute('placeholder') || '';
stylesheets,
{
...options,
styleAttr: 'modal-style',
},
);
const cancelTextStyle: Array> = createStyleProp(
element,
stylesheets,
{
...options,
pressed: this.state.cancelPressed,
styleAttr: 'modal-text-style',
},
);
const doneTextStyle: Array> = createStyleProp(
element,
stylesheets,
{
...options,
pressed: this.state.donePressed,
styleAttr: 'modal-text-style',
},
);
const cancelLabel: string =
element.getAttribute('cancel-label') || 'Cancel';
const doneLabel: string = element.getAttribute('done-label') || 'Done';
return (
renderPickerModal = (): ReactNode => {
const element: Element = this.props.element;
const stylesheets: StyleSheets = this.props.stylesheets;
const options: HvComponentOptions = this.props.options;
const modalStyle: Array> = createStyleProp(
element,
stylesheets,
{
...options,
styleAttr: 'modal-style',
},
);
const cancelTextStyle: Array> = createStyleProp(
element,
stylesheets,
{
...options,
pressed: this.state.cancelPressed,
styleAttr: 'modal-text-style',
},
);
const doneTextStyle: Array> = createStyleProp(
element,
stylesheets,
{
...options,
pressed: this.state.donePressed,
styleAttr: 'modal-text-style',
},
renderAndroid = (): ReactNode => {
const element: Element = this.props.element;
const stylesheets: StyleSheets = this.props.stylesheets;
const options: HvComponentOptions = this.props.options;
const fieldStyle: StyleSheetType<*> = createStyleProp(
element,
stylesheets,
{
...options,
styleAttr: 'field-style',
},
);
const textStyle: StyleSheetType<*> = createStyleProp(element, stylesheets, {
...options,
styleAttr: 'field-text-style',
});
const pickerComponent = this.renderPicker(textStyle);
return ;
};