Skip to content

Instantly share code, notes, and snippets.

Trần Văn Luận luandevpro

  • Viet Nam
Block or report user

Report or block luandevpro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View settings.json
{
"editor.fontSize": 16.5,
"files.autoSave": "afterDelay",
"emmet.triggerExpansionOnTab": true,
"git.enableSmartCommit": true,
"emmet.showSuggestionsAsSnippets": true,
"editor.fontLigatures": true,
"editor.tabSize": 3,
"window.zoomLevel": 1,
"editor.insertSpaces": true,
View Terminal
sudo apt-get update
sudo apt-get -y upgrade
wget https://dl.google.com/go/go1.12.2.linux-amd64.tar.gz
sudo tar -xvf go1.12.2.linux-amd64.tar.gz
sudo mv go /usr/local
export GOROOT=/usr/local/go
export GOPATH=$HOME/Documents/Go/
View CustomCheckBox.js
import React from 'react';
import { View, Text } from 'react-native';
import { CheckBox } from 'react-native-elements';
import { ErrorMessage } from 'formik';
const _languages = ['vi', 'vn', 'en'];
export default function CustomCheckBox(props) {
const handleOnPress = (_language, checked) => {
if (!checked) {
View App.js
import validate from './src/components/validate';
export default function App() {
...
return (
<View>
<Formik
initialValues={{ ...value }}
onSubmit={handleSubmit}
validationSchema={validate}
View validate.js
import * as Yup from 'yup';
const validate = Yup.object().shape({
languages: Yup.array()
.required('Must have languages')
.min(2, 'Minimum of 2 languages'),
});
export default validate;
View Terminal
yarn add react-native-elements
yarn add react-native-vector-icons
react-native link react-native-vector-icons
View CustomCheckBox.js
import React from 'react';
import { View } from 'react-native';
import { CheckBox } from 'react-native-elements';
const _languages = ['vi', 'vn'];
export default function CustomCheckBox(props) {
const handleOnPress = (_language, checked) => {
if (!checked) {
props.arrayHelpers.push(_language);
View FormField.js
import React from 'react';
import { FieldArray } from 'formik';
import { View, Button } from 'react-native';
import CustomCheckBox from './CustomCheckBox';
export default props => (
<View>
<FieldArray name="languages">
{ arrayHelpers => <View><CustomCheckBox arrayHelpers={arrayHelpers} {...props} /></View> }
</FieldArray>
View App.js
import React, { useState } from 'react';
import { View } from 'react-native';
import { Formik } from 'formik';
import FormField from './src/components/FormField';
export default function App() {
const [value] = useState({
languages: [],
});
const handleSubmit = (values, { resetForm }) => {
View TextInput.js
import React from 'react';
import { View, TextInput as Input, Text } from 'react-native';
import { ErrorMessage } from 'formik';
export default function TextInput(props) {
console.log(props);
return (
<View>
<Input
onChangeText={props.form.handleChange(props.field.name)}
You can’t perform that action at this time.