
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
react-native-use-form
Advanced tools
Simple form library for React Native with great UX for developer and end-user
Simple form library for React Native with great UX for developer and end-user api and some code inspired by wsmd/react-native-use-form
See an (older) demo: https://twitter.com/RichardLindhout/status/1344009881863516165
yarn add react-native-use-form
or
npm install react-native-use-form
Ideally you do this somewhere in your index.js
before react-native-use-form
is used.
Currently we have en/nl/de/pl/pt/ar/ko/frf translations but it's really easy to add one extra since it are only some labels and error messages.
// e.g in your index.js
import {
en,
registerTranslation,
registerDefaultLocale
} from 'react-native-use-form'
registerTranslation('en', en)
// you can override the locale per form
registerDefaultLocale('en') // optional (default = en)
// registerTranslation('nl', nl)
Please send a PR with your language to make sure all locales are there next time
import {
registerTranslation,
} from 'react-native-use-form'
registerTranslation("en", {
required: (params) => `${params.label || params.fieldKey} is required`,
lengtShouldBeLongerThan: (params) =>
`${params.label || params.fieldKey} length should be longer than ${
params.requiredLength
}`,
lengthShouldBeShorterThan: (params) =>
`${params.label || params.fieldKey} length should be shorter than ${
params.requiredLength
}`,
shouldFollowRegex: (params) =>
params.errorMessage ||
`${params.label || params.fieldKey} is not in the right format`,
})
Also see /demo folder in this repository to see advanced usage!
import * as React from 'react';
import { View, ScrollView } from 'react-native';
import { useFormState, Form } from 'react-native-use-form';
import { Button, HelperText, TextInput } from 'react-native-paper';
export default function App() {
const scrollViewRef = useRef<ScrollView>(null);
const [
{ errors, submit, formProps, hasError },
{ email, telephone, password },
] = useFormState(
{
email: '',
telephone: '',
password: '',
},
{
scrollViewRef, // optional if you want to scroll to error on submit (long forms)
locale: 'en', // optional override
onChange: (latestValues) => {
// optional: do something with latestValues
},
onSubmit: (submittedValues) => {
// do something with submittedValues
},
}
);
return (
<ScrollView
ref={scrollViewRef}
style={{
flex: 1,
maxWidth: 500,
alignSelf: 'center',
}}
>
<Form {...formProps}>
<TextInputWithError
mode="outlined"
{...email('email', {
validate: (v) => {
return looksLikeMail(v) ? true : 'Email-address is invalid';
},
label: "E-mail"
})}
/>
<TextInputWithError
mode="outlined"
{...telephone('telephone', {
required: true,
minLength: 3,
maxLength: 10,
shouldFollowRegexes: [telephoneRegex],
label: "Telefoon"
})}
/>
<TextInputWithError
mode="outlined"
{...password('password', {
required: true,
minLength: 3,
maxLength: 10,
label: "Wachtwoord"
})}
/>
<Button mode="contained" onPress={submit}>
Save
</Button>
</Form>
</ScrollView>
);
}
function TextInputWithError({ errorMessage, ...rest }: React.ComponentProps<typeof TextInput> & { errorMessage?: string }) {
return (
<>
<TextInput {...rest} />
<HelperText type="error" visible={rest.error}>
{errorMessage || ' '}
</HelperText>
</>
);
}
const telephoneRegex = {
regex: new RegExp(/^\d+$/),
errorMessage: 'Telephone is invalid',
};
// you can add your own validate functions
function looksLikeMail(str: string): boolean {
let lastAtPos = str.lastIndexOf('@');
let lastDotPos = str.lastIndexOf('.');
return (
lastAtPos < lastDotPos &&
lastAtPos > 0 &&
str.indexOf('@@') === -1 &&
lastDotPos > 2 &&
str.length - lastDotPos > 2
);
}
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
FAQs
Simple form library for React Native with great UX for developer and end-user
The npm package react-native-use-form receives a total of 312 weekly downloads. As such, react-native-use-form popularity was classified as not popular.
We found that react-native-use-form demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.