Skip to content

Instantly share code, notes, and snippets.

Avatar

Alysson Melo alyssoncm

View GitHub Profile
View ReactNativeTextInputSample.js
import React from 'react';
import * as Native from 'react-native';
import styled from 'styled-components'
import TextInputMask from 'react-native-text-input-mask'
const Layout = {
Container: styled.View`
align-items: center;
justify-content: center;
padding: 5%;
View text-input-controlled-input.js
import React, { useState } from 'react';
import { Text, TextInput, View } from 'react-native';
const Application = () => {
const [text, setText] = useState('');
function onChangeText(text) {
setText(text.replaceAll(/[0-9]/g,'X'))
}
return (
<View>
View secure-react-native-text-input.js
import React, { useState } from 'react';
import { Button, Text, TextInput, View } from 'react-native';
export default function Application() {
const [text, setText] = useState('');
const [enableSecure, setEnableSecure] = useState(true);
function toggleSecure() {
setEnableSecure(value => !value)
}
return (
View TextInput2.js
<TextInput
keyboardType="email-address"
onChangeText={setText}
defaultValue={text}
/>
View textInput1.js
import React, { useState } from 'react';
import { Text, TextInput, View } from 'react-native';
export default function Application() {
const [text, setText] = useState('');
return (
<View>
<TextInput
onChangeText={text => setText(text)}
defaultValue={text}
View form.js
const Form = [
{
slug: 'textinput1',
label: 'Simple Textual Input',
props: {
placeholder: 'Edit me!'
}
},
{
slug: 'mailaddress',
View live-query-sample.js
Parse.Cloud.afterLiveQueryEvent('DogObject', async (request) => {
if (request.event == "Create") {
// If I am creating a new Dog
const thisDog = request.object;
thisDog.set('name', 'Fido'); // Set its name to Fido
} else if (request.event == "update") {
// Else, if I am Updating an existing Dog
const thisDog = request.object;
thisDog.set('name', 'Rex'); // Set its name to Rex
} else {
View cloud-code-validator-sample-3.js
Parse.Cloud.define("DogsWithRegex", async (request) => {
// Returns all Dogs that are owned by a given name. The name must be at least 3 characters long to be valid.
const query = new Parse.Query("Dog");
query.equalTo("owner", request.params.owner); // We use the owner parameter to match
const results = await query.find();
return results;
},{
fields : {
owner : {
required: true,
View cloud-code-validator-sample-2.js
Parse.Cloud.define("DogsBetweenAges", async (request) => {
// Returns all Dogs that are between two given ages
const query = new Parse.Query("Dog");
query.greaterThanOrEqualTo("minimumAge", request.params.minimumAge); // Uses the minimumAge parameter
query.lessThanOrEqualTo("maximumAge", request.params.maximumAge); // Uses the maximumAge parameter
const results = await query.find();
return results
},{
fields : ['minimumAge', 'maximumAge'],
requireUser: true
View parse-4-4-cc-example.js
Parse.Cloud.define("testFunction", async (request) => {
yolo
});