Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3249310
D5950.id19730.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D5950.id19730.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
@@ -466,12 +466,7 @@
}
if (this.state.mode === 'siwe') {
- panel = (
- <SIWEPanel
- setActiveAlert={this.setActiveAlert}
- opacityValue={this.panelOpacityValue}
- />
- );
+ panel = <SIWEPanel />;
} else if (this.state.mode === 'log-in') {
panel = (
<LogInPanel
diff --git a/native/account/siwe-panel.react.js b/native/account/siwe-panel.react.js
--- a/native/account/siwe-panel.react.js
+++ b/native/account/siwe-panel.react.js
@@ -1,19 +1,12 @@
// @flow
import * as React from 'react';
-import Animated from 'react-native-reanimated';
import WebView from 'react-native-webview';
import { registerActionTypes, register } from 'lib/actions/user-actions';
-import type {
- RegisterInfo,
- LogInExtraInfo,
- RegisterResult,
- LogInStartingPayload,
-} from 'lib/types/account-types';
+import type { LogInStartingPayload } from 'lib/types/account-types';
import {
useServerCall,
useDispatchActionPromise,
- type DispatchActionPromise,
} from 'lib/utils/action-utils';
import { NavContext } from '../navigation/navigation-context';
@@ -24,25 +17,18 @@
const commSIWE = `${defaultLandingURLPrefix}/siwe`;
-type BaseProps = {
- +setActiveAlert: (activeAlert: boolean) => void,
- +opacityValue: Animated.Node,
-};
-type Props = {
- ...BaseProps,
- // Redux state
- +logInExtraInfo: () => LogInExtraInfo,
- // Redux dispatch functions
- +dispatchActionPromise: DispatchActionPromise,
- // async functions that hit server APIs
- +registerAction: (registerInfo: RegisterInfo) => Promise<RegisterResult>,
-};
+function SIWEPanel(): React.Node {
+ const navContext = React.useContext(NavContext);
+ const logInExtraInfo = useSelector(state =>
+ nativeLogInExtraInfoSelector({
+ redux: state,
+ navContext,
+ }),
+ );
+
+ const dispatchActionPromise = useDispatchActionPromise();
+ const registerAction = useServerCall(register);
-function SIWEPanel({
- logInExtraInfo,
- dispatchActionPromise,
- registerAction,
-}: Props) {
const handleSIWE = React.useCallback(
({ address, signature }) => {
// this is all mocked from register-panel
@@ -73,31 +59,9 @@
},
[handleSIWE],
);
+
const source = React.useMemo(() => ({ uri: commSIWE }), []);
return <WebView source={source} onMessage={handleMessage} />;
}
-const ConnectedSIWEPanel: React.ComponentType<BaseProps> = React.memo<BaseProps>(
- function ConnectedRegisterPanel(props: BaseProps) {
- const navContext = React.useContext(NavContext);
- const logInExtraInfo = useSelector(state =>
- nativeLogInExtraInfoSelector({
- redux: state,
- navContext,
- }),
- );
-
- const dispatchActionPromise = useDispatchActionPromise();
- const callRegister = useServerCall(register);
-
- return (
- <SIWEPanel
- {...props}
- logInExtraInfo={logInExtraInfo}
- dispatchActionPromise={dispatchActionPromise}
- registerAction={callRegister}
- />
- );
- },
-);
-export default ConnectedSIWEPanel;
+export default SIWEPanel;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 16, 1:29 PM (20 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2497986
Default Alt Text
D5950.id19730.diff (3 KB)
Attached To
Mode
D5950: [native] Simplify `SIWEPanel` component
Attached
Detach File
Event Timeline
Log In to Comment