├── LICENSE
├── P01 - Janta
├── code
│ ├── App.js
│ └── app.json
└── images
│ └── icon.png
├── P02 - Nome
├── code
│ ├── App.js
│ └── app.json
└── images
│ └── icon.png
├── P03 - AdivinhaNome
├── code
│ ├── App.js
│ └── app.json
└── images
│ └── icon.png
├── P04 - ContadorAgua
├── code
│ ├── App.js
│ └── app.json
└── images
│ ├── icon.png
│ └── waterbg.png
├── P05 - BiscoitoDaSorte
├── code
│ ├── App.js
│ └── app.json
└── images
│ ├── cookie.png
│ └── icon.png
├── P06 - Timer
├── code
│ ├── App.js
│ └── app.json
└── images
│ ├── icon.png
│ └── relogio.png
├── P07 - Calculadora
├── code
│ ├── App.js
│ └── app.json
└── images
│ └── icon.png
├── P08 - ScrollView
└── App.js
├── P09 - FlatList
└── App.js
├── P10 - SectionList
└── App.js
├── P11 - Picker (Autopeças José)
└── App.js
├── P12 - Switch
└── App.js
├── P13 - Slider
└── App.js
├── P14 - Modal
└── App.js
├── P15 - StatusBar
└── App.js
├── P16 - AsyncStorage
└── App.js
├── P17 - Navigation (React Navigation 3.0)
├── App.js
└── src
│ ├── Home.js
│ ├── Tela1.js
│ └── Tela2.js
├── P18 - Params
├── App.js
└── src
│ ├── Home.js
│ ├── Tela1.js
│ └── Tela2.js
├── P19 - Lista de Conversas
├── App.js
└── src
│ └── ListItem.js
├── P20 - Chat
├── assets
│ └── bcg.jpg
└── code
│ ├── App.js
│ └── src
│ └── MsgItem.js
├── P21 - Tela de dados pessoais e financeiros
├── apk
│ └── dados_1.apk
├── assets
│ ├── bg.jpg
│ ├── icon.png
│ └── splash.png
└── code
│ ├── App.js
│ └── app.json
├── P22 - Lista de tarefas
├── code
│ ├── App.js
│ ├── app.json
│ └── src
│ │ └── Item.js
└── database.url
├── README.md
└── READMEfiles
└── topImage.png
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Danilo J. L. de Oliveira
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/P01 - Janta/code/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, Text, Image, StyleSheet } from 'react-native';
3 |
4 | class Janta extends Component {
5 |
6 | constructor(props) {
7 |
8 | super(props);
9 | this.state = { comida: props.comida };
10 | let comidas = ['Pizza', 'X-tudo', 'Banana', 'Miojo', 'Misto'];
11 |
12 | setInterval(() => {
13 | this.setState(previousState => {
14 | let n = Math.floor(Math.random() * comidas.length);
15 | return { comida: comidas[n] };
16 | });
17 | }, 1000);
18 |
19 | }
20 |
21 | render() {
22 | return (
23 |
24 | Hoje você vai jantar:
25 | {this.state.comida}
26 |
27 | );
28 | }
29 | }
30 |
31 | const styles = StyleSheet.create({
32 | blueCenterBig: {
33 | paddingTop: 0,
34 | color: 'blue',
35 | fontWeight: 'bold',
36 | fontSize: 25,
37 | textAlign: 'center',
38 | },
39 | aboveBlue: {
40 | color: 'black',
41 | fontWeight: 'bold',
42 | fontSize: 25,
43 | textAlign: 'center',
44 | },
45 | });
46 |
47 | export default class PrimeiroProjeto extends Component {
48 |
49 | render() {
50 |
51 | return (
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | );
62 |
63 | }
64 |
65 | }
--------------------------------------------------------------------------------
/P01 - Janta/code/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "expo": {
3 | "name": "Janta",
4 | "slug": "janta",
5 | "privacy": "public",
6 | "sdkVersion": "32.0.0",
7 | "android":{
8 | "package":"com.DaniloJs.janta"
9 | },
10 | "platforms": [
11 | "ios",
12 | "android"
13 | ],
14 | "version": "1.0.0",
15 | "orientation": "portrait",
16 | "icon": "./assets/images/icon.png",
17 | "updates": {
18 | "fallbackToCacheTimeout": 0
19 | },
20 | "assetBundlePatterns": [
21 | "**/*"
22 | ],
23 | "ios": {
24 | "supportsTablet": true
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/P01 - Janta/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Danilo-Js/React-Native-My-First-Projects/8820f1f4ec478ba66f6b8449d440b1925b0f8694/P01 - Janta/images/icon.png
--------------------------------------------------------------------------------
/P02 - Nome/code/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, Text, Image, StyleSheet, TextInput } from 'react-native';
3 |
4 | export default class SegundoProjeto extends Component {
5 |
6 | constructor(props) {
7 | super(props);
8 | this.state = { texto: '' };
9 |
10 | this.mudarTexto = this.mudarTexto.bind(this);
11 |
12 | }
13 |
14 | mudarTexto(t) {
15 | let s = this.state;
16 | if (t.length > 0) {
17 | s.texto = 'Olá, ' + t;
18 | } else {
19 | s.texto = '';
20 | }
21 | this.setState(s);
22 | }
23 |
24 | render() {
25 |
26 | return (
27 |
28 |
29 |
30 |
31 |
32 | {this.state.texto}
33 |
34 |
35 |
36 | );
37 |
38 | }
39 |
40 | }
41 |
42 | const styles = StyleSheet.create({
43 | input: {
44 | color: 'white',
45 | height: 40,
46 | borderWidth: 1,
47 | borderColor: 'white',
48 | margin: 10,
49 | padding: 10,
50 | },
51 | texto: {
52 | fontSize: 20,
53 | color: 'white',
54 | textAlign: 'center'
55 | }
56 | });
--------------------------------------------------------------------------------
/P02 - Nome/code/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "expo": {
3 | "name": "Nome",
4 | "slug": "nome",
5 | "privacy": "public",
6 | "sdkVersion": "32.0.0",
7 | "android":{
8 | "package":"com.DaniloJs.nome"
9 | },
10 | "platforms": [
11 | "ios",
12 | "android"
13 | ],
14 | "version": "1.0.0",
15 | "orientation": "portrait",
16 | "icon": "./assets/images/icon.png",
17 | "updates": {
18 | "fallbackToCacheTimeout": 0
19 | },
20 | "assetBundlePatterns": [
21 | "**/*"
22 | ],
23 | "ios": {
24 | "supportsTablet": true
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/P02 - Nome/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Danilo-Js/React-Native-My-First-Projects/8820f1f4ec478ba66f6b8449d440b1925b0f8694/P02 - Nome/images/icon.png
--------------------------------------------------------------------------------
/P03 - AdivinhaNome/code/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { Platform, StyleSheet, Text, View, Button, Alert, TextInput } from 'react-native';
3 |
4 | export default class TerceiroProjeto extends Component {
5 | constructor(props) {
6 | super(props);
7 | this.state = { inputTexto: '', inputTexto2: '', texto: '', texto2: '' };
8 |
9 | this.apertouBotao = this.apertouBotao.bind(this);
10 | this.apertouBotao2 = this.apertouBotao2.bind(this);
11 | }
12 |
13 | apertouBotao() {
14 | let s = this.state;
15 | s.texto = "Olá, " + s.inputTexto;
16 | this.setState(s);
17 | }
18 |
19 | apertouBotao2() {
20 | let ss = this.state;
21 | if (ss.inputTexto2 == '') {
22 | // code...
23 | } else {
24 | if (ss.inputTexto2 == ss.inputTexto) {
25 | ss.texto2 = "Você acertou!";
26 | } else {
27 | ss.texto2 = "Você errou!";
28 | }
29 | }
30 | this.setState(ss);
31 | }
32 |
33 | render() {
34 | return (
35 |
36 |
37 |
38 |
39 | this.setState({ inputTexto })} />
40 |
41 |
42 |
43 | {this.state.texto}
44 |
45 |
46 |
47 |
48 |
49 | this.setState({ inputTexto2 })} />
50 |
51 |
52 |
53 | {this.state.texto2}
54 |
55 |
56 |
57 |
58 | );
59 | }
60 | }
61 |
62 | const styles = StyleSheet.create({
63 | input: {
64 | color: 'white',
65 | height: 40,
66 | borderWidth: 1,
67 | borderColor: 'white',
68 | margin: 10,
69 | padding: 10,
70 | },
71 | texto: {
72 | color: 'white',
73 | fontSize: 20,
74 | textAlign: 'center'
75 | }
76 | });
--------------------------------------------------------------------------------
/P03 - AdivinhaNome/code/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "expo": {
3 | "name": "Adivinha nome",
4 | "slug": "adivinhanome",
5 | "privacy": "public",
6 | "sdkVersion": "32.0.0",
7 | "android":{
8 | "package":"com.DaniloJs.adivinhanome"
9 | },
10 | "platforms": [
11 | "ios",
12 | "android"
13 | ],
14 | "version": "1.0.0",
15 | "orientation": "portrait",
16 | "icon": "./assets/images/icon.png",
17 | "updates": {
18 | "fallbackToCacheTimeout": 0
19 | },
20 | "assetBundlePatterns": [
21 | "**/*"
22 | ],
23 | "ios": {
24 | "supportsTablet": true
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/P03 - AdivinhaNome/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Danilo-Js/React-Native-My-First-Projects/8820f1f4ec478ba66f6b8449d440b1925b0f8694/P03 - AdivinhaNome/images/icon.png
--------------------------------------------------------------------------------
/P04 - ContadorAgua/code/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { Button, ImageBackground, StyleSheet, Text, View } from 'react-native';
3 |
4 | export default class QuintoProjeto extends Component {
5 | constructor(props){
6 | super(props);
7 | this.state = {consumido:0, status:'Ruim', pct:0}
8 |
9 | this.addCopo = this.addCopo.bind(this);
10 | this.atualizar = this.atualizar.bind(this);
11 | }
12 |
13 | atualizar(){
14 | let s = this.state;
15 | s.pct = Math.floor((s.consumido/2000)*100);
16 |
17 | if(s.pct >= 100){
18 | s.status = "Bom";
19 | }else{
20 | s.status = "Ruim";
21 | }
22 | this.setState(s);
23 | }
24 |
25 | addCopo(){
26 | let s = this.state;
27 | s.consumido += 200;
28 | this.setState(s);
29 | this.atualizar();
30 | }
31 |
32 | render() {
33 | return (
34 |
35 |
36 |
37 |
38 |
39 | META
40 | 2000ml
41 |
42 |
43 |
44 | CONSUMIDO
45 | {this.state.consumido}ml
46 |
47 |
48 |
49 | STATUS
50 | {this.state.status}
51 |
52 |
53 |
54 |
55 | {this.state.pct}%
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | );
66 | }
67 | }
68 |
69 | const styles = StyleSheet.create({
70 | body: {
71 | flex: 1,
72 | paddingTop: 20
73 | },
74 | bgimage: {
75 | flex: 1,
76 | width: null
77 | },
78 | infoArea: {
79 | flex: 1,
80 | flexDirection: 'row',
81 | marginTop: 50
82 | },
83 | area: {
84 | flex: 1,
85 | alignItems: 'center'
86 | },
87 | areaTitulo: {
88 | color: '#45b2fc'
89 | },
90 | areaDado: {
91 | color: '#2b4274',
92 | fontSize: 15,
93 | fontWeight: 'bold'
94 | },
95 | pctArea: {
96 | marginTop: 200,
97 | alignItems: 'center'
98 | },
99 | pctText: {
100 | fontSize: 70,
101 | color: '#FFFFFF',
102 | backgroundColor: 'transparent'
103 | },
104 | btnArea: {
105 | marginTop: 60,
106 | alignItems: 'center',
107 | },
108 | btn:{
109 | color: '#45b2fc',
110 | width: 100000,
111 | height: 100000
112 | }
113 | });
--------------------------------------------------------------------------------
/P04 - ContadorAgua/code/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "expo": {
3 | "name": "Contador de água",
4 | "slug": "contadordeagua",
5 | "privacy": "public",
6 | "sdkVersion": "32.0.0",
7 | "android":{
8 | "package":"com.DaniloJs.contadordeagua"
9 | },
10 | "platforms": [
11 | "ios",
12 | "android"
13 | ],
14 | "version": "1.0.0",
15 | "orientation": "portrait",
16 | "icon": "./assets/images/icon.png",
17 | "updates": {
18 | "fallbackToCacheTimeout": 0
19 | },
20 | "assetBundlePatterns": [
21 | "**/*"
22 | ],
23 | "ios": {
24 | "supportsTablet": true
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/P04 - ContadorAgua/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Danilo-Js/React-Native-My-First-Projects/8820f1f4ec478ba66f6b8449d440b1925b0f8694/P04 - ContadorAgua/images/icon.png
--------------------------------------------------------------------------------
/P04 - ContadorAgua/images/waterbg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Danilo-Js/React-Native-My-First-Projects/8820f1f4ec478ba66f6b8449d440b1925b0f8694/P04 - ContadorAgua/images/waterbg.png
--------------------------------------------------------------------------------
/P05 - BiscoitoDaSorte/code/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { TouchableOpacity, Button, StyleSheet, Text, View, Image } from 'react-native';
3 |
4 | class Botao extends Component {
5 | constructor(props) {
6 | super(props);
7 | this.state = {};
8 | this.styles = StyleSheet.create({
9 | botao: {
10 | width: 250,
11 | height: 50,
12 | borderWidth: 2,
13 | borderColor: props.color,
14 | backgroundColor: 'transparent',
15 | borderRadius: 25
16 | },
17 | botaoArea: {
18 | flex: 1,
19 | flexDirection: 'row',
20 | justifyContent: 'center',
21 | alignItems: 'center'
22 | },
23 | botaoText: {
24 | color: props.color,
25 | fontSize: 14,
26 | fontWeight: 'bold'
27 | }
28 | });
29 | }
30 |
31 | render() {
32 | return (
33 |
34 |
35 | {this.props.text}
36 |
37 |
38 | );
39 | }
40 | }
41 |
42 | export default class SextoProjeto extends Component {
43 | constructor(props) {
44 | super(props);
45 | this.state = { texto: 'Frase do dia' }
46 | this.frases = ['A vida trará coisas boas se tiveres paciência.',
47 | 'Demonstre amor e alegria em todas as oportunidades e verás que a paz nasce dentro de você.',
48 | 'Não compense na ira o que lhe falta na razão.',
49 | 'Defeitos e virtudes são apenas dois lados da mesma moeda.',
50 | 'A maior de todas as torres começa no solo.',
51 | 'Não há que ser forte. Há que ser flexível.',
52 | 'Gente todo dia arruma os cabelos, por que não o coração?',
53 | 'Há três coisas que jamais voltam; a flecha lançada, a palavra dita e a oportunidade perdida.',
54 | 'A juventude não é uma época da vida, é um estado de espírito.',
55 | 'Podemos escolher o que semear, mas somos obrigados a colher o que plantamos.',
56 | 'Dê toda a atenção para a formação dos teus filhos, sobretudo por exemplos de tua própria vida.',
57 | 'Siga os bons e aprenda com eles.', 'Não importa o tamanho da montanha, ela não pode tapar o sol.',
58 | 'O bom-senso vai mais longe do que muito conhecimento.',
59 | 'Quem quer colher rosas deve suportar os espinhos.',
60 | 'São os nossos amigos que nos ensinam as mais valiosas lições.',
61 | 'Uma iniciativa mal-sucedida não significa o final de tudo. Sempre existe uma nova oportunidade.',
62 | 'Aquele que se importa com o sentimento dos outros, não é um tolo.',
63 | 'A adversidade é um espelho que reflete o verdadeiro eu.',
64 | 'Lamentar aquilo que não temos é desperdiçar aquilo que já possuímos.',
65 | 'Uma bela flor é incompleta sem suas folhas.',
66 | 'Sem o fogo do entusiasmo, não há o calor da vitória.',
67 | 'Não há melhor negócio que a vida. A gente há obtém a troco de nada.',
68 | 'O riso é a menor distância entre duas pessoas.',
69 | 'Você é jovem apenas uma vez. Depois precisa inventar outra desculpa.',
70 | 'É mais fácil conseguir o perdão do que a permissão.',
71 | 'Os defeitos são mais fortes quando o amor é fraco.',
72 | 'Amizade e Amor são coisas que podem virar uma só num piscar de olhos.',
73 | 'Surpreender e ser surpreendido é o segredo do amor.',
74 | 'Faça pequenas coisas agora e maiores coisas lhe serão confiadas cada dia.',
75 | 'Todo mundo é capaz de denominar uma dor, exceto quem a sente.',
76 | 'A paciência na adversidade é o sinal de um coração sensível.',
77 | 'A sorte favorece a mente bem preparada.',
78 | 'Sua visão se tornará clara apenas quando você puder olhar dentro de seu coração.',
79 | 'Quem olha para fora sonha; quem olha para dentro acorda.',
80 | 'As pessoas se esquecerão do que você disse e do que você fez… mas nunca se esquecerão de como você as fez sentir.',
81 | 'Espere pelo mais sábio dos conselhos: o tempo.',
82 | 'Todas as coisas são difíceis antes de se tornarem fáceis.',
83 | 'Você pode encontrar a si mesmo fazendo ou dizendo coisas que você nunca imaginou possíveis.',
84 | 'Se você se sente só é porque construiu muros ao invés de pontes.',
85 | 'Vencer é 90 por cento suor e 40 por cento técnica.',
86 | 'O amor está mais próximo do que você imagina.',
87 | 'A vida coloca em nossa frente opções.',
88 | 'Você é do tamanho do seu sonho.',
89 | 'Pare de procurar eternamente, a felicidade está bem ao seu lado.',
90 | 'Conhecimento é a única virtude e ignorância é o único vício.',
91 | 'O nosso primeiro e último amor é… o amor-próprio.',
92 | 'Deixe de lado as preocupações e seja feliz.',
93 | 'A vontade das pessoas é a melhor das leis.',
94 | 'Nós somos o que pensamos.',
95 | 'A maior barreira para o sucesso é o medo do fracasso.',
96 | 'O pessimista vê a dificuldade em cada oportunidade, O otimista vê a oportunidade em cada dificuldade.',
97 | 'Muitas das grandes realizações do mundo foram feitas por homens cansados e desanimados que continuaram trabalhando.',
98 | 'O insucesso é apenas uma oportunidade para recomeçar de novo com mais inteligência.',
99 | 'O futuro pertence àqueles que acreditam na beleza de seus sonhos.',
100 | 'Coragem é a resistência ao medo, domínio do medo, e não a ausência do medo.',
101 | 'O verdadeiro homem mede a sua força, quando se defronta com o obstáculo.',
102 | 'Você precisa fazer aquilo que pensa que não é capaz de fazer.',
103 | 'Quem quer vencer um obstáculo deve armar-se da força do leão e da prudência da serpente.',
104 | 'A adversidade desperta em nós capacidades que, em circunstâncias favoráveis, teriam ficado adormecidas.',
105 | 'A vida é para quem topa qualquer parada. Não para quem pára em qualquer topada.',
106 | 'Motivação não é sinônimo de transformação, mas um passo em sua direção.',
107 | 'O que empobrece o ser humano, não é a falta de dinheiro, mais sim, a falta de fé,motivação e criatividade.',
108 | 'Inspiração vem dos outros. Motivação vem de dentro de nós.',
109 | 'Não acredite mais em pessoas especiais, mas em momentos especiais com pessoas habituais.',
110 | 'A nossa vida tem 4 sentidos…amar, sofrer, lutar e vencer. Ame muito, sofra pouco,lute bastante e vença sempre!',
111 | 'Nada é por acaso…Acredite em seus sonhos e nos seus potenciais….Na vida tudo se supera...',
112 | 'Acredite em milagres, mas não dependa deles.',
113 | 'Você sempre será a sua melhor companhia!',
114 | 'Realize o óbvio, pense no improvável e conquiste o impossível Latumia. (W.J.F.)'];
115 | this.quebrarBiscoito = this.quebrarBiscoito.bind(this);
116 | }
117 |
118 | quebrarBiscoito() {
119 | let s = this.state;
120 | let r = Math.floor(Math.random() * this.frases.length);
121 | s.texto = this.frases[r];
122 | this.setState(s);
123 | }
124 |
125 | render() {
126 | return (
127 |
128 |
129 | "{this.state.texto}"
130 |
131 |
132 | );
133 | }
134 | }
135 |
136 | const styles = StyleSheet.create({
137 | body: {
138 | paddingTop: 20,
139 | flex: 1,
140 | justifyContent: 'center',
141 | alignItems: 'center'
142 | },
143 | texto: {
144 | fontSize: 17,
145 | color: '#B59619',
146 | margin: 30,
147 | fontStyle: 'italic',
148 | textAlign:'center'
149 | }
150 | });
--------------------------------------------------------------------------------
/P05 - BiscoitoDaSorte/code/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "expo": {
3 | "name": "Biscoito da sorte",
4 | "slug": "biscoitodasorte",
5 | "privacy": "public",
6 | "sdkVersion": "32.0.0",
7 | "android":{
8 | "package":"com.DaniloJs.biscoitodasorte"
9 | },
10 | "platforms": [
11 | "ios",
12 | "android"
13 | ],
14 | "version": "1.0.0",
15 | "orientation": "portrait",
16 | "icon": "./assets/images/icon.png",
17 | "updates": {
18 | "fallbackToCacheTimeout": 0
19 | },
20 | "assetBundlePatterns": [
21 | "**/*"
22 | ],
23 | "ios": {
24 | "supportsTablet": true
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/P05 - BiscoitoDaSorte/images/cookie.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Danilo-Js/React-Native-My-First-Projects/8820f1f4ec478ba66f6b8449d440b1925b0f8694/P05 - BiscoitoDaSorte/images/cookie.png
--------------------------------------------------------------------------------
/P05 - BiscoitoDaSorte/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Danilo-Js/React-Native-My-First-Projects/8820f1f4ec478ba66f6b8449d440b1925b0f8694/P05 - BiscoitoDaSorte/images/icon.png
--------------------------------------------------------------------------------
/P06 - Timer/code/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { TouchableOpacity, StyleSheet, Text, View, Image } from 'react-native';
3 |
4 | export default class SetimoProjeto extends Component {
5 | constructor(props) {
6 | super(props);
7 | this.state = { n: 0, botao: 'COMEÇAR' };
8 | this.timer = null;
9 | this.vai = this.vai.bind(this);
10 | this.limpar = this.limpar.bind(this);
11 | }
12 |
13 | vai() {
14 | let s = this.state;
15 | if(this.timer != null){
16 | //PARAR O TIMER
17 | clearInterval(this.timer);
18 | this.timer = null
19 | s.botao = "COMEÇAR";
20 | }else{
21 | //COMEÇAR O TIMER
22 | this.timer = setInterval(()=>{
23 | let s = this.state;
24 | s.n += 0.1;
25 | this.setState(s);
26 | }, 100);
27 | s.botao = "PARAR"
28 | }
29 | this.setState(s);
30 | }
31 |
32 | limpar() {
33 | if(this.timer != null){
34 | //PARAR O TIMER
35 | clearInterval(this.timer);
36 | this.timer = null
37 | }
38 | let s = this.state;
39 | s.n = 0;
40 | s.botao = "COMEÇAR";
41 | this.setState(s);
42 | }
43 |
44 | render() {
45 | return (
46 |
47 |
48 | {this.state.n.toFixed(1)}
49 |
50 |
51 |
52 |
53 | {this.state.botao}
54 |
55 |
56 |
57 | Limpar
58 |
59 |
60 |
61 |
62 |
63 | );
64 | }
65 | }
66 |
67 | const styles = StyleSheet.create({
68 | body: {
69 | flex: 1,
70 | justifyContent: 'center',
71 | alignItems: 'center',
72 | backgroundColor: "#2c1f30"
73 | },
74 | timer: {
75 | color: '#baa07a',
76 | fontSize: 50,
77 | fontWeight: 'bold',
78 | backgroundColor: 'transparent',
79 | marginTop: -140
80 | },
81 | botaoArea: {
82 | flexDirection: 'row',
83 | height: 40,
84 | marginTop: 100
85 | },
86 | botao: {
87 | flex: 1,
88 | justifyContent: 'center',
89 | alignItems: 'center',
90 | backgroundColor: '#886532',
91 | height: 40,
92 | borderRadius: 5,
93 | margin: 10
94 | },
95 | botaoText: {
96 | fontSize: 17,
97 | fontWeight: 'bold',
98 | color: '#FFFFFF'
99 | }
100 | });
101 |
--------------------------------------------------------------------------------
/P06 - Timer/code/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "expo": {
3 | "name": "Calculadora",
4 | "slug": "calculador",
5 | "privacy": "public",
6 | "sdkVersion": "32.0.0",
7 | "android":{
8 | "package":"com.DaniloJs.calculador"
9 | },
10 | "platforms": [
11 | "ios",
12 | "android"
13 | ],
14 | "version": "1.0.0",
15 | "orientation": "portrait",
16 | "icon": "./assets/images/icon.png",
17 | "updates": {
18 | "fallbackToCacheTimeout": 0
19 | },
20 | "assetBundlePatterns": [
21 | "**/*"
22 | ],
23 | "ios": {
24 | "supportsTablet": true
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/P06 - Timer/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Danilo-Js/React-Native-My-First-Projects/8820f1f4ec478ba66f6b8449d440b1925b0f8694/P06 - Timer/images/icon.png
--------------------------------------------------------------------------------
/P06 - Timer/images/relogio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Danilo-Js/React-Native-My-First-Projects/8820f1f4ec478ba66f6b8449d440b1925b0f8694/P06 - Timer/images/relogio.png
--------------------------------------------------------------------------------
/P07 - Calculadora/code/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { TouchableOpacity, StyleSheet, Text, View, Image } from 'react-native';
3 |
4 | class Botao extends Component {
5 |
6 | constructor(props) {
7 | super(props);
8 | this.state = {}
9 |
10 | let c = 1;
11 | if (props.c) {
12 | c = parseInt(props.c);
13 | }
14 |
15 | let bg = '#E0E0E0';
16 | if (props.bg) {
17 | bg = props.bg;
18 | }
19 |
20 | this.styles = StyleSheet.create({
21 | area: {
22 | flex: c,
23 | justifyContent: 'center',
24 | alignItems: 'center',
25 | borderWidth: 1,
26 | borderColor: '#999999',
27 | backgroundColor: bg
28 | },
29 | text: {
30 | fontSize: 25,
31 | fontWeight: 'bold'
32 | }
33 | });
34 | }
35 |
36 | render() {
37 | return (
38 |
39 | {this.props.n}
40 |
41 | );
42 | }
43 | }
44 |
45 | export default class SetimoProjeto extends Component {
46 | constructor(props) {
47 | super(props);
48 | this.state = { r: '0' }
49 | this.btn = this.btn.bind(this);
50 | }
51 |
52 | btn(b) {
53 | let s = this.state;
54 | if (b == "C") {
55 | s.r = '0';
56 | } else
57 | if (b == '=') {
58 | s.r = eval(s.r);
59 | } else {
60 | if (s.r == 0) {
61 | s.r = b;
62 | } else {
63 | s.r += b;
64 | }
65 | }
66 | this.setState(s);
67 | }
68 |
69 | render() {
70 | return (
71 |
72 |
73 | {this.state.r}
74 |
75 |
76 | { this.btn("C") }} />
77 | { this.btn("/") }} />
78 |
79 |
80 | { this.btn("7") }} />
81 | { this.btn("8") }} />
82 | { this.btn("9") }} />
83 | { this.btn("*") }} />
84 |
85 |
86 | { this.btn("4") }} />
87 | { this.btn("5") }} />
88 | { this.btn("6") }} />
89 | { this.btn("-") }} />
90 |
91 |
92 | { this.btn("1") }} />
93 | { this.btn("2") }} />
94 | { this.btn("3") }} />
95 | { this.btn("+") }} />
96 |
97 |
98 | { this.btn("0") }} />
99 | { this.btn(".") }} />
100 | { this.btn("=") }} />
101 |
102 |
103 | );
104 | }
105 | }
106 |
107 | const styles = StyleSheet.create({
108 | body: {
109 | paddingTop: 20,
110 | flex: 1
111 | },
112 | linha: {
113 | flex: 1,
114 | flexDirection: 'row'
115 | },
116 | res: {
117 | backgroundColor: '#000000',
118 | color: '#FFFFFF',
119 | fontSize: 50,
120 | flex: 1,
121 | textAlign: 'right',
122 | }
123 | });
124 |
--------------------------------------------------------------------------------
/P07 - Calculadora/code/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "expo": {
3 | "name": "Calculadora",
4 | "slug": "calculador",
5 | "privacy": "public",
6 | "sdkVersion": "32.0.0",
7 | "android":{
8 | "package":"com.DaniloJs.calculador"
9 | },
10 | "platforms": [
11 | "ios",
12 | "android"
13 | ],
14 | "version": "1.0.0",
15 | "orientation": "portrait",
16 | "icon": "./assets/images/icon.png",
17 | "updates": {
18 | "fallbackToCacheTimeout": 0
19 | },
20 | "assetBundlePatterns": [
21 | "**/*"
22 | ],
23 | "ios": {
24 | "supportsTablet": true
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/P07 - Calculadora/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Danilo-Js/React-Native-My-First-Projects/8820f1f4ec478ba66f6b8449d440b1925b0f8694/P07 - Calculadora/images/icon.png
--------------------------------------------------------------------------------
/P08 - ScrollView/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, StyleSheet, ScrollView } from 'react-native';
3 |
4 | export default class Projeto extends Component {
5 | render() {
6 | return (
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | );
26 | }
27 | }
28 |
29 | const styles = StyleSheet.create({
30 | body: {
31 | /*paddingTop: 20,*/
32 | flex: 1
33 | },
34 | quadrado1: {
35 | backgroundColor: '#FF0000',
36 | height: 200
37 | },
38 | quadrado2: {
39 | backgroundColor: '#00FF00',
40 | height: 200
41 | },
42 | header: {
43 | backgroundColor: '#0000FF',
44 | height: 100
45 | }
46 | });
--------------------------------------------------------------------------------
/P09 - FlatList/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, StyleSheet, FlatList, Text } from 'react-native';
3 |
4 | export default class Projeto extends Component {
5 | constructor(props) {
6 | super(props);
7 | this.state = {
8 | flatData: [
9 | { key: "1", nome: 'Danilo', idade: 19 },
10 | { key: "2", nome: 'Bryan', idade: 20 },
11 | { key: "3", nome: 'Murilo', idade: 29 },
12 | { key: "4", nome: 'Ze Da Tauba', idade: 150 },
13 | { key: "5", nome: 'Murilo', idade: 29 },
14 | { key: "6", nome: 'Murilo', idade: 29 },
15 | { key: "7", nome: 'Murilo', idade: 29 },
16 | { key: "8", nome: 'Murilo', idade: 29 },
17 | { key: "9", nome: 'Murilo', idade: 29 },
18 | { key: "10", nome: 'Murilo', idade: 29 },
19 | { key: "11", nome: 'Murilo', idade: 29 },
20 | { key: "12", nome: 'Murilo', idade: 29 },
21 | { key: "13", nome: 'Murilo', idade: 29 },
22 | { key: "14", nome: 'Murilo', idade: 29 },
23 | { key: "15", nome: 'Murilo', idade: 29 },
24 | { key: "16", nome: 'Murilo', idade: 29 },
25 | { key: "17", nome: 'Murilo', idade: 29 },
26 | { key: "18", nome: 'Murilo', idade: 29 },
27 | { key: "19", nome: 'Murilo', idade: 29 },
28 | { key: "20", nome: 'Murilo', idade: 29 },
29 | { key: "21", nome: 'Murilo', idade: 29 },
30 | { key: "21", nome: 'Murilo', idade: 29 },
31 | { key: "23", nome: 'Murilo', idade: 29 },
32 | { key: "24", nome: 'Murilo', idade: 29 },
33 | { key: "25", nome: 'Murilo', idade: 29 }
34 | ]
35 | }
36 | }
37 |
38 | flatRender(item) {
39 | return (
40 |
41 | {item.nome}
42 | {item.idade} anos
43 |
44 | );
45 | }
46 |
47 | render() {
48 | return (
49 |
50 | this.flatRender(item)} />
51 |
52 | );
53 | }
54 | }
55 |
56 | const styles = StyleSheet.create({
57 | body: {
58 | paddingTop: 20,
59 | },
60 | flatNome: {
61 | fontSize: 18,
62 | fontWeight: 'bold',
63 | color: 'black'
64 | },
65 | flatIdade: {
66 | fontSize: 14,
67 | fontWeight: 'bold',
68 | color: 'black'
69 | },
70 | flatItem: {
71 | padding: 10,
72 | borderWidth: 1,
73 | borderColor: '#000000'
74 | }
75 | });
--------------------------------------------------------------------------------
/P10 - SectionList/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, StyleSheet, SectionList, Text } from 'react-native';
3 |
4 | export default class Projeto extends Component {
5 | constructor(props) {
6 | super(props);
7 | this.state = {
8 | listData: [
9 | {
10 | title: 'B', data: [
11 | { key: "1", nome: 'Bunitim', idade: 19 }
12 | ]
13 | },
14 | {
15 | title: 'C', data: [
16 | { key: "2", nome: 'Cláudio', idade: 23 },
17 | { key: "3", nome: 'Clebim', idade: 34 },
18 | { key: "4", nome: 'Curioso', idade: 900 }
19 | ]
20 | },
21 | {
22 | title: 'D', data: [
23 | { key: "5", nome: 'Dantas', idade: 8 },
24 | { key: "6", nome: 'Diverson', idade: 45 }
25 | ]
26 | },
27 | {
28 | title: 'E', data: [
29 | { key: "7", nome: 'Euzim', idade: 8 },
30 | { key: "8", nome: 'Espertim', idade: 45 },
31 | { key: "9", nome: 'Euzim', idade: 8 },
32 | { key: "10", nome: 'Espertim', idade: 45 },
33 | { key: "11", nome: 'Euzim', idade: 8 },
34 | { key: "12", nome: 'Espertim', idade: 45 },
35 | { key: "13", nome: 'Euzim', idade: 8 },
36 | { key: "14", nome: 'Espertim', idade: 45 },
37 | { key: "15", nome: 'Euzim', idade: 8 },
38 | { key: "16", nome: 'Espertim', idade: 45 },
39 | { key: "17", nome: 'Euzim', idade: 8 },
40 | { key: "18", nome: 'Espertim', idade: 45 }
41 | ]
42 | }
43 | ]
44 | };
45 | }
46 |
47 | listSectionRender(section) {
48 | return (
49 | Letra {section.title}
50 | );
51 | }
52 |
53 | listRender(item) {
54 | return (
55 | {item.nome} - {item.idade} anos
56 | );
57 | }
58 |
59 | render() {
60 | return (
61 |
62 | this.listRender(item)} renderSectionHeader={({ section }) => this.listSectionRender(section)} />
63 |
64 | );
65 | }
66 | }
67 |
68 | const styles = StyleSheet.create({
69 | body: {
70 | paddingTop: 20
71 | },
72 | item: {
73 | fontSize: 18,
74 | height: 40,
75 | padding: 10,
76 | color: 'black'
77 | },
78 | section: {
79 | fontSize: 14,
80 | backgroundColor: '#CCCCCC',
81 | padding: 10,
82 | fontWeight: 'bold',
83 | color: 'black'
84 | }
85 | });
--------------------------------------------------------------------------------
/P11 - Picker (Autopeças José)/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, StyleSheet, Picker, Text } from 'react-native';
3 |
4 | export default class Projeto extends Component {
5 | constructor(props) {
6 | super(props);
7 | this.state = {
8 | servico: 0,
9 | servicos: [
10 | { nome: 'Alinhamento', valor: 30 },
11 | { nome: 'Balanceamento', valor: 20 },
12 | { nome: 'Rodízio de Pneus', valor: 50 },
13 | { nome: 'Dar uma voltinha', valor: 10 }
14 | ]
15 | };
16 | }
17 |
18 | render() {
19 | let servicosItems = this.state.servicos.map((v, k) => {
20 | return
21 | });
22 | return (
23 |
24 | AUTOPEÇAS JOSÉ
25 | this.setState({ servico: itemValue })}>
26 | {servicosItems}
27 |
28 | R$ {this.state.servicos[this.state.servico].valor.toFixed(2)}
29 |
30 | );
31 | }
32 | }
33 |
34 | const styles = StyleSheet.create({
35 | body: {
36 | paddingTop: 20,
37 | backgroundColor: '#DDDDDD',
38 | flex: 1
39 | },
40 | logo: {
41 | fontSize: 30,
42 | textAlign: 'center',
43 | marginBottom: 20
44 | },
45 | texto:{
46 | fontSize:26,
47 | textAlign:'center',
48 | marginTop:20
49 | }
50 | });
--------------------------------------------------------------------------------
/P12 - Switch/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, StyleSheet, Switch, Text } from 'react-native';
3 |
4 | export default class Projeto extends Component {
5 | constructor(props) {
6 | super(props);
7 | this.state = {
8 | valor: false
9 | };
10 | }
11 |
12 | render() {
13 | return (
14 |
15 | this.setState({ valor: v })} />
16 | {(this.state.valor) ? "Selecionado" : "Não selecionado"}
17 |
18 | );
19 | }
20 | }
21 |
22 | const styles = StyleSheet.create({
23 | body: {
24 | paddingTop: 20,
25 | flex: 1
26 | }
27 | });
--------------------------------------------------------------------------------
/P13 - Slider/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, StyleSheet, Slider, Text } from 'react-native';
3 |
4 | export default class Projeto extends Component {
5 | constructor(props) {
6 | super(props);
7 | this.state = {
8 | valor: 50
9 | };
10 | }
11 |
12 | render() {
13 | return (
14 |
15 | this.setState({valor: v})}/>
16 | {this.state.valor.toFixed(0)}%
17 |
18 | );
19 | }
20 | }
21 |
22 | const styles = StyleSheet.create({
23 | body: {
24 | paddingTop: 20,
25 | flex: 1
26 | }
27 | });
--------------------------------------------------------------------------------
/P14 - Modal/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, StyleSheet, Modal, Text, Button } from 'react-native';
3 |
4 | export default class Projeto extends Component {
5 | constructor(props) {
6 | super(props);
7 | this.state = {
8 | modalVisible: false
9 | };
10 |
11 | this.abrirModal = this.abrirModal.bind(this);
12 | this.fecharModal = this.fecharModal.bind(this);
13 | }
14 |
15 | abrirModal() {
16 | let s = this.state;
17 | s.modalVisible = true;
18 | this.setState(s);
19 | }
20 |
21 | fecharModal() {
22 | let s = this.state;
23 | s.modalVisible = false;
24 | this.setState(s);
25 | }
26 |
27 | /* animationType="fade" -> aparece na tela
28 | animationType="none" -> sem animação
29 | animationType="slide" -> arrastar de baixo pra cima
30 | */
31 |
32 | render() {
33 | return (
34 |
35 |
36 |
37 |
38 | Testando 1,2,3..
39 |
40 |
41 |
42 |
43 |
44 | );
45 | }
46 | }
47 |
48 | const styles = StyleSheet.create({
49 | body: {
50 | paddingTop: 20,
51 | flex: 1,
52 | justifyContent: 'center',
53 | alignItems: 'center'
54 | },
55 | modal: {
56 | flex: 1,
57 | backgroundColor: '#00FF00',
58 | paddingTop: 25,
59 | alignItems:'flex-start'
60 | }
61 | });
--------------------------------------------------------------------------------
/P15 - StatusBar/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, StyleSheet, Button, StatusBar} from 'react-native';
3 |
4 | export default class Projeto extends Component {
5 | constructor(props){
6 | super(props);
7 | this.state = {
8 | statusStyle:'dark-content',
9 | bgColor:'#FFFFFF'
10 | };
11 |
12 | this.alternar = this.alternar.bind(this);
13 |
14 | }
15 |
16 | alternar(){
17 | let s = this.state;
18 | if(s.statusStyle == 'dark-content'){
19 | s.statusStyle = 'light-content';
20 | s.bgColor = '#000000';
21 | }else{
22 | s.statusStyle = 'dark-content';
23 | s.bgColor = '#FFFFFF';
24 | }
25 | this.setState(s);
26 | }
27 |
28 | /* barStyle={default} -> padrão
29 | barStyle={light-content} -> branco
30 | barStyle={dark-content} -> preto
31 |
32 | no Android dá pra usar backgroundColor="" pra definir o fundo da
33 | StatusBar, mas no iPhone não.
34 | */
35 |
36 | render() {
37 | return (
38 |
39 |
40 |
43 | );
44 | }
45 | }
46 |
47 | const styles = StyleSheet.create({
48 | body: {
49 | paddingTop: 20,
50 | flex: 1,
51 | justifyContent:'center',
52 | alignItems:'center'
53 | }
54 | });
--------------------------------------------------------------------------------
/P16 - AsyncStorage/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, StyleSheet, AsyncStorage, TextInput } from 'react-native';
3 |
4 | export default class Projeto extends Component {
5 | constructor(props) {
6 | super(props);
7 | this.state = {
8 | nome: ''
9 | };
10 |
11 | AsyncStorage.getItem("nome").then((value)=>{
12 | this.setState({nome: value});
13 | });
14 |
15 | this.setNome = this.setNome.bind(this);
16 |
17 | }
18 |
19 | setNome(nome) {
20 | let s = this.state;
21 | s.nome = nome;
22 | this.setState(s);
23 |
24 | AsyncStorage.setItem("nome", nome);
25 | }
26 |
27 | render() {
28 | return (
29 |
30 |
31 | this.setNome(text)} />
32 |
33 |
34 | );
35 | }
36 | }
37 |
38 | const styles = StyleSheet.create({
39 | body: {
40 | paddingTop: 20,
41 | flex: 1,
42 | justifyContent:'center',
43 | alignItems:'center'
44 | },
45 | input: {
46 | height: 40,
47 | width: 200,
48 | borderWidth: 1,
49 | borderColor: '#CCCCCC',
50 | padding: 10,
51 | fontSize: 16
52 | }
53 | });
--------------------------------------------------------------------------------
/P17 - Navigation (React Navigation 3.0)/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, Text } from 'react-native';
3 | import { createDrawerNavigator, createStackNavigator, createBottomTabNavigator, createAppContainer } from 'react-navigation';
4 |
5 | import Home from './src/Home';
6 | import Tela2 from './src/Tela2';
7 |
8 | /* "const Navegador = createStackNavigator" -> uma stack na parte de cima do app
9 | "const Navegador = createBottomTabNavigator" -> duas opções (tab) de telas na parte de baixo do app
10 | "const Navegador = createDrawerNavigator" ->
11 | */
12 |
13 | const Navegador = createBottomTabNavigator({
14 | Home: {
15 | screen: Home
16 | },
17 | // Tela2: {
18 | // screen: Tela2
19 | // }
20 | }, {
21 | unmountInativeRoutes: true,
22 | defaultNavigationOptions: {
23 | //....
24 | }
25 | });
26 |
27 | const AppContainer = createAppContainer(Navegador);
28 | export default AppContainer;
--------------------------------------------------------------------------------
/P17 - Navigation (React Navigation 3.0)/src/Home.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, Text } from 'react-native';
3 | import { createStackNavigator, createAppContainer } from 'react-navigation';
4 |
5 | import Tela1 from './Tela1';
6 | import Tela2 from './Tela2';
7 |
8 | const Navegador = createStackNavigator({
9 | Tela1: {
10 | screen: Tela1
11 | },
12 | Tela2: {
13 | screen: Tela2
14 | }
15 | }, {
16 | defaultNavigationOptions:{
17 | //TabBarIcon:
18 | }
19 | });
20 |
21 | const Home = createAppContainer(Navegador);
22 | export default Home;
--------------------------------------------------------------------------------
/P17 - Navigation (React Navigation 3.0)/src/Tela1.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, Text } from 'react-native';
3 |
4 | class Tela1 extends Component {
5 | static navigationOptions = ({navigator}) => ({
6 | title:'Bem Vindo 1 '
7 | });
8 |
9 | render(){
10 | return(
11 |
12 | TELA1
13 |
14 | );
15 | }
16 | }
17 | export default Tela1;
--------------------------------------------------------------------------------
/P17 - Navigation (React Navigation 3.0)/src/Tela2.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, Text } from 'react-native';
3 |
4 | class Tela2 extends Component {
5 |
6 | static navigationOptions = ({navigator}) => ({
7 | title:'Bem Vindo 2'
8 | });
9 |
10 | render(){
11 | return(
12 |
13 | TELA2
14 |
15 | );
16 | }
17 | }
18 | export default Tela2;
--------------------------------------------------------------------------------
/P18 - Params/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, Text } from 'react-native';
3 | import { createDrawerNavigator, createStackNavigator, createAppContainer } from 'react-navigation';
4 |
5 | import Home from './src/Home';
6 | import Tela2 from './src/Tela2';
7 |
8 | const Navegador = createDrawerNavigator({
9 | CHAT: {
10 | screen: Home
11 | },
12 | }, {
13 | unmountInativeRoutes: true,
14 | });
15 |
16 | const AppContainer = createAppContainer(Navegador);
17 | export default AppContainer;
--------------------------------------------------------------------------------
/P18 - Params/src/Home.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, Text } from 'react-native';
3 | import { createStackNavigator, createAppContainer } from 'react-navigation';
4 |
5 | import Tela1 from './Tela1';
6 | import Tela2 from './Tela2';
7 |
8 | const Navegador = createStackNavigator({
9 | Tela1: {
10 | screen: Tela1
11 | },
12 | Tela2: {
13 | screen: Tela2
14 | }
15 | });
16 |
17 | const Home = createAppContainer(Navegador);
18 | export default Home;
--------------------------------------------------------------------------------
/P18 - Params/src/Tela1.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, Text, Button, StyleSheet, TouchableOpacity, TextInput } from 'react-native';
3 |
4 | class Botao extends Component {
5 | constructor(props) {
6 | super(props);
7 | this.state = {};
8 | this.styles = StyleSheet.create({
9 | botao: {
10 | width: 250,
11 | height: 50,
12 | borderWidth: 2,
13 | borderColor: 'black',
14 | backgroundColor: 'transparent',
15 | borderRadius: 25,
16 | },
17 | botaoArea: {
18 | flex: 1,
19 | flexDirection: 'row',
20 | justifyContent: 'center',
21 | alignItems: 'center'
22 | },
23 | botaoText: {
24 | color: 'black',
25 | fontSize: 20,
26 | fontWeight: 'bold'
27 | }
28 | });
29 | }
30 |
31 | render() {
32 | return (
33 |
34 |
35 | Conversar
36 |
37 |
38 | );
39 | }
40 | }
41 |
42 | class Tela1 extends Component {
43 | constructor(props) {
44 | super(props);
45 | this.state = {
46 | nome: ''
47 | };
48 |
49 | this.mudarNOME = this.mudarNOME.bind(this);
50 | }
51 |
52 | static navigationOptions = ({ navigator }) => ({
53 | title: 'CHAT'
54 | });
55 |
56 | mudarNOME(t) {
57 | let s = this.state;
58 | s.nome = t;
59 | this.setState(s);
60 | }
61 |
62 | render() {
63 | return (
64 |
65 |
66 |
67 |
68 |
69 | this.props.navigation.navigate('Tela2', { nome: this.state.nome })} />
70 |
71 |
72 | );
73 | }
74 | }
75 |
76 | const styles = StyleSheet.create({
77 | btn: {
78 | alignItems: 'center',
79 | justifyContent: 'center'
80 | },
81 | input: {
82 | flex: 1,
83 | color: 'black',
84 | height: 40,
85 | borderWidth: 1,
86 | borderColor: 'black',
87 | margin: 10,
88 | padding: 10,
89 | },
90 | TxtInput: {
91 | flexDirection: 'row',
92 | justifyContent: 'center',
93 | alignItems: 'center'
94 | },
95 | tudo:{
96 | flex: 1,
97 | justifyContent: 'center',
98 | alignItems: 'center'
99 | }
100 | });
101 | export default Tela1;
--------------------------------------------------------------------------------
/P18 - Params/src/Tela2.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, Text, StyleSheet } from 'react-native';
3 |
4 | class Tela2 extends Component {
5 | static navigationOptions = ({ navigator }) => ({
6 | title: 'CHAT'
7 | });
8 |
9 | render() {
10 | const param = this.props.navigation.state.params;
11 | return (
12 |
13 | Conversando com {param.nome}
14 |
15 | );
16 | }
17 | }
18 |
19 | const styles = StyleSheet.create({
20 | titl: {
21 | fontSize: 20,
22 | color: 'black',
23 | textAlign: 'center'
24 | }
25 | });
26 | export default Tela2;
--------------------------------------------------------------------------------
/P19 - Lista de Conversas/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { StyleSheet, Text, Platform, View, FlatList } from 'react-native';
3 | import ListItem from './src/ListItem'
4 |
5 | export default class App extends React.Component {
6 |
7 | constructor(props){
8 | super(props);
9 | this.state = {
10 | list:[
11 | {key:'1', img:'https://www.b7web.com.br/avatar1.png', nome:'Danilo José', msg:'Vai na aula hoje?'},
12 | {key:'2', img:'https://www.b7web.com.br/avatar2.png', nome:'José Medeiros', msg:'Opa, tudo bem?'},
13 | {key:'3', img:'https://www.b7web.com.br/avatar3.png', nome:'Mãe', msg:'Filho, etc e tal..'},
14 | {key:'4', img:'https://www.b7web.com.br/avatar2.png', nome:'Augusto Santos', msg:'Blz'},
15 | {key:'5', img:'https://www.b7web.com.br/avatar3.png', nome:'Aline Gonçalves', msg:'Tchau'},
16 | {key:'6', img:'https://www.b7web.com.br/avatar1.png', nome:'Paulo Duarte', msg:'Ok'},
17 | ]
18 | };
19 | }
20 |
21 | render() {
22 | return (
23 |
24 | }
27 | />
28 |
29 | );
30 | }
31 | }
32 |
33 | const styles = StyleSheet.create({
34 | container: {
35 | flex: 1,
36 | marginTop:(Platform.OS=='ios') ? 20 : 40
37 | },
38 | });
39 |
--------------------------------------------------------------------------------
/P19 - Lista de Conversas/src/ListItem.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, Text, Image, TouchableHighlight, StyleSheet } from 'react-native';
3 |
4 | export default class ListItem extends Component {
5 |
6 | constructor(props){
7 | super(props);
8 | this.state = {
9 | msg:props.data.msg
10 | };
11 | this.click = this.click.bind(this);
12 | }
13 |
14 | click(){
15 | alert("Clicou para abrir a conversa: "+this.props.data.key)
16 | }
17 |
18 | render(){
19 | return (
20 |
21 |
22 |
23 |
24 | {this.props.data.nome}
25 | {this.state.msg}
26 |
27 |
28 |
29 | );
30 | }
31 | }
32 |
33 | const styles = StyleSheet.create ({
34 | item:{
35 | height:60,
36 | marginLeft:10,
37 | marginRight:10,
38 | borderBottomWidth:1,
39 | borderColor:'#CCCCCC',
40 | flex:1,
41 | flexDirection:'row'
42 | },
43 | imagem:{
44 | width:40,
45 | height:40,
46 | marginTop:10,
47 | borderRadius:20
48 | },
49 | info:{
50 | flex:1,
51 | flexDirection:'column',
52 | justifyContent:'center',
53 | marginLeft:10
54 | },
55 | nome:{
56 | fontSize:15,
57 | fontWeight:'bold'
58 | }
59 | });
--------------------------------------------------------------------------------
/P20 - Chat/assets/bcg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Danilo-Js/React-Native-My-First-Projects/8820f1f4ec478ba66f6b8449d440b1925b0f8694/P20 - Chat/assets/bcg.jpg
--------------------------------------------------------------------------------
/P20 - Chat/code/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, StyleSheet, ImageBackground, FlatList } from 'react-native';
3 | import MsgItem from './src/MsgItem';
4 |
5 | export default class Projeto extends Component {
6 | constructor(props) {
7 | super(props);
8 | this.state = {
9 | chat: [
10 | { key: '1', nome: 'Danilo', msg: 'Oi', m: true },
11 | { key: '2', nome: 'Gatinha', msg: 'Opa, tudo bem?', m: false },
12 | { key: '3', nome: 'Gatinha', msg: 'Como vai a vida?', m: false },
13 | { key: '4', nome: 'Danilo', msg: 'Vai muito bem, graças ao seu Deus. E você? Tá namorando ainda?', m: true },
14 | { key: '5', nome: 'Gatinha', msg: 'Não, terminei.', m: false },
15 | { key: '6', nome: 'Danilo', msg: 'Ah, sim..', m: true },
16 | { key: '7', nome: 'Danilo', msg: 'Bora sair hj? Te pago um cerveja rsrs', m: true },
17 | { key: '8', nome: 'Gatinha', msg: 'Uhm....', m: false },
18 | { key: '9', nome: 'Gatinha', msg: 'Bora', m: false },
19 | ]
20 | };
21 | }
22 |
23 | render() {
24 | return (
25 |
26 |
27 | }
30 | />
31 |
32 |
33 | );
34 | }
35 | }
36 |
37 | const styles = StyleSheet.create({
38 | body: {
39 | flex: 1,
40 | },
41 | chat: {
42 | flex: 1,
43 | paddingTop: 30
44 | }
45 | });
--------------------------------------------------------------------------------
/P20 - Chat/code/src/MsgItem.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, Text, StyleSheet } from 'react-native';
3 |
4 | export default class MsgItem extends Component {
5 | constructor(props) {
6 | super(props);
7 |
8 | this.estilo = styles.balaoEsquerda;
9 | if (props.data.m) {
10 | this.estilo = styles.balaoDireita;
11 | }
12 | }
13 |
14 |
15 | render() {
16 | return (
17 |
18 | {this.props.data.nome}
19 | {this.props.data.msg}
20 |
21 | );
22 | }
23 | }
24 |
25 | const styles = StyleSheet.create({
26 | balao: {
27 | backgroundColor: '#FF0000',
28 | margin: 10,
29 | padding: 10,
30 | borderRadius: 10
31 | },
32 | balaoEsquerda: {
33 | backgroundColor: '#FFFFFF',
34 | alignSelf: 'flex-start',
35 | marginRight:50,
36 | },
37 | balaoDireita: {
38 | backgroundColor: '#00FF00',
39 | alignSelf: 'flex-end',
40 | marginLeft:50,
41 | },
42 | nome: {
43 | fontSize: 15,
44 | fontWeight: 'bold'
45 | }
46 | });
--------------------------------------------------------------------------------
/P21 - Tela de dados pessoais e financeiros/apk/dados_1.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Danilo-Js/React-Native-My-First-Projects/8820f1f4ec478ba66f6b8449d440b1925b0f8694/P21 - Tela de dados pessoais e financeiros/apk/dados_1.apk
--------------------------------------------------------------------------------
/P21 - Tela de dados pessoais e financeiros/assets/bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Danilo-Js/React-Native-My-First-Projects/8820f1f4ec478ba66f6b8449d440b1925b0f8694/P21 - Tela de dados pessoais e financeiros/assets/bg.jpg
--------------------------------------------------------------------------------
/P21 - Tela de dados pessoais e financeiros/assets/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Danilo-Js/React-Native-My-First-Projects/8820f1f4ec478ba66f6b8449d440b1925b0f8694/P21 - Tela de dados pessoais e financeiros/assets/icon.png
--------------------------------------------------------------------------------
/P21 - Tela de dados pessoais e financeiros/assets/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Danilo-Js/React-Native-My-First-Projects/8820f1f4ec478ba66f6b8449d440b1925b0f8694/P21 - Tela de dados pessoais e financeiros/assets/splash.png
--------------------------------------------------------------------------------
/P21 - Tela de dados pessoais e financeiros/code/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, StyleSheet, ImageBackground, TextInput, Picker, Text, TouchableOpacity, Slider, Switch } from 'react-native';
3 | import DatePicker from 'react-native-datepicker';
4 |
5 | class BotaoSalvar extends Component {
6 | constructor(props) {
7 | super(props);
8 | this.styles = StyleSheet.create({
9 | botao: {
10 | width: 175,
11 | height: 35,
12 | borderWidth: 2,
13 | borderColor: 'black',
14 | backgroundColor: 'transparent',
15 | borderRadius: 25,
16 | },
17 | botaoArea: {
18 | flex: 1,
19 | flexDirection: 'row',
20 | justifyContent: 'center',
21 | alignItems: 'center'
22 | },
23 | botaoText: {
24 | color: 'black',
25 | fontSize: 13,
26 | fontWeight: 'bold'
27 | }
28 | });
29 | }
30 |
31 | render() {
32 | return (
33 |
34 |
35 | SALVAR
36 |
37 |
38 | );
39 | }
40 | }
41 |
42 | class BotaoAddCartao extends Component {
43 | constructor(props) {
44 | super(props);
45 | this.styles = StyleSheet.create({
46 | botao: {
47 | width: 50,
48 | height: 20,
49 | borderWidth: 2,
50 | borderColor: 'black',
51 | backgroundColor: 'transparent',
52 | borderRadius: 25,
53 | },
54 | botaoArea: {
55 | flex: 1,
56 | flexDirection: 'row',
57 | justifyContent: 'center',
58 | alignItems: 'center'
59 | },
60 | botaoText: {
61 | color: 'black',
62 | fontSize: 17,
63 | fontWeight: 'bold'
64 | }
65 | });
66 | }
67 |
68 | render() {
69 | return (
70 |
71 |
72 | +
73 |
74 |
75 | );
76 | }
77 | }
78 |
79 | class BotaoRemoveCartao extends Component {
80 | constructor(props) {
81 | super(props);
82 | this.styles = StyleSheet.create({
83 | botao: {
84 | width: 50,
85 | height: 20,
86 | borderWidth: 2,
87 | borderColor: 'black',
88 | backgroundColor: 'transparent',
89 | borderRadius: 25,
90 | },
91 | botaoArea: {
92 | flex: 1,
93 | flexDirection: 'row',
94 | justifyContent: 'center',
95 | alignItems: 'center'
96 | },
97 | botaoText: {
98 | color: 'black',
99 | fontSize: 17,
100 | fontWeight: 'bold'
101 | }
102 | });
103 | }
104 |
105 | render() {
106 | return (
107 |
108 |
109 | -
110 |
111 |
112 | );
113 | }
114 | }
115 |
116 |
117 | export default class Projeto extends Component {
118 | constructor(props) {
119 | super(props);
120 | this.state = {
121 | DoadorDeOrgaos: '',
122 | DoadorVF: false,
123 |
124 | Salario: 400,
125 | Peso: 70,
126 | Altura: 1.70,
127 | date: "2016-05-15",
128 | Nome: '',
129 | QtCartoes: 0,
130 | salvar: '',
131 |
132 | sexo: 0,
133 | sexos: [
134 | { nome: 'Masculino' },
135 | { nome: 'Feminino' }
136 | ],
137 |
138 | banco: 0,
139 | bancos: [
140 | { nome: 'Caixa Econômica Federal' },
141 | { nome: 'Banco do Brasil' },
142 | { nome: 'Banco Santander' },
143 | { nome: 'Banestes' },
144 | ],
145 | };
146 |
147 | this.mudarNome = this.mudarNome.bind(this);
148 | this.Salvar = this.Salvar.bind(this);
149 | this.AddCartao = this.AddCartao.bind(this);
150 | this.RemoveCartao = this.RemoveCartao.bind(this);
151 | }
152 |
153 | Salvar() {
154 | let s = this.state;
155 |
156 | //convertendo o valor booleano em 'Sim' e 'Nao'
157 | if (s.DoadorVF == true) {
158 | s.DoadorDeOrgaos = 'Sim';
159 | } else {
160 | s.DoadorDeOrgaos = 'Não';
161 | }
162 | //colocando todas as informacoes numa variavel e depois fazendo um alert com ela
163 | s.salvar = 'DADOS PESSOAIS\nNome: ' + s.Nome + '\n Nascimento: ' + s.date + '\n Sexo: ' + s.sexos[s.sexo].nome + '\n Altura: ' + s.Altura.toFixed(2) + 'm' + '\n Peso: ' + s.Peso.toFixed(0) + 'kg' + '\n Doador de órgãos: ' + s.DoadorDeOrgaos + '\n\nDADOS FINANCEIROS\nSalário: R$' + s.Salario.toFixed(0) + '\nBanco: ' + s.bancos[s.banco].nome + '\nQt. de cartões: ' + s.QtCartoes;
164 | alert(s.salvar);
165 | }
166 |
167 | AddCartao() {
168 | let s = this.state;
169 | s.QtCartoes = s.QtCartoes + 1;
170 | this.setState(s);
171 | }
172 |
173 | RemoveCartao() {
174 | let s = this.state;
175 | if (s.QtCartoes != 0) {
176 | s.QtCartoes = s.QtCartoes - 1;
177 | this.setState(s);
178 | }
179 | }
180 |
181 | mudarNome(t) {
182 | let s = this.state;
183 | s.Nome = t;
184 | this.setState(s);
185 | }
186 |
187 | render() {
188 | //isso aqui é dos pickers do sexo e do banco
189 | let sexosItems = this.state.sexos.map((v, k) => {
190 | return
191 | });
192 | let bancoItems = this.state.bancos.map((v, k) => {
193 | return
194 | });
195 |
196 | return (
197 |
198 |
199 |
200 |
201 |
202 |
203 | Qual seu aniversário?
204 | { this.setState({ date: date }) }}
229 | />
230 |
231 | Qual seu sexo?
232 |
233 | this.setState({ sexo: itemValue })}>
234 | {sexosItems}
235 |
236 |
237 |
238 | Qual sua altura? {this.state.Altura.toFixed(2)}m
239 | this.setState({ Altura: v })} />
240 |
241 | Qual seu peso? {this.state.Peso.toFixed(0)}kg
242 | this.setState({ Peso: v })} />
243 |
244 | Você é doador de órgãos?
245 |
246 | this.setState({ DoadorVF: v })} />
247 |
248 |
249 |
250 |
251 |
252 |
253 | Qual seu salário? R$ {this.state.Salario.toFixed(0)}
254 | this.setState({ Salario: v })} />
255 |
256 | Qual seu banco?
257 |
258 | this.setState({ banco: itemValue })}>
259 | {bancoItems}
260 |
261 |
262 |
263 | Qt. de cartões
264 |
265 |
266 | {this.state.QtCartoes.toFixed(0)}
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 | );
278 | }
279 | }
280 |
281 | const styles = StyleSheet.create({
282 | body: {
283 | flex: 1,
284 | },
285 | bgimage: {
286 | flex: 1,
287 | },
288 | input: {
289 | color: 'black',
290 | height: 40,
291 | borderWidth: 1,
292 | borderColor: 'black',
293 | margin: 10,
294 | padding: 10,
295 | borderRadius: 20
296 | },
297 | btn2: {
298 | justifyContent: 'center',
299 | alignItems: 'center',
300 | margin: 20
301 | },
302 | titulo: {
303 | color: 'black',
304 | fontSize: 30,
305 | fontWeight: 'bold',
306 | },
307 | tit: {
308 | justifyContent: 'center',
309 | alignItems: 'center',
310 | margin: 20
311 | },
312 | pick: {
313 | marginRight: 80,
314 | borderWidth: 1,
315 | marginLeft: 10,
316 | borderRadius: 20
317 | },
318 | dpck: {
319 | width: 200,
320 | },
321 | leg: {
322 | color: 'black',
323 | paddingTop: 5,
324 | marginTop: 5,
325 | marginLeft: 20,
326 | fontSize: 15,
327 | fontWeight: 'bold',
328 | },
329 | SW: {
330 | marginLeft: 20,
331 | alignItems: 'flex-start',
332 | },
333 | btn3: {
334 | flexDirection: 'row',
335 | justifyContent: 'flex-start',
336 | alignItems: 'flex-start',
337 | paddingLeft: 20,
338 | paddingRight: 30
339 | },
340 | leg1: {
341 | color: 'black',
342 | marginLeft: 20,
343 | marginRight: 20,
344 | fontSize: 15,
345 | fontWeight: 'bold',
346 | }
347 | });
--------------------------------------------------------------------------------
/P21 - Tela de dados pessoais e financeiros/code/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "expo": {
3 | "name": "Dados",
4 | "slug": "dados",
5 | "privacy": "public",
6 | "sdkVersion": "32.0.0",
7 | "android":{
8 | "package":"com.DaniloJs.dados"
9 | },
10 | "platforms": [
11 | "ios",
12 | "android"
13 | ],
14 | "version": "1.0.0",
15 | "orientation": "portrait",
16 | "icon": "./assets/icon.png",
17 | "updates": {
18 | "fallbackToCacheTimeout": 0
19 | },
20 | "assetBundlePatterns": [
21 | "**/*"
22 | ],
23 | "ios": {
24 | "supportsTablet": true
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/P22 - Lista de tarefas/code/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, StyleSheet, FlatList, Text, TextInput, Button } from 'react-native';
3 | import Item from './src/Item';
4 |
5 | export default class Projeto extends Component {
6 | constructor(props) {
7 | super(props);
8 | this.state = {
9 | lista: [],
10 | input: '',
11 | };
12 | this.url = 'https://b7web.com.br/todo/23196'
13 | this.loadLista = this.loadLista.bind(this);
14 | this.addButton = this.addButton.bind(this);
15 |
16 | this.loadLista();
17 | }
18 |
19 | loadLista() {
20 | fetch(this.url)
21 | .then((r) => r.json())
22 | .then((json) => {
23 | let state = this.state;
24 | state.lista = json.todo;
25 | this.setState(state);
26 | });
27 | }
28 |
29 | addButton() {
30 | let texto = this.state.input;
31 | let state = this.state;
32 | state.input = '';
33 | this.setState(state);
34 |
35 | fetch(this.url, {
36 | method:'POST',
37 | headers:{
38 | 'Accept':'application/json',
39 | 'Content-Type':'application/json'
40 | },
41 | body:JSON.stringify({
42 | item:texto
43 | })
44 | })
45 | .then((r) => r.json())
46 | .then((json) => {
47 | this.loadLista();
48 | })
49 | }
50 |
51 | render() {
52 | return (
53 |
54 |
55 | Adicione uma nova tarefa
56 | {
57 | let state = this.state;
58 | state.input = text;
59 | this.setState(state);
60 | }} value={this.state.input} />
61 |
62 |
63 |
64 |
65 | - }
68 | keyExtractor={(item, index) => item.id}
69 | />
70 |
71 | );
72 | }
73 | }
74 |
75 | const styles = StyleSheet.create({
76 | container: {
77 | flex: 1,
78 | paddingTop: 23,
79 | },
80 | addArea: {
81 | marginBottom: 20,
82 | backgroundColor: 'lightblue',
83 | height: 100
84 | },
85 | addText: {
86 | fontSize: 14,
87 | textAlign: 'center',
88 | marginBottom: 10,
89 | marginTop: 10
90 | },
91 | input: {
92 | height: 40,
93 | backgroundColor: 'white',
94 | marginLeft: 20,
95 | marginRight: 10,
96 | paddingRight: 10
97 | },
98 | btn: {
99 | margin: 2.5,
100 | marginLeft: 100,
101 | marginRight: 100,
102 | marginBottom: 10,
103 | marginTop: 10,
104 | },
105 | });
--------------------------------------------------------------------------------
/P22 - Lista de tarefas/code/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "expo": {
3 | "name": "Lista de Tarefas",
4 | "slug": "listadetarefas",
5 | "privacy": "public",
6 | "sdkVersion": "32.0.0",
7 | "android":{
8 | "package":"com.DaniloJs.listadetarefas"
9 | },
10 | "platforms": [
11 | "ios",
12 | "android"
13 | ],
14 | "version": "1.0.0",
15 | "orientation": "portrait",
16 | "icon": "./assets/icon.png",
17 | "updates": {
18 | "fallbackToCacheTimeout": 0
19 | },
20 | "assetBundlePatterns": [
21 | "**/*"
22 | ],
23 | "ios": {
24 | "supportsTablet": true
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/P22 - Lista de tarefas/code/src/Item.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, StyleSheet, Text, TouchableHighlight, Button } from 'react-native';
3 |
4 | export default class Item extends Component {
5 | constructor(props) {
6 | super(props);
7 | this.state = {
8 | done: (this.props.data.done=='1')? styles.done : styles.undone
9 | };
10 | this.marcar = this.marcar.bind(this);
11 | this.excluir = this.excluir.bind(this);
12 | }
13 |
14 | marcar() {
15 | let state = this.state;
16 | let done = 'sim';
17 |
18 | if (this.state.done == styles.undone) {
19 | state.done = styles.done
20 | done = 'sim';
21 | } else {
22 | state.done = styles.undone;
23 | done = 'nao'
24 | }
25 | fetch(this.props.url + '/' + this.props.data.id, {
26 | method: 'PUT',
27 | headers: {
28 | 'Accept': 'application/json',
29 | 'Content-Type': 'application/json'
30 | },
31 | body: JSON.stringify({
32 | done: done
33 | })
34 | })
35 | .then((r) => r.json())
36 | .then((json) => { });
37 | this.setState(state);
38 | }
39 |
40 | excluir(){
41 | fetch(this.props.url + '/' + this.props.data.id, {
42 | method: 'DELETE',
43 | headers: {
44 | 'Accept': 'application/json',
45 | 'Content-Type': 'application/json'
46 | },
47 | })
48 | .then((r) => r.json())
49 | .then((json) => {
50 | this.props.loadFunction();
51 | });
52 | }
53 |
54 | render() {
55 | return (
56 |
57 |
58 |
59 |
60 |
61 |
62 | {this.props.data.item}
63 |
64 |
66 |
67 | );
68 | }
69 | }
70 |
71 | const styles = StyleSheet.create({
72 | area: {
73 | paddingTop: 15,
74 | paddingBottom: 10,
75 | borderBottomWidth: 1,
76 | borderColor: '#CCCCCC',
77 | flex: 1,
78 | flexDirection: 'row',
79 | alignItems: 'center'
80 | },
81 | marcarArea: {
82 | marginRight: 10,
83 | marginLeft: 10,
84 | width: 40,
85 | height: 40,
86 | },
87 | undone: {
88 | backgroundColor: '#CCCCCC'
89 | },
90 | done: {
91 | backgroundColor: '#00FF00'
92 | },
93 | botao: {
94 | width: 40,
95 | height: 40,
96 | },
97 | botaoArea: {
98 | paddingLeft: 10,
99 | },
100 | });
--------------------------------------------------------------------------------
/P22 - Lista de tarefas/database.url:
--------------------------------------------------------------------------------
1 | [{000214A0-0000-0000-C000-000000000046}]
2 | Prop3=19,11
3 | [InternetShortcut]
4 | IDList=
5 | URL=https://b7web.com.br/todo/23196
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | You can visit this course here
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | What is this? |
32 | About the projects |
33 | License
34 |
35 |
36 | #
37 |
38 | ### :balloon: What is this?
39 | This is a compilation of simple projects showing the first steps I made in React Native. These projects were made just to practice simple React Native concepts
40 |
41 | #
42 |
43 | ### :iphone: About the projects
44 |
45 | #### [01](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P01%20-%20Janta) -> Janta *(Dine)*
46 | #### [02](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P02%20-%20Nome) -> Nome *(Name)*
47 | #### [03](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P03%20-%20AdivinhaNome) -> AdivinhaNome *(GuessName)*
48 | #### [04](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P04%20-%20ContadorAgua) -> ContadorAgua *(WaterCounter)*
49 | #### [05](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P05%20-%20BiscoitoDaSorte) -> BiscoitoDaSorte *(FortuneCookie)*
50 | #### [06](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P06%20-%20Timer) -> Timer
51 | #### [07](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P07%20-%20Calculadora) -> Calculadora *(Calculator)*
52 | #### [08](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P08%20-%20ScrollView) -> ScrollView
53 | #### [09](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P09%20-%20FlatList) -> FlatList
54 | #### [10](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P10%20-%20SectionList) -> SectionList
55 | #### [11](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P11%20-%20Picker%20(Autopeças%20José)) -> Picker | Autopeças José *(Picker | Auto parts José)*
56 | #### [12](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P12%20-%20Switch) -> Switch
57 | #### [13](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P13%20-%20Slider) -> Slider
58 | #### [14](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P14%20-%20Modal) -> Modal
59 | #### [15](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P15%20-%20StatusBar) -> StatusBar
60 | #### [16](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P16%20-%20AsyncStorage) -> AsyncStorage
61 | #### [17](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P17%20-%20Navigation%20(React%20Navigation%203.0)) -> React Navigation 3.0
62 | #### [18](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P18%20-%20Params) -> Params
63 | #### [19](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P19%20-%20Lista%20de%20Conversas) -> Lista de Conversas *(Chat list)*
64 | #### [20](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P20%20-%20Chat) -> Chat
65 | #### [21](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P21%20-%20Tela%20de%20dados%20pessoais%20e%20financeiros) -> Tela de dados pessoais e financeiros *(personal and financial data screen)*
66 | #### [22](https://github.com/Danilo-Js/React-Native-do-Zero-ao-Profissional/tree/master/P22%20-%20Lista%20de%20tarefas) -> Lista de Tarefas *(Task List)*
67 |
68 | #
69 |
70 | ### :memo: License
71 | This project is under the MIT license. See the [LICENSE](https://github.com/Danilo-Js/React-Native-My-First-Projects/blob/master/LICENSE) for more information.
72 |
73 | ---
74 |
75 | #### Made by Danilo José Lima de Oliveira ♥
76 | #### [Get in touch!](https://www.linkedin.com/in/danilo-js/) with me
77 |
78 |
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/READMEfiles/topImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Danilo-Js/React-Native-My-First-Projects/8820f1f4ec478ba66f6b8449d440b1925b0f8694/READMEfiles/topImage.png
--------------------------------------------------------------------------------