Merge remote-tracking branch 'origin/release/next-js'

This commit is contained in:
Liam Fitzgerald 2021-04-30 15:12:33 +10:00
commit 773c590055
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB
5 changed files with 26 additions and 23 deletions

View File

@ -1,7 +1,7 @@
const ua = window.navigator.userAgent;
export const IS_IOS = ua.includes('iPhone');
export const IS_IOS = ua.includes('iPhone') || ua.includes('iPad');
export const IS_SAFARI = ua.includes('Safari') && !ua.includes('Chrome');

View File

@ -443,9 +443,9 @@ function archive(json: any, state: HarkState): HarkState {
);
if(unarchived.length === 0) {
console.log('deleting entire timebox');
state.notifications.delete(time);
state.notifications = state.notifications.delete(time);
} else {
state.notifications.set(time, unarchived);
state.notifications = state.notifications.set(time, unarchived);
}
}
return state;

View File

@ -74,6 +74,8 @@ class ChatInput extends Component<ChatInputProps, ChatInputState> {
} else {
onSubmit(tokenizeMessage(text));
}
this.chatEditor.current.editor.focus();
this.setState({ currentInput: '' });
}
uploadSuccess(url: string) {

View File

@ -240,17 +240,12 @@ export default class ChatEditor extends Component {
rows="1"
style={{ width: '100%', background: 'transparent', color: 'currentColor' }}
placeholder={inCodeMode ? "Code..." : "Message..."}
onChange={event => {
this.messageChange(null, null, event.target.value);
}}
onKeyDown={event => {
if (event.key === 'Enter') {
event.preventDefault();
this.submit();
} else {
this.messageChange(null, null, event.target.value);
}
}}
onChange={event =>
this.messageChange(null, null, event.target.value)
}
onKeyDown={event =>
this.messageChange(null, null, event.target.value)
}
ref={input => {
if (!input) return;
this.editor = inputProxy(input);

View File

@ -93,7 +93,7 @@ const log = (level: LogLevel, message: string) => {
}
}
const ZONE_SIZE = IS_IOS ? 10 : 80;
const ZONE_SIZE = IS_IOS ? 20 : 80;
// nb: in this file, an index refers to a BigInteger and an offset refers to a
@ -208,7 +208,8 @@ export default class VirtualScroller<T> extends Component<VirtualScrollerProps<T
const { id, size, data, offset, pendingSize } = this.props;
if(size !== prevProps.size || pendingSize !== prevProps.pendingSize) {
if(this.scrollLocked) {
if((this.window?.scrollTop ?? 0) < ZONE_SIZE) {
this.scrollLocked = true;
this.updateVisible(0);
this.resetScroll();
}
@ -449,21 +450,26 @@ export default class VirtualScroller<T> extends Component<VirtualScrollerProps<T
if(offset === -1) {
return;
}
this.scrollLocked = false;
this.updateVisible(Math.max(offset - this.pageDelta, 0));
requestAnimationFrame(() => {
ref = this.childRefs.get(index.toString());
this.savedIndex = null;
this.savedDistance = 0;
this.saveDepth = 0;
requestAnimationFrame(() => {
this.savedIndex = null;
this.savedDistance = 0;
this.saveDepth = 0;
});
ref?.scrollIntoView({ block: 'center' });
});
} else {
this.savedIndex = null;
this.savedDistance = 0;
this.saveDepth = 0;
ref?.scrollIntoView({ block: 'center' });
requestAnimationFrame(() => {
this.savedIndex = null;
this.savedDistance = 0;
this.saveDepth = 0;
});
}
};