From 53b6cd92ac5dacc2481f0ea84bbb918ddef82ab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=ABzim=20Veliu?= Date: Mon, 21 Jan 2019 13:09:16 +0100 Subject: [PATCH] Create select.windows.js --- lib/templates/bootstrap/select.windows.js | 67 +++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 lib/templates/bootstrap/select.windows.js diff --git a/lib/templates/bootstrap/select.windows.js b/lib/templates/bootstrap/select.windows.js new file mode 100644 index 00000000..2fd16cc0 --- /dev/null +++ b/lib/templates/bootstrap/select.windows.js @@ -0,0 +1,67 @@ +var React = require("react"); +var { View, Text, Picker } = require("react-native"); + +function select(locals) { + if (locals.hidden) { + return null; + } + + var stylesheet = locals.stylesheet; + var formGroupStyle = stylesheet.formGroup.normal; + var controlLabelStyle = stylesheet.controlLabel.normal; + var selectStyle = Object.assign( + {}, + stylesheet.select.normal, + stylesheet.pickerContainer.normal + ); + var helpBlockStyle = stylesheet.helpBlock.normal; + var errorBlockStyle = stylesheet.errorBlock; + + if (locals.hasError) { + formGroupStyle = stylesheet.formGroup.error; + controlLabelStyle = stylesheet.controlLabel.error; + selectStyle = stylesheet.select.error; + helpBlockStyle = stylesheet.helpBlock.error; + } + + var label = locals.label ? ( + {locals.label} + ) : null; + var help = locals.help ? ( + {locals.help} + ) : null; + var error = + locals.hasError && locals.error ? ( + + {locals.error} + + ) : null; + + var options = locals.options.map(({ value, text }) => ( + + )); + + return ( + + {label} + + {options} + + {help} + {error} + + ); +} + +module.exports = select;