mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
mobile: finalize topic sheet ui
This commit is contained in:
@@ -43,7 +43,11 @@ import useNavigationStore, {
|
||||
NotebookScreenParams
|
||||
} from "../../../stores/use-navigation-store";
|
||||
import { useThemeStore } from "../../../stores/use-theme-store";
|
||||
import { eOnNewTopicAdded, eOpenAddTopicDialog } from "../../../utils/events";
|
||||
import {
|
||||
eOnNewTopicAdded,
|
||||
eOnTopicSheetUpdate,
|
||||
eOpenAddTopicDialog
|
||||
} from "../../../utils/events";
|
||||
import { normalize, SIZE } from "../../../utils/size";
|
||||
import { NotebookType, TopicType } from "../../../utils/types";
|
||||
|
||||
@@ -92,9 +96,14 @@ export const TopicsSheet = () => {
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const onTopicUpdate = () => {
|
||||
onRequestUpdate();
|
||||
};
|
||||
eSubscribeEvent(eOnTopicSheetUpdate, onTopicUpdate);
|
||||
eSubscribeEvent(eOnNewTopicAdded, onRequestUpdate);
|
||||
return () => {
|
||||
eUnSubscribeEvent(eOnNewTopicAdded, onRequestUpdate);
|
||||
eUnSubscribeEvent(eOnTopicSheetUpdate, onRequestUpdate);
|
||||
eUnSubscribeEvent(eOnNewTopicAdded, onTopicUpdate);
|
||||
};
|
||||
}, [onRequestUpdate]);
|
||||
|
||||
@@ -167,7 +176,7 @@ export const TopicsSheet = () => {
|
||||
ref={ref}
|
||||
isModal={false}
|
||||
containerStyle={{
|
||||
maxHeight: 600,
|
||||
maxHeight: 400,
|
||||
borderTopRightRadius: 15,
|
||||
borderTopLeftRadius: 15,
|
||||
backgroundColor: colors.bg,
|
||||
@@ -186,7 +195,7 @@ export const TopicsSheet = () => {
|
||||
initialSnapIndex={0}
|
||||
backgroundInteractionEnabled
|
||||
onChange={(position, height) => {
|
||||
animations.translate.setValue(position);
|
||||
animations.translate.setValue(position - 60);
|
||||
const h = Dimensions.get("window").height;
|
||||
const minPos = h - height;
|
||||
if (position - 100 < minPos || !canShow) {
|
||||
@@ -221,8 +230,7 @@ export const TopicsSheet = () => {
|
||||
accentText="light"
|
||||
onPress={openEditor}
|
||||
customStyle={{
|
||||
borderRadius: 100,
|
||||
bottom: 50
|
||||
borderRadius: 100
|
||||
}}
|
||||
>
|
||||
<View
|
||||
@@ -241,8 +249,8 @@ export const TopicsSheet = () => {
|
||||
>
|
||||
<View
|
||||
style={{
|
||||
maxHeight: 600,
|
||||
height: 600,
|
||||
maxHeight: 400,
|
||||
height: 400,
|
||||
width: "100%"
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"html-to-text": "8.1.0",
|
||||
"phone": "^3.1.14",
|
||||
"qclone": "^1.2.0",
|
||||
"react-native-actions-sheet": "^0.9.0-alpha.9",
|
||||
"react-native-actions-sheet": "^0.9.0-alpha.11",
|
||||
"react-native-check-version": "https://github.com/flexible-agency/react-native-check-version",
|
||||
"react-native-drax": "^0.10.2",
|
||||
"react-native-image-zoom-viewer": "^3.0.1",
|
||||
|
||||
@@ -28,5 +28,5 @@ const EditorMobileSourceUrl =
|
||||
* The url should be something like this: http://192.168.100.126:3000/index.html
|
||||
*/
|
||||
export const EDITOR_URI = __DEV__
|
||||
? "http://192.168.8.103:3000/index.html"
|
||||
? EditorMobileSourceUrl
|
||||
: EditorMobileSourceUrl;
|
||||
|
||||
@@ -248,7 +248,6 @@ const handleImageResponse = async (response, options) => {
|
||||
const isPng = /(png)/g.test(image.type);
|
||||
const isJpeg = /(jpeg|jpg)/g.test(image.type);
|
||||
if (isPng || isJpeg) {
|
||||
console.log(image.uri);
|
||||
b64 =
|
||||
`data:${image.type};base64, ` +
|
||||
(await compressToBase64(
|
||||
|
||||
@@ -230,7 +230,6 @@ export const useEditor = (
|
||||
id = await db.notes?.add(noteData);
|
||||
if (!note && id) {
|
||||
currentNote.current = db.notes?.note(id).data as NoteType;
|
||||
console.log("on Note Created", state.current?.onNoteCreated);
|
||||
state.current?.onNoteCreated && state.current.onNoteCreated(id);
|
||||
if (!noteData.title) {
|
||||
postMessage(
|
||||
|
||||
@@ -24,7 +24,7 @@ import Navigation from "../../services/navigation";
|
||||
import { useMenuStore } from "../../stores/use-menu-store";
|
||||
import { NotesScreenParams } from "../../stores/use-navigation-store";
|
||||
import { useTagStore } from "../../stores/use-tag-store";
|
||||
import { eOnLoadNote } from "../../utils/events";
|
||||
import { eOnLoadNote, eOnTopicSheetUpdate } from "../../utils/events";
|
||||
import { openLinkInBrowser } from "../../utils/functions";
|
||||
import { tabBarRef } from "../../utils/global-refs";
|
||||
import { TopicType } from "../../utils/types";
|
||||
@@ -125,6 +125,7 @@ async function onNoteCreated(id: string, params: FirstSaveData) {
|
||||
"Notebook",
|
||||
"Notebooks"
|
||||
);
|
||||
eSendEvent(eOnTopicSheetUpdate);
|
||||
break;
|
||||
}
|
||||
case "tag": {
|
||||
|
||||
@@ -158,3 +158,5 @@ export const eCloseAnnouncementDialog = "604";
|
||||
|
||||
export const eOpenLoading = "605";
|
||||
export const eCloseLoading = "606";
|
||||
|
||||
export const eOnTopicSheetUpdate = "607";
|
||||
|
||||
16
apps/mobile/package-lock.json
generated
16
apps/mobile/package-lock.json
generated
@@ -42,7 +42,7 @@
|
||||
"qclone": "^1.2.0",
|
||||
"react": "18.0.0",
|
||||
"react-native": "0.69.7",
|
||||
"react-native-actions-sheet": "^0.9.0-alpha.9",
|
||||
"react-native-actions-sheet": "^0.9.0-alpha.11",
|
||||
"react-native-check-version": "https://github.com/flexible-agency/react-native-check-version",
|
||||
"react-native-drax": "^0.10.2",
|
||||
"react-native-image-zoom-viewer": "^3.0.1",
|
||||
@@ -17957,9 +17957,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/react-native-actions-sheet": {
|
||||
"version": "0.9.0-alpha.10",
|
||||
"resolved": "https://registry.npmjs.org/react-native-actions-sheet/-/react-native-actions-sheet-0.9.0-alpha.10.tgz",
|
||||
"integrity": "sha512-R1WcRPwtgaVwMOvDhVnYD+dxTWSSF84Qgco3UT71U8o3F59nx3J4IJBamt5e8RDBinLXPxgPvXEYYw9UO9VtpA==",
|
||||
"version": "0.9.0-alpha.11",
|
||||
"resolved": "https://registry.npmjs.org/react-native-actions-sheet/-/react-native-actions-sheet-0.9.0-alpha.11.tgz",
|
||||
"integrity": "sha512-bYOQVpB3lHcBh+wYa+6IEXfQC3xrlDJh+yhdIhVMjSRybvgcHGSIali8cPrGuwRF7luF0fqZIS+xsEDQs5eahA==",
|
||||
"peerDependencies": {
|
||||
"react-native": "*",
|
||||
"react-native-gesture-handler": "*"
|
||||
@@ -24312,7 +24312,7 @@
|
||||
"qclone": "^1.2.0",
|
||||
"react": "18.0.0",
|
||||
"react-native": "0.69.7",
|
||||
"react-native-actions-sheet": "^0.9.0-alpha.9",
|
||||
"react-native-actions-sheet": "^0.9.0-alpha.11",
|
||||
"react-native-check-version": "https://github.com/flexible-agency/react-native-check-version",
|
||||
"react-native-drax": "^0.10.2",
|
||||
"react-native-image-zoom-viewer": "^3.0.1",
|
||||
@@ -34856,9 +34856,9 @@
|
||||
}
|
||||
},
|
||||
"react-native-actions-sheet": {
|
||||
"version": "0.9.0-alpha.10",
|
||||
"resolved": "https://registry.npmjs.org/react-native-actions-sheet/-/react-native-actions-sheet-0.9.0-alpha.10.tgz",
|
||||
"integrity": "sha512-R1WcRPwtgaVwMOvDhVnYD+dxTWSSF84Qgco3UT71U8o3F59nx3J4IJBamt5e8RDBinLXPxgPvXEYYw9UO9VtpA=="
|
||||
"version": "0.9.0-alpha.11",
|
||||
"resolved": "https://registry.npmjs.org/react-native-actions-sheet/-/react-native-actions-sheet-0.9.0-alpha.11.tgz",
|
||||
"integrity": "sha512-bYOQVpB3lHcBh+wYa+6IEXfQC3xrlDJh+yhdIhVMjSRybvgcHGSIali8cPrGuwRF7luF0fqZIS+xsEDQs5eahA=="
|
||||
},
|
||||
"react-native-actions-shortcuts": {
|
||||
"version": "1.0.1",
|
||||
|
||||
Reference in New Issue
Block a user