Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix note item colors

ammarahm-eda3eb76e95bf6
diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.js
index 4338c3057..e9b1f6715 100644
--- a/apps/mobile/src/components/NoteItem/index.js
+++ b/apps/mobile/src/components/NoteItem/index.js
@@ -19,7 +19,7 @@ export default class NoteItem extends React.Component {
this.cipher = {
value: false,
};
- this.colors = [];
+ this.color;
this.actionSheet;
this.show = null;
this.setMenuRef = {};
@@ -29,7 +29,7 @@ export default class NoteItem extends React.Component {
shouldComponentUpdate(nextProps, nextState) {
if (
nextProps.item.locked !== this.cipher.value ||
- nextProps.item.colors.length !== this.colors.length ||
+ nextProps.item.color !== this.color ||
nextProps.selectionMode !== this.props.selectionMode
) {
return true;
@@ -41,15 +41,15 @@ export default class NoteItem extends React.Component {
}
}
componentDidUpdate() {
- this.colors = [...this.props.item.colors];
+ this.color = this.props.item.color;
this.cipher.value = this.props.item.locked ? true : false;
}
componentWillUnmount() {
- this.colors = [];
+ this.color = null;
this.cipher.value = false;
}
componentDidMount() {
- this.colors = [];
+ this.color = null;
if (this.props.item.locked) {
this.cipher.value = true;
}
@@ -69,7 +69,7 @@ export default class NoteItem extends React.Component {
render() {
let {colors, item, customStyle, isTrash} = this.props;
- console.log(item,"ITE<")
+ console.log(item, 'ITE<');
return (
<View
style={[
@@ -162,7 +162,7 @@ export default class NoteItem extends React.Component {
}}>
{!isTrash ? (
<>
- {item.color &&
+ {item.color && (
<View
key={item}
style={{
@@ -173,7 +173,8 @@ export default class NoteItem extends React.Component {
marginRight: -4.5,
marginRight: 10,
}}
- />}
+ />
+ )}
{item.locked ? (
<Icon
diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.js
index 801fa6ef1..4641fcb53 100644
--- a/apps/mobile/src/views/Settings/index.js
+++ b/apps/mobile/src/views/Settings/index.js
@@ -242,9 +242,10 @@ const SettingsUserSection = () => {
const [state, dispatch] = useTracked();
const {colors, user} = state;
const [visible, setVisible] = useState(false);
+
const getTimeLeft = (t2) => {
let d1 = new Date(Date.now());
- let d2 = new Date(t2 * 1000);
+ let d2 = new Date(t2);
let diff = d2.getTime() - d1.getTime();
diff = (diff / (1000 * 3600 * 24)).toFixed(0);