Skip to content

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

add selection background

ammarahm-ed1895452fdaa5
diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.js
index 52004b023..701a3c772 100644
--- a/apps/mobile/src/components/NoteItem/index.js
+++ b/apps/mobile/src/components/NoteItem/index.js
@@ -29,9 +29,6 @@ export default class NoteItem extends React.Component {
}
shouldComponentUpdate(nextProps, nextState) {
- if (nextProps.currentEditingNote === this.props.item.dateCreated) {
- return true;
- }
if (nextProps.item.locked !== this.cipher.value) {
return true;
} else {
@@ -62,7 +59,6 @@ export default class NoteItem extends React.Component {
isTrash,
pinned,
index,
- currentEditingNote,
} = this.props;
console.log('rendering', index);
return (
@@ -75,12 +71,10 @@ export default class NoteItem extends React.Component {
flexDirection: 'row',
maxWidth: '100%',
paddingRight: 12,
+
alignSelf: 'center',
borderBottomWidth: 1,
- borderBottomColor:
- currentEditingNote === item.dateCreated
- ? colors.accent
- : colors.nav,
+ borderBottomColor: colors.nav,
},
customStyle ? customStyle : {},
]}>
@@ -134,10 +128,7 @@ export default class NoteItem extends React.Component {
<Text
numberOfLines={1}
style={{
- color:
- currentEditingNote === item.dateCreated
- ? colors.accent
- : colors.pri,
+ color: colors.pri,
fontSize: SIZE.md,
fontFamily: WEIGHT.bold,
maxWidth: '95%',
diff --git a/apps/mobile/src/components/NotesList/index.js b/apps/mobile/src/components/NotesList/index.js
index 82a921b82..2c65f8441 100644
--- a/apps/mobile/src/components/NotesList/index.js
+++ b/apps/mobile/src/components/NotesList/index.js
@@ -22,7 +22,11 @@ export const NotesList = ({
const notes = [...state.notes];
const _renderItem = ({item, index}) => (
- <SelectionWrapper item={item}>
+ <SelectionWrapper
+ currentEditingNote={
+ currentEditingNote === item.dateCreated ? currentEditingNote : null
+ }
+ item={item}>
<NoteItem
colors={colors}
customStyle={{
diff --git a/apps/mobile/src/components/SelectionWrapper/index.js b/apps/mobile/src/components/SelectionWrapper/index.js
index 7abf10f75..b8d53f9d0 100644
--- a/apps/mobile/src/components/SelectionWrapper/index.js
+++ b/apps/mobile/src/components/SelectionWrapper/index.js
@@ -5,7 +5,7 @@ import Icon from 'react-native-vector-icons/Feather';
import {w} from '../../utils/utils';
import {useTracked, ACTIONS} from '../../provider';
-const SelectionWrapper = ({children, item}) => {
+const SelectionWrapper = ({children, item, currentEditingNote}) => {
const [state, dispatch] = useTracked();
const {colors, selectionMode, selectedItemsList} = state;
@@ -17,6 +17,10 @@ const SelectionWrapper = ({children, item}) => {
alignItems: 'center',
width: '100%',
paddingHorizontal: 12,
+ backgroundColor:
+ currentEditingNote === item.dateCreated
+ ? colors.shade
+ : 'transparent',
}}>
<View
onPress={() => {