Skip to content

Instantly share code, notes, and snippets.

View kaueDM's full-sized avatar

Kauê kaueDM

View GitHub Profile
{
"@eva-design/eva": "^2.0.0",
"@expo/react-native-action-sheet": "^3.8.0",
"@react-native-community/async-storage": "~1.12.0",
"@react-native-community/masked-view": "0.1.10",
"@react-native-community/slider": "3.0.3",
"@react-navigation/bottom-tabs": "^5.7.3",
"@react-navigation/drawer": "^5.11.5",
"@react-navigation/native": "^5.7.1",
"@react-navigation/stack": "^5.7.1",
@kaueDM
kaueDM / KeyboardAware.tsx
Created September 25, 2019 14:14
Handling keyboard position - React Native
import React, { useEffect } from 'react'
import { runTiming } from 'utils/animations'
import Animated from 'react-native-reanimated'
import {
Dimensions,
Keyboard,
UIManager,
TextInput,
Platform
} from 'react-native'
const TextInput = (props) => {
return (
<React.Fragment>
<Label>{props.label}</Label>
<Input {...props} />
</React.Fragment>
)
}
import * as Yup from 'yup'
import { cep } from 'utils/textMask'
import { TextInput } from 'components'
import { AddressService } from 'services'
import removeMask from 'utils/removeMask'
const _fillAddress = async (inputProps: Record<string, any>) => {
const { value: zipCode, setFieldValue } = inputProps
const response = await AddressService(removeMask(zipCode))
@kaueDM
kaueDM / getResource.ts
Last active August 14, 2019 12:57
drop user
return axios.request({ url, method, data, params, headers })
.catch((error) => {
console.table(throwError(error))
receivedError.status === 401 && dispatchAction(AuthActions.logout)
})
const api = (() => {
return {
login: login(getPublicResource)
}
})()
export default api
import idx from 'idx'
import CreateInterface from './interfaces/CreateInterface'
const create: CreateInterface = async (getPublicResource, register) => {
const method = 'POST'
const endpoint = '/auth/sign_in'
const data = register
const response = await getPublicResource({ method, endpoint, data })
import axios from 'axios'
import throwError from './throwError'
import { inbound, outbound } from './interceptors'
import { GetPublicResourceInterface } from './Interfaces'
const getPublicResource = async (props: GetPublicResourceInterface) => {
const { endpoint, method, data, params, headers } = props
const API_URL = 'https://some.url.here/v1'
const url = `${API_URL}${endpoint}`
import React from 'react'
import Spinner from '../Spinner'
import ButtonIcon from './ButtonIcon'
import ButtonLabel from './ButtonLabel'
import ButtonContainer from './ButtonContainer'
import ButtonInterface from './ButtonInterface'
import { TouchableWithoutFeedback } from 'react-native'
const Button: React.FC<ButtonInterface> = (props) => {
const {
//action
export const loginAsync = createAsyncAction(
'LOGIN_REQUEST',
'LOGIN_SUCCESS',
'LOGIN_FAILURE'
)<undefined, Auth, string>()
//reducer
const loginReducer = createReducer(initialState as Auth)