From 41b81fc93feb898eeb04ad606f83e623e51fd95f Mon Sep 17 00:00:00 2001 From: ammarahm-ed Date: Thu, 23 Dec 2021 12:20:58 +0500 Subject: [PATCH] refactor editor view --- apps/mobile/src/views/Editor/index.js | 44 ++++++++------------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.js index 4c0731b3b..f249ffcd6 100755 --- a/apps/mobile/src/views/Editor/index.js +++ b/apps/mobile/src/views/Editor/index.js @@ -1,5 +1,5 @@ import React, {useEffect, useState} from 'react'; -import {Platform, ScrollView, TextInput, View} from 'react-native'; +import {Platform, View} from 'react-native'; import WebView from 'react-native-webview'; import {notesnook} from '../../../e2e/test.ids'; import {useEditorStore, useUserStore} from '../../provider/stores'; @@ -10,7 +10,6 @@ import { } from '../../services/EventManager'; import {getCurrentColors} from '../../utils/Colors'; import {eOnLoadNote} from '../../utils/Events'; -import {normalize} from '../../utils/SizeUtils'; import {sleep} from '../../utils/TimeUtils'; import EditorHeader from './EditorHeader'; import { @@ -18,7 +17,6 @@ import { getNote, onWebViewLoad, sourceUri, - textInput, _onMessage, _onShouldStartLoadWithRequest } from './Functions'; @@ -35,8 +33,6 @@ const style = { backgroundColor: 'transparent' }; -const CustomView = Platform.OS === 'ios' ? ScrollView : View; - const Editor = React.memo( () => { const premiumUser = useUserStore(state => state.premium); @@ -45,7 +41,6 @@ const Editor = React.memo( const onLoad = async () => { await onWebViewLoad(premiumUser, getCurrentColors()); }; - console.log(sessionId, 'updated id'); useEffect(() => { if (premiumUser) { @@ -57,7 +52,10 @@ const Editor = React.memo( setResetting(true); await sleep(30); setResetting(false); - eSendEvent(eOnLoadNote, getNote() ? {...getNote(),forced:true} : {type: 'new'}); + eSendEvent( + eOnLoadNote, + getNote() ? {...getNote(), forced: true} : {type: 'new'} + ); console.log('resetting editor'); if (!getNote()) { await sleep(10); @@ -72,36 +70,20 @@ const Editor = React.memo( }; }, []); - const androidStyle = Platform.OS == 'android' ? {flexGrow: 1, flex: 1} : {}; - return resetting ? null : ( <> - { onResetRequested(); }} @@ -137,13 +119,13 @@ const Editor = React.memo( allowFileAccessFromFileURLs={true} allowUniversalAccessFromFileURLs={true} originWhitelist={['*']} - source={source} - //source={{uri:"http://192.168.10.4:3000/index.html"}} + //source={source} + source={{uri:"http://192.168.10.13:5000/index.html"}} style={style} autoManageStatusBarEnabled={false} onMessage={_onMessage} /> - + );