fill the whole screen with buttons

This commit is contained in:
Niklas 2021-01-22 18:09:47 +01:00
parent 6501c01525
commit 47d5932fb5
2 changed files with 16 additions and 12 deletions

View File

@ -16,19 +16,18 @@ import DeckButton from './components/DeckButton';
declare const global: {HermesInternal: null | {}}; declare const global: {HermesInternal: null | {}};
const App = () => { const App = () => {
const buttons = [];
for (let i = 0; i < 21; i++) {
let text = 'btn' + i;
buttons.push(<DeckButton text={text} key={i} />);
}
return ( return (
<> <>
<StatusBar hidden={true} /> <StatusBar hidden={true} />
<SafeAreaView> <SafeAreaView>
<Deck> <Deck>{buttons}</Deck>
<DeckButton text="Btn1" />
<DeckButton text="Btn2" />
<DeckButton text="Btn3" />
<DeckButton text="Btn4" />
<DeckButton text="Btn5" />
<DeckButton text="Btn6" />
<DeckButton text="Btn7" />
</Deck>
</SafeAreaView> </SafeAreaView>
</> </>
); );

View File

@ -1,5 +1,11 @@
import React from 'react'; import React from 'react';
import {StyleSheet, Text, TouchableHighlight, View} from 'react-native'; import {
Dimensions,
StyleSheet,
Text,
TouchableHighlight,
View,
} from 'react-native';
interface Props { interface Props {
text: string; text: string;
@ -25,7 +31,7 @@ const style = StyleSheet.create({
view: { view: {
backgroundColor: '#ff4000', backgroundColor: '#ff4000',
flexBasis: (1 / 3) * 100 + '%', flexBasis: (1 / 3) * 100 + '%',
height: 80, height: Dimensions.get('window').height / 7,
borderColor: '#94f713', borderColor: '#94f713',
borderWidth: 1, borderWidth: 1,
flex: 1, flex: 1,
@ -35,7 +41,6 @@ const style = StyleSheet.create({
height: '100%', height: '100%',
}, },
text: { text: {
//backgroundColor: '#ffbf00',
textAlign: 'center', textAlign: 'center',
}, },
}); });