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
remove unecessary state updating
ammarahm-ede6e1b93fc56e
diff --git a/apps/mobile/src/components/ActionSheet/index.js b/apps/mobile/src/components/ActionSheet/index.jsindex e3ad977ed..44a92330e 100644--- a/apps/mobile/src/components/ActionSheet/index.js+++ b/apps/mobile/src/components/ActionSheet/index.js@@ -36,6 +36,7 @@ export default class ActionSheet extends Component {this.scrollAnimationEndValue;this.hasBounced;this.scrollViewRef;+ this.layoutHasCalled = false;}_setModalVisible = () => {@@ -55,26 +56,25 @@ export default class ActionSheet extends Component {this.setState({modalVisible: false,- layoutHasCalled: false,},() => {+ this.layoutHasCalled = false;if (typeof this.props.onClose === 'function') this.props.onClose();},);- }, 150);+ }, 500);};_showModal = event => {let {gestureEnabled, bounceOffset, initialOffsetFromBottom} = this.props;let addFactor = deviceHeight * 0.1;let height = event.nativeEvent.layout.height;- console.log('layout called again');- if (this.state.layoutHasCalled) {+ if (this.layoutHasCalled) {let diff;if (height > this.customComponentHeight) {diff = height - this.customComponentHeight;this._scrollTo(this.prevScroll + diff);- console.log(this.prevScroll);+this.customComponentHeight = height;} else {diff = this.customComponentHeight - height;@@ -85,22 +85,22 @@ export default class ActionSheet extends Component {} else {this.customComponentHeight = height;- this._scrollTo(- gestureEnabled- ? this.customComponentHeight * initialOffsetFromBottom +- addFactor +- bounceOffset- : this.customComponentHeight + bounceOffset,- );- this.setState({- layoutHasCalled: true,- });+ setTimeout(() => {+ this._scrollTo(+ gestureEnabled+ ? this.customComponentHeight * initialOffsetFromBottom ++ addFactor ++ bounceOffset+ : this.customComponentHeight + bounceOffset,+ );+ }, 300);++ this.layoutHasCalled = true;}};_onScrollBeginDrag = event => {let verticalOffset = event.nativeEvent.contentOffset.y;-this.prevScroll = verticalOffset;};diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.jsindex 72f927d22..2e2fa6ccf 100644--- a/apps/mobile/src/components/ActionSheetComponent/index.js+++ b/apps/mobile/src/components/ActionSheetComponent/index.js@@ -36,18 +36,22 @@ export const ActionSheetComponent = ({}) => {const {colors, changeColorScheme} = useAppContext();const [focused, setFocused] = useState(false);- const [note, setNote] = useState({- colors: [],- tags: [],- pinned: false,- favorite: false,- locked: false,- content: {- text: '',- delta: {},- },- dateCreated: null,- });+ const [note, setNote] = useState(+ item+ ? item+ : {+ colors: [],+ tags: [],+ pinned: false,+ favorite: false,+ locked: false,+ content: {+ text: '',+ delta: {},+ },+ dateCreated: null,+ },+ );useEffect(() => {if (item.dateCreated !== null) {@@ -277,10 +281,6 @@ export const ActionSheetComponent = ({return (<View- onLayout={() => {- console.log(item);- setNote({...item});- }}style={{paddingBottom: 15,backgroundColor: colors.bg,