Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3354635
D12182.id40694.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D12182.id40694.diff
View Options
diff --git a/native/account/logged-out-modal.react.js b/native/account/logged-out-modal.react.js
--- a/native/account/logged-out-modal.react.js
+++ b/native/account/logged-out-modal.react.js
@@ -232,6 +232,7 @@
+legacyRegisterStateContainer: StateContainer<LegacyRegisterState>,
+mode: Mode,
+setMode: (Partial<Mode>) => void,
+ +nextModeRef: { current: LoggedOutMode },
// Navigation state
+isForeground: boolean,
// Redux state
@@ -249,7 +250,6 @@
keyboardShowListener: ?EventSubscription;
keyboardHideListener: ?EventSubscription;
- nextMode: LoggedOutMode = 'loading';
activeAlert = false;
contentHeight: Value;
@@ -263,10 +263,8 @@
constructor(props: Props) {
super(props);
- this.nextMode = props.mode.curMode;
-
this.contentHeight = new Value(props.dimensions.safeAreaHeight);
- this.modeValue = new Value(modeNumbers[this.nextMode]);
+ this.modeValue = new Value(modeNumbers[this.props.mode.curMode]);
this.buttonOpacity = new Value(props.persistedStateLoaded ? 1 : 0);
this.panelPaddingTopValue = this.panelPaddingTop();
@@ -274,13 +272,13 @@
}
setMode(newMode: LoggedOutMode) {
- this.nextMode = newMode;
+ this.props.nextModeRef.current = newMode;
this.props.setMode({ curMode: newMode, nextMode: newMode });
this.modeValue.setValue(modeNumbers[newMode]);
}
proceedToNextMode = () => {
- this.props.setMode({ curMode: this.nextMode });
+ this.props.setMode({ curMode: this.props.nextModeRef.current });
};
componentDidMount() {
@@ -379,7 +377,7 @@
}
hardwareBack: () => boolean = () => {
- if (this.nextMode !== 'prompt') {
+ if (this.props.nextModeRef.current !== 'prompt') {
this.goBackToPrompt();
return true;
}
@@ -407,7 +405,9 @@
const panelPaddingTop = new Value(-1);
const targetPanelPaddingTop = new Value(-1);
- const prevModeValue = new Value(modeNumbers[this.nextMode]);
+ const prevModeValue = new Value(
+ modeNumbers[this.props.nextModeRef.current],
+ );
const clock = new Clock();
const keyboardTimeoutClock = new Clock();
return block([
@@ -516,7 +516,7 @@
};
goBackToPrompt = () => {
- this.nextMode = 'prompt';
+ this.props.nextModeRef.current = 'prompt';
this.props.setMode({ nextMode: 'prompt' });
this.keyboardHeightValue.setValue(0);
this.modeValue.setValue(modeNumbers['prompt']);
@@ -816,6 +816,8 @@
}));
}, []);
+ const nextModeRef = React.useRef<LoggedOutMode>(initialMode);
+
const navContext = React.useContext(NavContext);
const isForeground = isForegroundSelector(navContext);
@@ -836,6 +838,7 @@
legacyRegisterStateContainer={legacyRegisterStateContainer}
mode={mode}
setMode={setMode}
+ nextModeRef={nextModeRef}
isForeground={isForeground}
persistedStateLoaded={persistedStateLoaded}
rehydrateConcluded={rehydrateConcluded}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 1:04 PM (21 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2575134
Default Alt Text
D12182.id40694.diff (2 KB)
Attached To
Mode
D12182: [native] Move nextMode ref in LoggedOutModal to function component
Attached
Detach File
Event Timeline
Log In to Comment