<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Marcos Taylor</title>
    <description>The latest articles on DEV Community by Marcos Taylor (@devmarcos24).</description>
    <link>https://dev.to/devmarcos24</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F860474%2F0cf26611-251e-4294-947c-963d85be0076.jpeg</url>
      <title>DEV Community: Marcos Taylor</title>
      <link>https://dev.to/devmarcos24</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/devmarcos24"/>
    <language>en</language>
    <item>
      <title>Prisma-ORM e NodeJS</title>
      <dc:creator>Marcos Taylor</dc:creator>
      <pubDate>Wed, 06 Jul 2022 00:40:08 +0000</pubDate>
      <link>https://dev.to/devmarcos24/prisma-orm-481a</link>
      <guid>https://dev.to/devmarcos24/prisma-orm-481a</guid>
      <description>&lt;p&gt;&lt;strong&gt;Iniciando com Prisma ORM&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Introdução&lt;/strong&gt;&lt;br&gt;
Este é um documento para iniciantes conseguirem fazer a utilização de do ORM Prisma no dia a dia. Este documento terá um código simples que também estará disponível no github.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Início&lt;/strong&gt;&lt;br&gt;
Para iniciar com o prisma ORM é bem simple primeiro vamos colocar um &lt;strong&gt;yarn add prisma ou npm install prisma &amp;amp;&amp;amp; yarn add @prisma/client ou npm install @prisma/client&lt;/strong&gt; e depois só utilizar a linha de comando &lt;strong&gt;npx  prisma init&lt;/strong&gt; . esse comando irá criar alguns arquivos no seu projeto, sendo eles uma pasta chamada prisma (aqui irá ficar as migrations e o arquivos chamando schema.prisma)&lt;br&gt;
No arquivo de schema que foi criado vamos iniciar os nossos schemas das tabelas do banco. Ex.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;model Authors {
  id    String  @id @default(uuid())
  name  String  @db.Text
  email String  @db.Text
  books Books[]

  created_at DateTime @default(now())
  updated_at DateTime @default(now())

  @@map("authors")
}

model Books {
  id          String  @id @default(uuid())
  title       String  @db.Text
  description String? @db.Text

  created_at DateTime @default(now())
  updated_at DateTime @default(now())

  Authors   Authors @relation(fields: [author_id], references: [id])
  author_id String
  @@map("books")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;O Relacionamento acima é feito de One to Many (um para muitos) ou seja 1 autor pode ter vários livros. Abaixo estarei mostrando como fazer a inserção de um autor criando 1 livro.&lt;br&gt;
A parte de que coloquei no model de Author o books do Tipo Books[] significa que o author terá varios livro e abaixo coloquei @@map(“authors”) que será como nossa tabela sera chamada no banco de dados&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inserindo dados dados no banco&lt;/strong&gt;&lt;br&gt;
    é muito fácil inserir só instanciar o PrismaCliente usando o new PrismaClient() usar o create como no exemplo a baixo&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    async create(data: IData) {
        return await prisma.authors.create({ data })
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;outro comando é o de find:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;async findById(id: string) {
        return await prisma.authors.findFirst({
            where: {
                id
            }
        })
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;aqui outros comando dos prisma na documentação &lt;a href="https://www.prisma.io/docs/concepts/components/prisma-client/crud"&gt;click aqui pra ver o crud&lt;/a&gt;&lt;br&gt;
inserindo uma example de projeto com node e prisma: &lt;a href="https://github.com/devMarcos24/prisma_nodejs"&gt;Prisma e Nodejs&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Animation with react-native-reanimated</title>
      <dc:creator>Marcos Taylor</dc:creator>
      <pubDate>Tue, 10 May 2022 15:05:42 +0000</pubDate>
      <link>https://dev.to/devmarcos24/animation-with-react-native-reanimated-1ddc</link>
      <guid>https://dev.to/devmarcos24/animation-with-react-native-reanimated-1ddc</guid>
      <description>&lt;center&gt;
&lt;br&gt;
Documentation - Animation (Beginner)&lt;br&gt;
React Native - CLI&lt;br&gt;
&lt;/center&gt;
&lt;br&gt;
&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
  This is a document for beginners to be able to use simple animations in everyday life. This document will have a simple code that will also be available on github.

&lt;p&gt;&lt;strong&gt;Installation&lt;/strong&gt;&lt;br&gt;
To install the animation package is simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add react-native-reanimated
or
npm install react-native-reanimated
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use this command in your terminal.&lt;/p&gt;

&lt;p&gt;Right after the installation it is necessary to install via cocoapods using the pods install command inside the /ios folder. After installation it is necessary to insert the plugin in the babel.config.js file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = {
…
plugins: [
…
         'react-native-reanimated/plugin',
     ],  
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;possible error&lt;/strong&gt;&lt;br&gt;
   When it was used, an error was installed when I was revived stating that the previous step occurred that being done, even if it is done, a cache error can occur, it is resolved &lt;code&gt;yarn start --reset-cache&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The code that was used to open the menu using Reanimated&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import {StyleSheet} from 'react-native';
import Animated, {
 interpolate,
 runOnJS,
 useAnimatedStyle,
 useSharedValue,
 withSpring,
 withTiming,
} from 'react-native-reanimated';
import {
 Container,
 Content,
 Blackout,
 TopClose,
 CloseItem,
 Image,
} from './styles';

export const ModalSettings: React.FC&amp;lt;any&amp;gt; = ({setOpenModalFunction}) =&amp;gt; {
 const offset = useSharedValue(900);

 const animatedStyles = useAnimatedStyle(() =&amp;gt; ({
   transform: [{translateY: offset.value}],
   opacity: interpolate(offset.value, [0, -280], [1, 0.5]),
 }));

 offset.value = withSpring(20);

 const animatedAndClose = () =&amp;gt; {
   offset.value = withTiming(
     1200,
     {
       duration: 800,
     },
     () =&amp;gt; {
       'worklet';

       runOnJS(setOpenModalFunction)();
     },
   );
 };

 return (
   &amp;lt;Blackout&amp;gt;
     &amp;lt;Container&amp;gt;
       &amp;lt;Animated.View style={[animatedStyles, styles.animated]}&amp;gt;
         &amp;lt;Content&amp;gt;
           &amp;lt;TopClose onPress={animatedAndClose}&amp;gt;
             &amp;lt;CloseItem /&amp;gt;
           &amp;lt;/TopClose&amp;gt;
           &amp;lt;Image
             source={{
               uri: 'https://cdn.dribbble.com/users/745861/screenshots/7889509/media/5891d9d48179ca0b3a8fcdf178db8737.png',
             }}
           /&amp;gt;
         &amp;lt;/Content&amp;gt;
       &amp;lt;/Animated.View&amp;gt;
     &amp;lt;/Container&amp;gt;
   &amp;lt;/Blackout&amp;gt;
 );
};

const styles = StyleSheet.create({
 animated: {
   flex: 1,
 },
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is the github link with the complete application:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RBV3mdax--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/os3vvlnrdi1nd69nmhr2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RBV3mdax--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/os3vvlnrdi1nd69nmhr2.png" alt="Image description" width="880" height="1904"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;center&gt;&lt;a href="https://github.com/devMarcos24/react-native-reanimated_estudo"&gt;Open here github&lt;/a&gt;&lt;/center&gt;

</description>
      <category>javascript</category>
      <category>typescript</category>
      <category>react</category>
      <category>reactnative</category>
    </item>
    <item>
      <title>Animação com react-native-reanimated</title>
      <dc:creator>Marcos Taylor</dc:creator>
      <pubDate>Tue, 10 May 2022 14:45:56 +0000</pubDate>
      <link>https://dev.to/devmarcos24/animation-with-react-native-reanimated-49m6</link>
      <guid>https://dev.to/devmarcos24/animation-with-react-native-reanimated-49m6</guid>
      <description>&lt;center&gt;
&lt;br&gt;
Documentação - Animação (Iniciante)&lt;br&gt;
React Native - CLI&lt;br&gt;
&lt;/center&gt;

&lt;p&gt;&lt;strong&gt;Introdução&lt;/strong&gt;&lt;br&gt;
    Este é um documento para iniciantes conseguirem fazer a utilização de animações simples no dia a dia. Este documento terá um código simples que também estará disponível no github.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Instalação&lt;/strong&gt;&lt;br&gt;
    Para fazer a instalação do pacote de animação é simples:&lt;br&gt;
yarn add react-native-reanimated&lt;br&gt;
ou&lt;br&gt;
npm install react-native-reanimated&lt;br&gt;
    Utilize esse comando no seu terminal.&lt;/p&gt;

&lt;p&gt;Logo após a instalação é necessário instalar via cocoapods utilizando comando pods install dentro da pasta /ios.  Após a instalação é necessário inserir o plugin no arquivo babel.config.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = {
…
plugins: [
…
         'react-native-reanimated/plugin',
     ],  
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Possível error&lt;/strong&gt;&lt;br&gt;
    Quando estava instalando ocorreu um erro quando fui utilizar o reanimated informando que o passo anterior tem que ser feito, mesmo sendo feito pode ocorre um erro de cache, é simples resolver yarn start --reset-cache&lt;/p&gt;

&lt;p&gt;O código que foi utilizado para abertura do menu utilizando o Reanimated&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import {StyleSheet} from 'react-native';
import Animated, {
 interpolate,
 runOnJS,
 useAnimatedStyle,
 useSharedValue,
 withSpring,
 withTiming,
} from 'react-native-reanimated';
import {
 Container,
 Content,
 Blackout,
 TopClose,
 CloseItem,
 Image,
} from './styles';

export const ModalSettings: React.FC&amp;lt;any&amp;gt; = ({setOpenModalFunction}) =&amp;gt; {
 const offset = useSharedValue(900);

 const animatedStyles = useAnimatedStyle(() =&amp;gt; ({
   transform: [{translateY: offset.value}],
   opacity: interpolate(offset.value, [0, -280], [1, 0.5]),
 }));

 offset.value = withSpring(20);

 const animatedAndClose = () =&amp;gt; {
   offset.value = withTiming(
     1200,
     {
       duration: 800,
     },
     () =&amp;gt; {
       'worklet';

       runOnJS(setOpenModalFunction)();
     },
   );
 };

 return (
   &amp;lt;Blackout&amp;gt;
     &amp;lt;Container&amp;gt;
       &amp;lt;Animated.View style={[animatedStyles, styles.animated]}&amp;gt;
         &amp;lt;Content&amp;gt;
           &amp;lt;TopClose onPress={animatedAndClose}&amp;gt;
             &amp;lt;CloseItem /&amp;gt;
           &amp;lt;/TopClose&amp;gt;
           &amp;lt;Image
             source={{
               uri: 'https://cdn.dribbble.com/users/745861/screenshots/7889509/media/5891d9d48179ca0b3a8fcdf178db8737.png',
             }}
           /&amp;gt;
         &amp;lt;/Content&amp;gt;
       &amp;lt;/Animated.View&amp;gt;
     &amp;lt;/Container&amp;gt;
   &amp;lt;/Blackout&amp;gt;
 );
};

const styles = StyleSheet.create({
 animated: {
   flex: 1,
 },
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Segue o link do github com o aplicação completa:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LfYBS0C7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t1okvmlnxu7dpni411as.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LfYBS0C7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t1okvmlnxu7dpni411as.png" alt="Image description" width="880" height="1904"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/devMarcos24/react-native-reanimated_estudo"&gt;Abrir aplicação no github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>reactnative</category>
      <category>webdev</category>
      <category>reanimated</category>
    </item>
  </channel>
</rss>
