Skip to content

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

mobile: small ui fixes

ammarahm-edf2c0c34c107d
diff --git a/apps/mobile/app/components/properties/color-tags.js b/apps/mobile/app/components/properties/color-tags.js
index 61255bdd3..4b6ee2f7c 100644
--- a/apps/mobile/app/components/properties/color-tags.js
+++ b/apps/mobile/app/components/properties/color-tags.js
@@ -22,7 +22,6 @@ import { View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { notesnook } from "../../../e2e/test.ids";
import { db } from "../../common/database";
-import { DDS } from "../../services/device-detection";
import { eSendEvent } from "../../services/event-manager";
import Navigation from "../../services/navigation";
import { useMenuStore } from "../../stores/use-menu-store";
@@ -34,9 +33,7 @@ import { PressableButton } from "../ui/pressable";
export const ColorTags = ({ item }) => {
const [note, setNote] = useState(item);
const setColorNotes = useMenuStore((state) => state.setColorNotes);
- const dimensions = useSettingStore((state) => state.dimensions);
- let width = dimensions.width > 600 ? 600 : 500;
-
+ const isTablet = useSettingStore((state) => state.deviceMode) !== "mobile";
const changeColor = async (color) => {
if (note.color === color.name) {
await db.notes.note(note.id).uncolor();
@@ -70,11 +67,12 @@ export const ColorTags = ({ item }) => {
key={color.value}
onPress={() => changeColor(color)}
customStyle={{
- width: DDS.isTab ? width / 10 : 30,
- height: DDS.isTab ? width / 10 : 30,
+ width: 30,
+ height: 30,
borderRadius: 100,
justifyContent: "center",
- alignItems: "center"
+ alignItems: "center",
+ marginRight: isTablet ? 10 : undefined
}}
>
{note.color?.toLowerCase() === color.name ? (
@@ -89,11 +87,10 @@ export const ColorTags = ({ item }) => {
style={{
flexDirection: "row",
flexWrap: "wrap",
- flexGrow: 1,
+ flexGrow: isTablet ? undefined : 1,
paddingHorizontal: 12,
- // width: "100%",
alignItems: "center",
- justifyContent: "space-between"
+ justifyContent: isTablet ? "center" : "space-between"
}}
>
{Object.keys(COLORS_NOTE).map(_renderColor)}
diff --git a/apps/mobile/app/components/properties/index.js b/apps/mobile/app/components/properties/index.js
index e55d39b15..9dd5163a3 100644
--- a/apps/mobile/app/components/properties/index.js
+++ b/apps/mobile/app/components/properties/index.js
@@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import { getUpcomingReminder } from "@notesnook/core/collections/reminders";
import React from "react";
import { Platform, View } from "react-native";
import { ScrollView } from "react-native-gesture-handler";
diff --git a/apps/mobile/app/components/properties/items.js b/apps/mobile/app/components/properties/items.js
index 08c45a42f..7420d7d0b 100644
--- a/apps/mobile/app/components/properties/items.js
+++ b/apps/mobile/app/components/properties/items.js
@@ -108,7 +108,59 @@ export const Items = ({ item, buttons, close }) => {
/>
);
- const bottomBarItemsList = [
+ const renderTopBarItem = ({ item }) => {
+ return (
+ <PressableButton
+ onPress={item.func}
+ key={item.id}
+ testID={"icon-" + item.id}
+ customStyle={{
+ alignItems: "center",
+ width: topBarItemWidth,
+ marginBottom: 10,
+ marginRight: 10,
+ backgroundColor: "transparent"
+ }}
+ >
+ <PressableButton
+ onPress={item.func}
+ type={item.on ? "shade" : "gray"}
+ customStyle={{
+ height: topBarItemWidth,
+ width: topBarItemWidth,
+ justifyContent: "center",
+ alignItems: "center",
+ textAlign: "center",
+ textAlignVertical: "center",
+ marginBottom: DDS.isTab ? 7 : 3.5,
+ borderRadius: 100
+ }}
+ >
+ <Icon
+ name={item.icon}
+ size={DDS.isTab ? SIZE.xxl : SIZE.md + 4}
+ color={
+ item.on
+ ? colors.accent
+ : item.name === "Delete" || item.name === "PermDelete"
+ ? colors.errorText
+ : colors.icon
+ }
+ />
+ </PressableButton>
+
+ <Paragraph
+ size={SIZE.xxs + 1}
+ style={{ textAlign: "center" }}
+ textBreakStrategy="simple"
+ >
+ {item.title}
+ </Paragraph>
+ </PressableButton>
+ );
+ };
+
+ const topBarItemsList = [
"pin",
"favorite",
"copy",
@@ -118,14 +170,14 @@ export const Items = ({ item, buttons, close }) => {
"publish"
];
const bottomBarItems = data.filter(
- (item) => bottomBarItemsList.indexOf(item.id) > -1
+ (item) => topBarItemsList.indexOf(item.id) > -1
);
- const gridItems = data.filter(
- (item) => bottomBarItemsList.indexOf(item.id) === -1
+ const bottomGridItems = data.filter(
+ (item) => topBarItemsList.indexOf(item.id) === -1
);
- const bottomBarItemWidth =
+ const topBarItemWidth =
(width - (bottomBarItems.length * 10 + 14)) / bottomBarItems.length;
return item.type === "note" ? (
@@ -134,68 +186,20 @@ export const Items = ({ item, buttons, close }) => {
data={bottomBarItems}
keyExtractor={(item) => item.title}
horizontal
+ disableVirtualization={true}
style={{
paddingHorizontal: 12,
paddingTop: 12
}}
- renderItem={({ item }) => {
- return (
- <PressableButton
- onPress={item.func}
- key={item.id}
- testID={"icon-" + item.id}
- customStyle={{
- alignItems: "center",
- width: bottomBarItemWidth,
- marginBottom: 10,
- marginRight: 10,
- backgroundColor: "transparent"
- }}
- >
- <PressableButton
- onPress={item.func}
- type={item.on ? "shade" : "gray"}
- customStyle={{
- height: bottomBarItemWidth,
- width: bottomBarItemWidth,
- justifyContent: "center",
- alignItems: "center",
- textAlign: "center",
- textAlignVertical: "center",
- marginBottom: DDS.isTab ? 7 : 3.5,
- borderRadius: 100
- }}
- >
- <Icon
- name={item.icon}
- size={DDS.isTab ? SIZE.xxl : SIZE.md + 4}
- color={
- item.on
- ? colors.accent
- : item.name === "Delete" || item.name === "PermDelete"
- ? colors.errorText
- : colors.icon
- }
- />
- </PressableButton>
-
- <Paragraph
- size={SIZE.xxs + 1}
- style={{ textAlign: "center" }}
- textBreakStrategy="simple"
- >
- {item.title}
- </Paragraph>
- </PressableButton>
- );
- }}
+ renderItem={renderTopBarItem}
/>
<FlatList
- data={gridItems}
+ data={bottomGridItems}
keyExtractor={(item) => item.title}
key={columnItemsCount + "key"}
numColumns={columnItemsCount}
+ disableVirtualization={true}
style={{
marginTop: item.type !== "note" ? 10 : 0,
paddingTop: 10
@@ -216,6 +220,7 @@ export const Items = ({ item, buttons, close }) => {
data={data}
keyExtractor={(item) => item.title}
renderItem={renderColumnItem}
+ disableVirtualization={true}
/>
);
};
diff --git a/apps/mobile/app/components/properties/tags.js b/apps/mobile/app/components/properties/tags.js
index 7314aa8f1..f6c68317c 100644
--- a/apps/mobile/app/components/properties/tags.js
+++ b/apps/mobile/app/components/properties/tags.js
@@ -40,7 +40,8 @@ export const Tags = ({ item, close }) => {
flexDirection: "row",
flexWrap: "wrap",
alignItems: "center",
- paddingHorizontal: 12
+ paddingHorizontal: 12,
+ alignSelf: "center"
}}
>
<Button
diff --git a/apps/mobile/app/components/sheets/reminder/index.tsx b/apps/mobile/app/components/sheets/reminder/index.tsx
index 1138aa8a4..408298ec2 100644
--- a/apps/mobile/app/components/sheets/reminder/index.tsx
+++ b/apps/mobile/app/components/sheets/reminder/index.tsx
@@ -259,6 +259,7 @@ export default function ReminderSheet({
marginTop: 10
}}
multiline
+ textAlignVertical="top"
inputStyle={{
height: 80
}}