This commit is contained in:
Mirco Wittrien 2019-10-18 15:07:30 +02:00
parent 9bf7710b93
commit 8b23955a00
3 changed files with 10 additions and 6 deletions

View File

@ -1267,6 +1267,9 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
var node = LibraryModules.ReactDOM.findDOMNode(instance) || BDFDB.getReactValue(instance, "child.stateNode"); var node = LibraryModules.ReactDOM.findDOMNode(instance) || BDFDB.getReactValue(instance, "child.stateNode");
return Node.prototype.isPrototypeOf(node) ? node : null; return Node.prototype.isPrototypeOf(node) ? node : null;
}; };
BDFDB.React.forceUpdate = function (instance) {
if (instance && instance.updater && typeof instance.updater.isMounted == "function" && instance.updater.isMounted(instance)) instance.forceUpdate();
};
}; };
var myDataUser = LibraryModules.CurrentUserStore && typeof LibraryModules.CurrentUserStore.getCurrentUser == "function" ? LibraryModules.CurrentUserStore.getCurrentUser() : null; var myDataUser = LibraryModules.CurrentUserStore && typeof LibraryModules.CurrentUserStore.getCurrentUser == "function" ? LibraryModules.CurrentUserStore.getCurrentUser() : null;

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@
class PinDMs { class PinDMs {
getName () {return "PinDMs";} getName () {return "PinDMs";}
getVersion () {return "1.4.8";} getVersion () {return "1.4.9";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
@ -11,7 +11,7 @@ class PinDMs {
constructor () { constructor () {
this.changelog = { this.changelog = {
"fixed":[["Error","Fixed console log error about mounting"]] "fixed":[["Home/Library/Store","Fixed Pinned DMs not being added while switching to one of the pages"]]
}; };
this.patchModules = { this.patchModules = {
@ -398,6 +398,7 @@ class PinDMs {
let insertpoint = this.getInsertPoint(dms); let insertpoint = this.getInsertPoint(dms);
for (let pos in sortedDMs) this.addPinnedDM(sortedDMs[pos], dms, insertpoint); for (let pos in sortedDMs) this.addPinnedDM(sortedDMs[pos], dms, insertpoint);
} }
this.forceUpdateScroller(instance.getScrollerNode());
} }
if (this.oldScrollerPos != null) instance.getScrollerNode().scrollTop = this.oldScrollerPos; if (this.oldScrollerPos != null) instance.getScrollerNode().scrollTop = this.oldScrollerPos;
} }
@ -488,10 +489,10 @@ class PinDMs {
forceUpdateScroller (scroller) { forceUpdateScroller (scroller) {
if (this.updatingScroller) return; if (this.updatingScroller) return;
var stateNode = BDFDB.getReactValue(scroller, "return.return.return.stateNode"); var stateNode = BDFDB.getReactValue(scroller, "return.return.return.stateNode");
if (stateNode && stateNode.updater) { if (stateNode) {
this.updatingScroller = true; this.updatingScroller = true;
stateNode.updater.enqueueForceUpdate(stateNode); BDFDB.React.forceUpdate(stateNode);
setTimeout(() => {stateNode.updater.enqueueForceUpdate(stateNode);},500); setTimeout(() => {BDFDB.React.forceUpdate(stateNode);},500);
setTimeout(() => {delete this.updatingScroller;},1000); setTimeout(() => {delete this.updatingScroller;},1000);
} }
} }