From 8e62aaa6dc7c61dcba7b9313d0aadcf7f46ce41b Mon Sep 17 00:00:00 2001
From: Husam Salhab <47015061+hsalhab@users.noreply.github.com>
Date: Thu, 6 Aug 2020 16:11:11 -0400
Subject: [TMA-49] Add static boxes (#28)

* adds BigInput component

* removes dummy fields

* adds website TaggInput

* adds handleWebsiteUpdate()

* added website regex

* added form

* added handleFocusChange()

* sends website in request

* moves input components to onboarding

* allow for empty string in website regex

* adds bio regex

* adds bio field

* added bioRef for focusChange

* added react-native-datepicker

* moves TaggInput

* add imports

* add TaggDatePicker

* fix typescript interface

* remove TouchableComponent type

* added date and selectpicker

* added date and dropdown

* adds momentjs

* remove warnings from optional fields

* remove debugging console.log

* Removes isValidBirthdate

* moves @types/react-native-datepicker to devdepnden

* update package versioning

* fix positioning

* added checkpoint

* update button styling

* update placeholder

* linting and other fixes
---
 src/components/onboarding/TaggInput.tsx | 62 +++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 src/components/onboarding/TaggInput.tsx

(limited to 'src/components/onboarding/TaggInput.tsx')

diff --git a/src/components/onboarding/TaggInput.tsx b/src/components/onboarding/TaggInput.tsx
new file mode 100644
index 00000000..fe11d4f0
--- /dev/null
+++ b/src/components/onboarding/TaggInput.tsx
@@ -0,0 +1,62 @@
+import React from 'react';
+import {View, TextInput, StyleSheet, TextInputProps} from 'react-native';
+import * as Animatable from 'react-native-animatable';
+
+interface TaggInputProps extends TextInputProps {
+  valid?: boolean;
+  invalidWarning?: string;
+  attemptedSubmit?: boolean;
+  width?: number | string;
+}
+/**
+ * An input component that receives all props a normal TextInput component does. TaggInput components grow to 60% of their parent's width by default, but this can be set using the `width` prop.
+ */
+const TaggInput = React.forwardRef((props: TaggInputProps, ref: any) => {
+  return (
+    <View style={styles.container}>
+      <TextInput
+        style={[{width: props.width}, styles.input]}
+        placeholderTextColor="#ddd"
+        clearButtonMode="while-editing"
+        ref={ref}
+        {...props}
+      />
+      {props.attemptedSubmit && !props.valid && (
+        <Animatable.Text
+          animation="shake"
+          duration={500}
+          style={styles.warning}>
+          {props.invalidWarning}
+        </Animatable.Text>
+      )}
+    </View>
+  );
+});
+
+const styles = StyleSheet.create({
+  container: {
+    width: '100%',
+    alignItems: 'center',
+    marginVertical: 11,
+  },
+  input: {
+    minWidth: '60%',
+    height: 40,
+    fontSize: 16,
+    fontWeight: '600',
+    color: '#fff',
+    borderColor: '#fffdfd',
+    borderWidth: 2,
+    borderRadius: 20,
+    paddingLeft: 13,
+  },
+  warning: {
+    fontSize: 14,
+    marginTop: 5,
+    color: '#f4ddff',
+    maxWidth: 350,
+    textAlign: 'center',
+  },
+});
+
+export default TaggInput;
-- 
cgit v1.2.3-70-g09d2

