This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react'; | |
import {Formik, Form} from 'formik'; | |
import {Container, Button, Input} from 'reactstrap'; | |
export default class App extends Component { | |
handleSubmit = (values) => { | |
let data = new FormData(); | |
data.append("photo1", values.photo1); | |
return fetch(baseUrl, { | |
method: "post", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Formik initialValues={{ diet: [] }}> | |
{(formProps) => ( | |
<Form> | |
<FieldArray name="diet"> | |
{(arrayHelpers) => { | |
return ( | |
<Form> | |
{/** whatever you need to do */} | |
</Form> | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const FormComponent = ({ | |
arrayHelpers | |
}) => ( | |
<Form> | |
{/** whatever you need to do */} | |
</Form> | |
); | |
<Formik initialValues={{ diet: [] }}> | |
{(formProps) => ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Formik initialValues={{ diet: [] }} | |
validationSchema={Yup.object().shape({ | |
diet: Yup.array() | |
.of( | |
Yup.object().shape({ | |
food_name: Yup.string().required("Required"), | |
quantity: Yup.string().required("Required"), | |
}) | |
) | |
.required("Required"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Form style={{ padding: 20 }}> | |
<FieldArray | |
name="diet" | |
render={(arrayHelpers) => ( | |
<div> | |
<Button | |
onClick={() => { | |
arrayHelpers.push({ | |
food_name: "", | |
quantity: "", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Formik initialValues={{ diet: [] }}> | |
{(formProps) => ( | |
<Form> | |
<FieldArray | |
name="diet" | |
render={(arrayHelpers) => ( | |
//FieldArray Form | |
)} | |
/> | |
</Form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react'; | |
import {RNCamera} from 'react-native-camera'; | |
import {View, TouchableOpacity, Text} from 'react-native'; | |
export class App extends Component { | |
takePicture = async () => { | |
if (this.camera) { | |
const options = { width: 500, quality: 0.5 }; | |
const data = await this.camera.takePictureAsync(options); | |
console.log(data.uri); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const options = { | |
title: 'Select Picture', | |
storageOptions: { | |
skipBackup: true, | |
path: 'images', | |
}, | |
maxWidth: 500, | |
maxHeight: 500, | |
quality: 0.5, | |
videoQuality: 'medium' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onCreate() { | |
super.onCreate(); | |
SoLoader.init(this, /* native exopackage */ false); | |
//initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); <-comment here | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); | |
NetworkingModule.setCustomClientBuilder( | |
new NetworkingModule.CustomClientBuilder() { | |
@Override | |
public void apply(OkHttpClient.Builder builder) { | |
// builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); comment here | |
} | |
}); | |
client.addPlugin(networkFlipperPlugin); | |
client.start(); |
NewerOlder