diff --git a/native/components/color-selector-button.react.js b/native/components/color-selector-button.react.js
--- a/native/components/color-selector-button.react.js
+++ b/native/components/color-selector-button.react.js
@@ -1,25 +1,42 @@
// @flow
import * as React from 'react';
-import { View, StyleSheet } from 'react-native';
+import { TouchableOpacity, StyleSheet } from 'react-native';
+import Icon from 'react-native-vector-icons/Ionicons';
+import tinycolor from 'tinycolor2';
type ColorSelectorButtonProps = {
- color: string,
+ +color: string,
+ +currentColor: string,
};
function ColorSelectorButton(props: ColorSelectorButtonProps): React.Node {
- const { color } = props;
- const buttonStyle = React.useMemo(
- () => [styles.button, { backgroundColor: color }],
- [color],
+ const { color, currentColor } = props;
+
+ const colorSplotchStyle = React.useMemo(() => {
+ return [styles.button, { backgroundColor: `#${color}` }];
+ }, [color]);
+
+ const isSelected = tinycolor.equals(currentColor, color);
+ const selectedButtonIndicator = React.useMemo(() => {
+ if (isSelected) {
+ return ;
+ }
+ }, [isSelected]);
+
+ return (
+
+ {selectedButtonIndicator}
+
);
- return ;
}
const styles = StyleSheet.create({
button: {
+ alignItems: 'center',
borderRadius: 20,
height: 40,
+ justifyContent: 'center',
margin: 15,
width: 40,
},
diff --git a/native/components/color-selector.react.js b/native/components/color-selector.react.js
--- a/native/components/color-selector.react.js
+++ b/native/components/color-selector.react.js
@@ -3,26 +3,35 @@
import * as React from 'react';
import { Text, View, StyleSheet } from 'react-native';
+import { selectedThreadColors } from 'lib/shared/thread-utils';
+
import ColorSelectorButton from './color-selector-button.react';
-function ColorSelector(): React.Node {
+type ColorSelectorProps = {
+ +currentColor: string,
+};
+
+function ColorSelector(props: ColorSelectorProps): React.Node {
+ const { currentColor } = props;
+
+ const colorSelectorButtons = React.useMemo(
+ () =>
+ selectedThreadColors.map(color => (
+
+ )),
+ [currentColor],
+ );
+
return (
Select thread color
-
-
-
-
-
-
-
-
-
-
-
-
+ {colorSelectorButtons}
);
}