Skip to content

Commit

Permalink
Zerar valores
Browse files Browse the repository at this point in the history
Reinicia a tabela e permite um novo cálculo
  • Loading branch information
ricardorohrs committed Jun 10, 2020
1 parent 962a2be commit e78507c
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 15 deletions.
34 changes: 21 additions & 13 deletions App.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { Text, Button, StyleSheet, Alert, View, Image, ScrollView, TextInput } from 'react-native';
import { Table, Row, Rows } from 'react-native-table-component';
import { Button, StyleSheet, Alert, View, Image, ScrollView, TextInput } from 'react-native';
import { Table, Row } from 'react-native-table-component';

var SampleArray = [];

Expand All @@ -22,6 +22,10 @@ export default class MainActivity extends Component {
//Alert.alert(SampleArray.toString());
}

valores = () => {
Alert.alert(SampleArray.toString());
};

calculate = () => {
let novo = SampleArray.toString().split(",");
const data = novo.sort((a,b)=>{
Expand Down Expand Up @@ -59,7 +63,7 @@ export default class MainActivity extends Component {
do {
for (let i = ultimaIteracao; i <= data.length; i++ ) {
if (i===0) {
if (data[i] < intervalos[intervaloAtual][1])
if (data[i] <= intervalos[intervaloAtual][1])
xi[intervaloAtual]++;
else {
ultimaIteracao = i;
Expand Down Expand Up @@ -119,18 +123,17 @@ export default class MainActivity extends Component {
this.setState({DataTable: array});
}

renderItem = ({ item }) => {
if (item.empty === true) {
zerar = () => {
SampleArray = [];
this.setState({DataTable:[]});
}

/* renderItem = ({ item }) => {
if (item.empty === true)
return <View/>;
}
return (
<Text>{item.key}</Text>
);
};
valores = () => {
Alert.alert(SampleArray.toString());
};
return (<Text>{item.key}</Text>);
}; */

render() {
const state = this.state;
Expand Down Expand Up @@ -168,6 +171,11 @@ export default class MainActivity extends Component {
))}
</Table>
</ScrollView>

<View style={styles.botao}>
<Button title="Calcular Novamente" onPress={this.zerar}/>
</View>

</View>
</ScrollView>
</View>
Expand Down
4 changes: 2 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:icon="@mipmap/icon"
android:roundIcon="@mipmap/icon_round"
android:allowBackup="false"
android:theme="@style/AppTheme">

Expand Down
Binary file removed android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary file not shown.
Binary file not shown.
Binary file added android/app/src/main/res/mipmap-hdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary file not shown.
Binary file not shown.
Binary file added android/app/src/main/res/mipmap-mdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file added android/app/src/main/res/mipmap-xhdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file added android/app/src/main/res/mipmap-xxhdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file added android/app/src/main/res/mipmap-xxxhdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e78507c

Please sign in to comment.