Skip to content

Commit

Permalink
Merge pull request #29765 from software-mansion-labs/ts-migration/Sig…
Browse files Browse the repository at this point in the history
…nInPageForm

[TS migration] Migrate 'SignInPageForm' component to TypeScript
  • Loading branch information
AndrewGable authored Oct 27, 2023
2 parents 044eabe + b022e32 commit 1a45001
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
10 changes: 0 additions & 10 deletions src/components/SignInPageForm/index.native.js

This file was deleted.

12 changes: 12 additions & 0 deletions src/components/SignInPageForm/index.native.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import FormElement from '../FormElement';
import SignInPageFormProps from './types';

function SignInPageForm(props: SignInPageFormProps) {
// eslint-disable-next-line react/jsx-props-no-spreading
return <FormElement {...props} />;
}

SignInPageForm.displayName = 'SignInPageForm';

export default SignInPageForm;
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import React, {useEffect, useRef} from 'react';
import FormElement from '../FormElement';
import SignInPageFormProps from './types';

const preventFormDefault = (event) => {
const preventFormDefault = (event: SubmitEvent) => {
// When enter is pressed form is submitted to action url (POST /).
// As we are using controlled component, we need to disable it here.
event.preventDefault();
};

function Form(props) {
const form = useRef(null);
function SignInPageForm(props: SignInPageFormProps) {
const form = useRef<HTMLFormElement>(null);

useEffect(() => {
const formCurrent = form.current;
Expand Down Expand Up @@ -42,6 +43,6 @@ function Form(props) {
);
}

Form.displayName = 'Form';
SignInPageForm.displayName = 'SignInPageForm';

export default Form;
export default SignInPageForm;
5 changes: 5 additions & 0 deletions src/components/SignInPageForm/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {ViewProps} from 'react-native';

type SignInPageFormProps = ViewProps;

export default SignInPageFormProps;

0 comments on commit 1a45001

Please sign in to comment.