A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
mobile: fix cannot read property jsx of undefined
Ammar Ahmed02f96f8d1409
diff --git a/apps/mobile/app/components/sheets/github/issue.js b/apps/mobile/app/components/sheets/github/issue.jsindex 7a5469098..2479e0710 100644--- a/apps/mobile/app/components/sheets/github/issue.js+++ b/apps/mobile/app/components/sheets/github/issue.js@@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.import { Debug } from "@notesnook/core/dist/api/debug";import { useThemeColors } from "@notesnook/theme";-import Clipboard from "@react-native-clipboard/clipboard";import React, { useRef, useState } from "react";import { Linking, Platform, Text, TextInput, View } from "react-native";import { getVersion } from "react-native-device-info";@@ -30,23 +29,22 @@ import { useUserStore } from "../../../stores/use-user-store";import { eCloseSheet } from "../../../utils/events";import { openLinkInBrowser } from "../../../utils/functions";import { SIZE } from "../../../utils/size";-import { sleep } from "../../../utils/time";import DialogHeader from "../../dialog/dialog-header";-import { presentDialog } from "../../dialog/functions";import { Button } from "../../ui/button";import Seperator from "../../ui/seperator";+import Heading from "../../ui/typography/heading";import Paragraph from "../../ui/typography/paragraph";export const Issue = ({ defaultTitle, defaultBody, issueTitle }) => {const { colors } = useThemeColors();-- const body = useStoredRef("issueBody", defaultBody);+ const body = useStoredRef("issueBody");const title = useStoredRef("issueTitle", defaultTitle);-+ const [done, setDone] = useState(false);const user = useUserStore((state) => state.user);const [loading, setLoading] = useState(false);const bodyRef = useRef();const initialLayout = useRef(false);+ const issueUrl = useRef();const onPress = async () => {if (loading) return;@@ -56,10 +54,11 @@ export const Issue = ({ defaultTitle, defaultBody, issueTitle }) => {try {setLoading(true);- let issue_url = await Debug.report({+ issueUrl.current = await Debug.report({title: title.current,body:body.current ++ `\n${defaultBody}` +`\n_______________**Device information:**App version: ${getVersion()}@@ -75,38 +74,7 @@ Logged in: ${user ? "yes" : "no"}`,eSendEvent(eCloseSheet);body.reset();title.reset();- await sleep(300);- presentDialog({- title: "Issue reported",- paragraph: (- <Text>- You can track your issue at{" "}- <Text- style={{- textDecorationLine: "underline",- color: colors.primary.accent- }}- onPress={() => {- Linking.openURL(issue_url);- }}- >- {issue_url}.- </Text>{" "}- Please note that we will respond to your issue on the given link. We- recommend that you save it.- </Text>- ),- positiveText: "Copy link",- positivePress: () => {- Clipboard.setString(issue_url);- ToastManager.show({- heading: "Issue url copied!",- type: "success",- context: "global"- });- },- negativeText: "Close"- });+ setDone(true);} catch (e) {setLoading(false);ToastManager.show({@@ -124,125 +92,179 @@ Logged in: ${user ? "yes" : "no"}`,width: "100%"}}>- <DialogHeader- title={issueTitle || "Report issue"}- paragraph={- issueTitle- ? "We are sorry, it seems that the app crashed due to an error. You can submit a bug report below so we can fix this asap."- : "Let us know if you have faced any issue/bug while using Notesnook."- }- />-- <Seperator half />-- <TextInput- placeholder="Title"- onChangeText={(v) => (title.current = v)}- defaultValue={title.current}- style={{- borderWidth: 1,- borderColor: colors.primary.border,- borderRadius: 5,- padding: 12,- fontFamily: "OpenSans-Regular",- marginBottom: 10,- fontSize: SIZE.md,- color: colors.primary.heading- }}- placeholderTextColor={colors.primary.placeholder}- />-- <TextInput- ref={bodyRef}- placeholder={`Tell us more about the issue you are facing.-+ {done ? (+ <>+ <View+ style={{+ height: 250,+ justifyContent: "center",+ alignItems: "center",+ gap: 10+ }}+ >+ <Heading>Issue submitted</Heading>+ <Paragraph+ style={{+ textAlign: "center"+ }}+ selectable={true}+ >+ You can track your issue at{" "}+ <Paragraph+ style={{+ textDecorationLine: "underline",+ color: colors.primary.accent+ }}+ onPress={() => {+ Linking.openURL(issueUrl.current);+ }}+ >+ {issueUrl.current}+ </Paragraph>+ . Please note that we will respond to your issue on the given+ link. We recommend that you save it.+ </Paragraph>++ <Button+ title="Open issue"+ onPress={() => {+ Linking.openURL(issueUrl.current);+ }}+ type="accent"+ width="100%"+ />+ </View>+ </>+ ) : (+ <>+ <DialogHeader+ title={issueTitle || "Report issue"}+ paragraph={+ issueTitle+ ? "We are sorry, it seems that the app crashed due to an error. You can submit a bug report below so we can fix this asap."+ : "Let us know if you have faced any issue/bug while using Notesnook."+ }+ />++ <Seperator half />++ <TextInput+ placeholder="Title"+ onChangeText={(v) => (title.current = v)}+ defaultValue={title.current}+ style={{+ borderWidth: 1,+ borderColor: colors.primary.border,+ borderRadius: 5,+ padding: 12,+ fontFamily: "OpenSans-Regular",+ marginBottom: 10,+ fontSize: SIZE.md,+ color: colors.primary.heading+ }}+ placeholderTextColor={colors.primary.placeholder}+ />++ <TextInput+ ref={bodyRef}+ multiline+ placeholder={`Tell us more about the issue you are facing.+For example:-- Steps to reproduce the issue+- What were you trying to do in the app?+- What did you expect to happen?+- Steps to reproduce the issue- Things you have tried etc.`}- multiline- numberOfLines={5}- textAlignVertical="top"- onChangeText={(v) => (body.current = v)}- onLayout={() => {- if (initialLayout.current) return;- initialLayout.current = true;- if (body.current) {- bodyRef.current?.setNativeProps({- text: body.current,- selection: {- start: 0,- end: 0+ numberOfLines={5}+ textAlignVertical="top"+ onChangeText={(v) => (body.current = v)}+ onLayout={() => {+ if (initialLayout.current) return;+ initialLayout.current = true;+ if (body.current) {+ bodyRef.current?.setNativeProps({+ text: body.current,+ selection: {+ start: 0,+ end: 0+ }+ });}- });- }- }}- style={{- borderWidth: 1,- borderColor: colors.primary.border,- borderRadius: 5,- padding: 12,- fontFamily: "OpenSans-Regular",- maxHeight: 200,- fontSize: SIZE.sm,- marginBottom: 2.5,- color: colors.primary.paragraph- }}- placeholderTextColor={colors.primary.placeholder}- />- <Paragraph- size={SIZE.xs}- color={colors.secondary.paragraph}- >{`App version: ${getVersion()} Platform: ${Platform.OS} Model: ${- Platform.constants.Brand- }-${Platform.constants.Model}-${Platform.constants.Version}`}</Paragraph>-- <Seperator />- <Button- onPress={onPress}- title={loading ? null : "Submit"}- loading={loading}- width="100%"- type="accent"- />-- <Paragraph- color={colors.secondary.paragraph}- size={SIZE.xs}- style={{- marginTop: 10,- textAlign: "center"- }}- >- The information above will be publically available at{" "}- <Text- onPress={() => {- Linking.openURL("https://github.com/streetwriters/notesnook");- }}- style={{- textDecorationLine: "underline",- color: colors.primary.accent- }}- >- github.com/streetwriters/notesnook.- </Text>{" "}- If you want to ask something in general or need some assistance, we- would suggest that you{" "}- <Text- style={{- textDecorationLine: "underline",- color: colors.primary.accent- }}- onPress={async () => {- try {- await openLinkInBrowser("https://discord.gg/zQBK97EE22", colors);- } catch (e) {- console.error(e);- }- }}- >- join our community on Discord.- </Text>- </Paragraph>+ }}+ style={{+ borderWidth: 1,+ borderColor: colors.primary.border,+ borderRadius: 5,+ padding: 12,+ fontFamily: "OpenSans-Regular",+ maxHeight: 200,+ fontSize: SIZE.sm,+ marginBottom: 2.5,+ color: colors.primary.paragraph+ }}+ placeholderTextColor={colors.primary.placeholder}+ />+ <Paragraph+ size={SIZE.xs}+ color={colors.secondary.paragraph}+ >{`App version: ${getVersion()} Platform: ${Platform.OS} Model: ${+ Platform.constants.Brand+ }-${Platform.constants.Model}-${+ Platform.constants.Version+ }`}</Paragraph>++ <Seperator />+ <Button+ onPress={onPress}+ title={loading ? null : "Submit"}+ loading={loading}+ width="100%"+ type="accent"+ />++ <Paragraph+ color={colors.secondary.paragraph}+ size={SIZE.xs}+ style={{+ marginTop: 10,+ textAlign: "center"+ }}+ >+ The information above will be publically available at{" "}+ <Text+ onPress={() => {+ Linking.openURL("https://github.com/streetwriters/notesnook");+ }}+ style={{+ textDecorationLine: "underline",+ color: colors.primary.accent+ }}+ >+ github.com/streetwriters/notesnook.+ </Text>{" "}+ If you want to ask something in general or need some assistance, we+ would suggest that you{" "}+ <Text+ style={{+ textDecorationLine: "underline",+ color: colors.primary.accent+ }}+ onPress={async () => {+ try {+ await openLinkInBrowser(+ "https://discord.gg/zQBK97EE22",+ colors+ );+ } catch (e) {+ console.error(e);+ }+ }}+ >+ join our community on Discord.+ </Text>+ </Paragraph>+ </>+ )}</View>);};diff --git a/apps/mobile/app/package.json b/apps/mobile/app/package.jsonindex b31cf050a..2bfa7f67e 100644--- a/apps/mobile/app/package.json+++ b/apps/mobile/app/package.json@@ -16,7 +16,7 @@"html-to-text": "9.0.5","phone": "^3.1.14","qclone": "^1.2.0",- "react-native-actions-sheet": "0.9.5",+ "react-native-actions-sheet": "0.9.6","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",diff --git a/apps/mobile/package-lock.json b/apps/mobile/package-lock.jsonindex 81750ad0f..c20b894c6 100644--- a/apps/mobile/package-lock.json+++ b/apps/mobile/package-lock.json@@ -28412,7 +28412,7 @@"pathe": "1.1.2","phone": "^3.1.14","qclone": "^1.2.0",- "react-native-actions-sheet": "0.9.5",+ "react-native-actions-sheet": "0.9.6","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",@@ -44779,9 +44779,9 @@}},"node_modules/react-native-actions-sheet": {- "version": "0.9.5",- "resolved": "https://registry.npmjs.org/react-native-actions-sheet/-/react-native-actions-sheet-0.9.5.tgz",- "integrity": "sha512-RpkKSIt0h1bupVX1XW9KImyDGu/PKrel6fQNELP3NDc4vSqcxQw1jIj0t8VpQfzg3vKGMeLk97VYgeTOIR/o1g==",+ "version": "0.9.6",+ "resolved": "https://registry.npmjs.org/react-native-actions-sheet/-/react-native-actions-sheet-0.9.6.tgz",+ "integrity": "sha512-BMEFmJD29izbOxkH81HJWNCgrjdW5iz4gB+Eyov9xwUPz/Fbi53R6AFvF9N3ttYT8nEvzxj56nqP7uJZ6KuKuA==","dependencies": {"react-native-safe-area-context": "^4.8.2"},