This repository has been archived by the owner on Dec 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #395 from gluestack/release/@gluestack-style/react…
…@0.2.27 Release/@gluestack style/[email protected]
- Loading branch information
Showing
50 changed files
with
13,773 additions
and
604 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,58 @@ | ||
import React from 'react'; | ||
import { View } from 'react-native'; | ||
import { config } from './gluestack-ui.config'; | ||
import { styled, StyledProvider } from '../../packages/react'; | ||
// import { Box, Heading } from './src/core'; | ||
import { useState } from 'react'; | ||
import { Button, StyleSheet, Text, View } from 'react-native'; | ||
|
||
const Box = styled(View, { | ||
bg: '$primary100', | ||
h: '$10', | ||
w: '$10', | ||
}); | ||
import Gluestack from './BenchGlueStack'; | ||
import ReactNative from './BenchReactNative'; | ||
import TimedRender from './TimedRender'; | ||
|
||
export default function App() { | ||
const [styleType, setStyleType] = useState<any>(undefined); | ||
|
||
const onStyleTypePress = (curry) => () => { | ||
setStyleType(curry); | ||
}; | ||
|
||
const renderStyleLibrary = () => { | ||
switch (styleType) { | ||
case 'Gluestack': | ||
return <Gluestack />; | ||
case 'React Native': | ||
return <ReactNative />; | ||
default: | ||
return null; | ||
} | ||
}; | ||
|
||
return ( | ||
<> | ||
{/* gluestack-ui provider */} | ||
<StyledProvider config={config.theme}> | ||
<Box bg="$red500" /> | ||
</StyledProvider> | ||
</> | ||
<View style={styles.container}> | ||
<Text style={styles.text}>Tap a style library to start rendering</Text> | ||
<Button title="React Native" onPress={onStyleTypePress('React Native')} /> | ||
<Button title="Gluestack" onPress={onStyleTypePress('Gluestack')} /> | ||
{styleType ? ( | ||
<TimedRender key={styleType}> | ||
<Text style={styles.text}> | ||
Rendering with <Text style={styles.bold}>{styleType}</Text> | ||
</Text> | ||
</TimedRender> | ||
) : null} | ||
{renderStyleLibrary()} | ||
</View> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
// alignItems: "center", | ||
backgroundColor: '#fff', | ||
// flex: 1, | ||
// justifyContent: "center", | ||
}, | ||
text: { | ||
marginVertical: 12, | ||
}, | ||
bold: { | ||
fontWeight: 'bold', | ||
fontSize: 16, | ||
}, | ||
}); |
Oops, something went wrong.