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 parse-4-4-cc-example.js
Parse.Cloud.define("testFunction", async (request) => {
yolo
});
View skip-with-master-key.js
Parse.Cloud.beforeSave('History', req => {
// logic will only get called if req.master is false
},{
skipWithMasterKey:true
});
View cloud-code-validator-sample-4.js
Parse.Cloud.beforeSave(Parse.User, () => {
// any additional beforeSave logic here
}, {
fields: {
accType: {
default: 'viewer',
constant: true
},
},
});