mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 15:09:33 +01:00
minor ui fixes
This commit is contained in:
@@ -12,7 +12,7 @@ import Icon from 'react-native-vector-icons/Feather';
|
|||||||
import {db, DDS} from '../../../App';
|
import {db, DDS} from '../../../App';
|
||||||
import {opacity, ph, pv, SIZE, WEIGHT} from '../../common/common';
|
import {opacity, ph, pv, SIZE, WEIGHT} from '../../common/common';
|
||||||
import {ACTIONS} from '../../provider';
|
import {ACTIONS} from '../../provider';
|
||||||
import {getElevation, ToastEvent, timeSince} from '../../utils/utils';
|
import {getElevation, ToastEvent} from '../../utils/utils';
|
||||||
import {updateEvent} from '../DialogManager';
|
import {updateEvent} from '../DialogManager';
|
||||||
|
|
||||||
let refs = [];
|
let refs = [];
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ export const AnimatedSafeAreaView = Animatable.createAnimatableComponent(
|
|||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const AnimatedTouchableOpacity = Animatable.createAnimatableComponent(
|
||||||
|
TouchableOpacity,
|
||||||
|
);
|
||||||
|
|
||||||
export const Container = ({
|
export const Container = ({
|
||||||
children,
|
children,
|
||||||
bottomButtonOnPress,
|
bottomButtonOnPress,
|
||||||
@@ -31,21 +35,25 @@ export const Container = ({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
Keyboard.addListener('keyboardDidShow', () => {
|
Keyboard.addListener('keyboardDidShow', () => {
|
||||||
|
setTimeout(() => {
|
||||||
setButtonHide(true);
|
setButtonHide(true);
|
||||||
|
}, 300);
|
||||||
});
|
});
|
||||||
Keyboard.addListener('keyboardDidHide', () => {
|
Keyboard.addListener('keyboardDidHide', () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setButtonHide(false);
|
setButtonHide(false);
|
||||||
}, 100);
|
}, 300);
|
||||||
});
|
});
|
||||||
return () => {
|
return () => {
|
||||||
Keyboard.removeListener('keyboardDidShow', () => {
|
Keyboard.removeListener('keyboardDidShow', () => {
|
||||||
|
setTimeout(() => {
|
||||||
setButtonHide(true);
|
setButtonHide(true);
|
||||||
|
}, 300);
|
||||||
});
|
});
|
||||||
Keyboard.removeListener('keyboardDidHide', () => {
|
Keyboard.removeListener('keyboardDidHide', () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setButtonHide(false);
|
setButtonHide(false);
|
||||||
}, 100);
|
}, 300);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
@@ -67,8 +75,11 @@ export const Container = ({
|
|||||||
}}>
|
}}>
|
||||||
{children}
|
{children}
|
||||||
|
|
||||||
{buttonHide || noBottomButton ? null : (
|
{noBottomButton ? null : (
|
||||||
<TouchableOpacity
|
<AnimatedTouchableOpacity
|
||||||
|
transition={['translateY', 'opacity']}
|
||||||
|
useNativeDriver={true}
|
||||||
|
duration={250}
|
||||||
onPress={bottomButtonOnPress}
|
onPress={bottomButtonOnPress}
|
||||||
activeOpacity={opacity}
|
activeOpacity={opacity}
|
||||||
style={{
|
style={{
|
||||||
@@ -83,6 +94,12 @@ export const Container = ({
|
|||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
zIndex: 10,
|
zIndex: 10,
|
||||||
bottom: 10,
|
bottom: 10,
|
||||||
|
opacity: buttonHide ? 0 : 1,
|
||||||
|
transform: [
|
||||||
|
{
|
||||||
|
translateY: buttonHide ? 200 : 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
}}>
|
}}>
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
@@ -104,7 +121,7 @@ export const Container = ({
|
|||||||
{' ' + bottomButtonText}
|
{' ' + bottomButtonText}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</TouchableOpacity>
|
</AnimatedTouchableOpacity>
|
||||||
)}
|
)}
|
||||||
</KeyboardAvoidingView>
|
</KeyboardAvoidingView>
|
||||||
</AnimatedSafeAreaView>
|
</AnimatedSafeAreaView>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
TouchableOpacity,
|
TouchableOpacity,
|
||||||
View,
|
View,
|
||||||
|
DeviceEventEmitter,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import FastStorage from 'react-native-fast-storage';
|
import FastStorage from 'react-native-fast-storage';
|
||||||
import Icon from 'react-native-vector-icons/Feather';
|
import Icon from 'react-native-vector-icons/Feather';
|
||||||
@@ -30,6 +31,8 @@ export const Menu = ({close = () => {}, hide, update = () => {}}) => {
|
|||||||
|
|
||||||
// todo
|
// todo
|
||||||
|
|
||||||
|
let overlayRef;
|
||||||
|
|
||||||
function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {
|
function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {
|
||||||
let newColors = setColorScheme(colors, accent);
|
let newColors = setColorScheme(colors, accent);
|
||||||
StatusBar.setBarStyle(newColors.night ? 'light-content' : 'dark-content');
|
StatusBar.setBarStyle(newColors.night ? 'light-content' : 'dark-content');
|
||||||
@@ -116,6 +119,19 @@ export const Menu = ({close = () => {}, hide, update = () => {}}) => {
|
|||||||
marginTop: Platform.OS == 'ios' ? 0 : StatusBar.currentHeight - 10,
|
marginTop: Platform.OS == 'ios' ? 0 : StatusBar.currentHeight - 10,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<View
|
||||||
|
ref={ref => (overlayRef = ref)}
|
||||||
|
onLayout={() => {
|
||||||
|
DeviceEventEmitter.emit('sendOverlayViewRef', {ref: overlayRef});
|
||||||
|
}}
|
||||||
|
style={{
|
||||||
|
height: '100%',
|
||||||
|
width: '100%',
|
||||||
|
position: 'absolute',
|
||||||
|
zIndex: 999,
|
||||||
|
backgroundColor: colors.bg,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
contentContainerStyle={{minHeight: '80%'}}
|
contentContainerStyle={{minHeight: '80%'}}
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ export const NotebookItem = ({
|
|||||||
{item && item.topics
|
{item && item.topics
|
||||||
? item.topics.slice(1, 4).map(topic => (
|
? item.topics.slice(1, 4).map(topic => (
|
||||||
<View
|
<View
|
||||||
|
key={topic.dateCreated.toString() + topic.title}
|
||||||
style={{
|
style={{
|
||||||
borderRadius: 5,
|
borderRadius: 5,
|
||||||
backgroundColor: colors.accent,
|
backgroundColor: colors.accent,
|
||||||
@@ -167,18 +168,14 @@ export const NotebookItem = ({
|
|||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
marginTop: 5,
|
marginTop: 5,
|
||||||
}}>
|
}}>
|
||||||
<Icon
|
{item.favorite ? (
|
||||||
style={{width: 30}}
|
|
||||||
name="lock"
|
|
||||||
size={SIZE.xs}
|
|
||||||
color={colors.icon}
|
|
||||||
/>
|
|
||||||
<Icon
|
<Icon
|
||||||
style={{width: 30}}
|
style={{width: 30}}
|
||||||
name="star"
|
name="star"
|
||||||
size={SIZE.xs}
|
size={SIZE.xs}
|
||||||
color={colors.icon}
|
color={colors.icon}
|
||||||
/>
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
<Text
|
<Text
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -20,11 +20,9 @@ import {
|
|||||||
TEMPLATE_EXIT,
|
TEMPLATE_EXIT,
|
||||||
} from '../../components/DialogManager';
|
} from '../../components/DialogManager';
|
||||||
import {EditorMenu} from '../../components/EditorMenu';
|
import {EditorMenu} from '../../components/EditorMenu';
|
||||||
import {useTracked} from '../../provider';
|
import {useTracked, ACTIONS} from '../../provider';
|
||||||
import {SideMenuEvent} from '../../utils/utils';
|
import {SideMenuEvent} from '../../utils/utils';
|
||||||
import {AnimatedSafeAreaView} from '../Home';
|
import {AnimatedSafeAreaView} from '../Home';
|
||||||
const w = Dimensions.get('window').width;
|
|
||||||
const h = Dimensions.get('window').height;
|
|
||||||
|
|
||||||
let EditorWebView;
|
let EditorWebView;
|
||||||
let note = {};
|
let note = {};
|
||||||
@@ -37,20 +35,9 @@ const Editor = ({navigation}) => {
|
|||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
const {colors} = state;
|
const {colors} = state;
|
||||||
|
|
||||||
///
|
|
||||||
const updateDB = () => {};
|
|
||||||
|
|
||||||
// Local State
|
// Local State
|
||||||
const [sidebar, setSidebar] = useState(DDS.isTab ? true : false);
|
const [sidebar, setSidebar] = useState(DDS.isTab ? true : false);
|
||||||
|
|
||||||
const [noteProps, setNoteProps] = useState({
|
|
||||||
tags: [],
|
|
||||||
locked: false,
|
|
||||||
pinned: false,
|
|
||||||
favorite: false,
|
|
||||||
colors: [],
|
|
||||||
});
|
|
||||||
|
|
||||||
// FUNCTIONS
|
// FUNCTIONS
|
||||||
|
|
||||||
const post = value => EditorWebView.postMessage(value);
|
const post = value => EditorWebView.postMessage(value);
|
||||||
@@ -72,8 +59,7 @@ const Editor = ({navigation}) => {
|
|||||||
timer = null;
|
timer = null;
|
||||||
onChange(evt.nativeEvent.data);
|
onChange(evt.nativeEvent.data);
|
||||||
timer = setTimeout(() => {
|
timer = setTimeout(() => {
|
||||||
saveNote(noteProps, true);
|
saveNote(true);
|
||||||
console.log('saved');
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -103,8 +89,8 @@ const Editor = ({navigation}) => {
|
|||||||
},
|
},
|
||||||
dateCreated: timestamp,
|
dateCreated: timestamp,
|
||||||
});
|
});
|
||||||
updateDB();
|
|
||||||
if (lockNote && noteProps.locked) {
|
if (lockNote && db.getNote(timestamp).locked) {
|
||||||
db.lockNote(timestamp, 'password');
|
db.lockNote(timestamp, 'password');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -118,15 +104,6 @@ const Editor = ({navigation}) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const updateEditor = () => {
|
const updateEditor = () => {
|
||||||
let props = {
|
|
||||||
tags: note.tags,
|
|
||||||
colors: note.colors,
|
|
||||||
pinned: note.pinned,
|
|
||||||
favorite: note.favorite,
|
|
||||||
locked: note.locked,
|
|
||||||
};
|
|
||||||
setNoteProps({...props});
|
|
||||||
|
|
||||||
post(JSON.stringify(note.content.delta));
|
post(JSON.stringify(note.content.delta));
|
||||||
post(
|
post(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
|
|||||||
@@ -12,12 +12,7 @@ const h = Dimensions.get('window').height;
|
|||||||
export const Tags = ({navigation}) => {
|
export const Tags = ({navigation}) => {
|
||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
const {colors} = state;
|
const {colors} = state;
|
||||||
let isFocused = useIsFocused();
|
|
||||||
|
|
||||||
if (!isFocused) {
|
|
||||||
console.log('block rerender');
|
|
||||||
return <></>;
|
|
||||||
} else {
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView
|
<SafeAreaView
|
||||||
style={{
|
style={{
|
||||||
@@ -103,7 +98,6 @@ export const Tags = ({navigation}) => {
|
|||||||
</View>
|
</View>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Tags.navigationOptions = {
|
Tags.navigationOptions = {
|
||||||
|
|||||||
Reference in New Issue
Block a user