This repository has been archived by the owner on May 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
215 additions
and
1,358 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from 'react'; | ||
import styled from '../../../../build/module/macro'; | ||
import { Text, Pressable, SafeAreaView } from 'react-native'; | ||
import { useWindowVariant } from 'react-native-styled.macro/lib'; | ||
|
||
export default function App() { | ||
const variants = useWindowVariant(); | ||
|
||
return ( | ||
<SafeAreaView {...styled(['flex-1', 'items-center'])}> | ||
<Pressable | ||
{...styled( | ||
[ | ||
'mx-2', | ||
'border', | ||
'rounded-lg', | ||
'border-indigo-600', | ||
'bg-indigo-600', | ||
'sm:bg-green-600', | ||
'md:bg-teal-600', | ||
'lg:bg-yellow-600', | ||
'xl:bg-orange-600', | ||
], | ||
variants | ||
)} | ||
> | ||
<Text {...styled(['text-base', 'text-white'])}>Press me</Text> | ||
</Pressable> | ||
</SafeAreaView> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import { rem as _rem3 } from 'react-native-styled.macro/build/module/utils/rem'; | ||
import { rem as _rem2 } from 'react-native-styled.macro/build/module/utils/rem'; | ||
import { rem as _rem } from 'react-native-styled.macro/build/module/utils/rem'; | ||
import { StyleSheet as _StyleSheet } from 'react-native'; | ||
import { select as _select } from 'react-native-styled.macro/build/module/utils/select'; | ||
|
||
const _styles = _StyleSheet.create({ | ||
_default: { | ||
flexGrow: 1, | ||
flexShrink: 1, | ||
flexBasis: '0%', | ||
alignItems: 'center', | ||
}, | ||
_default2: { | ||
marginHorizontal: _rem(0.5), | ||
borderWidth: 1, | ||
borderRadius: _rem2(0.5), | ||
borderColor: '#5a67d8', | ||
backgroundColor: '#5a67d8', | ||
}, | ||
_sm: { | ||
backgroundColor: '#38a169', | ||
}, | ||
_md: { | ||
backgroundColor: '#319795', | ||
}, | ||
_lg: { | ||
backgroundColor: '#d69e2e', | ||
}, | ||
_xl: { | ||
backgroundColor: '#dd6b20', | ||
}, | ||
_default3: { | ||
fontSize: _rem3(1), | ||
color: 'white', | ||
}, | ||
}); | ||
|
||
import React from 'react'; | ||
import { Text, Pressable, SafeAreaView } from 'react-native'; | ||
import { useWindowVariant } from 'react-native-styled.macro/lib'; | ||
export default function App() { | ||
const variants = useWindowVariant(); | ||
return ( | ||
<SafeAreaView | ||
{...{ | ||
style: [_styles._default], | ||
}} | ||
> | ||
<Pressable | ||
{..._select( | ||
[ | ||
{ | ||
variant: 'default', | ||
style: _styles._default2, | ||
}, | ||
{ | ||
variant: 'sm', | ||
style: _styles._sm, | ||
}, | ||
{ | ||
variant: 'md', | ||
style: _styles._md, | ||
}, | ||
{ | ||
variant: 'lg', | ||
style: _styles._lg, | ||
}, | ||
{ | ||
variant: 'xl', | ||
style: _styles._xl, | ||
}, | ||
], | ||
variants | ||
)} | ||
> | ||
<Text | ||
{...{ | ||
style: [_styles._default3], | ||
}} | ||
> | ||
Press me | ||
</Text> | ||
</Pressable> | ||
</SafeAreaView> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import styled from '../../../../build/module/macro'; | ||
|
||
console.log(styled(['bg-white', 'selectable'])); |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { StyleSheet as _StyleSheet } from 'react-native'; | ||
|
||
const _styles = _StyleSheet.create({ | ||
_default: { | ||
backgroundColor: 'white', | ||
}, | ||
}); | ||
|
||
console.log({ | ||
selectable: true, | ||
style: [_styles._default], | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import styled from '../../../../build/module/macro'; | ||
|
||
const bgWhite = 'bg-white'; | ||
|
||
const buttonStyle = [bgWhite, 'text-black']; | ||
const inputStyle = [bgWhite, 'text-black']; | ||
|
||
console.log(styled(buttonStyle)); | ||
console.log(styled(inputStyle)); |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { StyleSheet as _StyleSheet } from 'react-native'; | ||
|
||
const _styles = _StyleSheet.create({ | ||
_default: { | ||
backgroundColor: 'white', | ||
color: 'black', | ||
}, | ||
_default2: { | ||
backgroundColor: 'white', | ||
color: 'black', | ||
}, | ||
}); | ||
|
||
const bgWhite = 'bg-white'; | ||
const buttonStyle = [bgWhite, 'text-black']; | ||
const inputStyle = [bgWhite, 'text-black']; | ||
console.log({ | ||
style: [_styles._default], | ||
}); | ||
console.log({ | ||
style: [_styles._default2], | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import styled from '../../../../build/module/macro'; | ||
|
||
console.log( | ||
styled( | ||
['bg-white', 'selectable', 'web:not-selectable', 'dark:bg-black'], | ||
{ | ||
dark: false, | ||
} | ||
) | ||
); |
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { StyleSheet as _StyleSheet } from 'react-native'; | ||
import { select as _select } from 'react-native-styled.macro/build/module/utils/select'; | ||
|
||
const _styles = _StyleSheet.create({ | ||
_default: { | ||
backgroundColor: 'white', | ||
}, | ||
_web: undefined, | ||
_dark: { | ||
backgroundColor: 'black', | ||
}, | ||
}); | ||
|
||
console.log( | ||
_select( | ||
[ | ||
{ | ||
variant: 'default', | ||
selectable: true, | ||
style: _styles._default, | ||
}, | ||
{ | ||
variant: 'web', | ||
selectable: false, | ||
style: _styles._web, | ||
}, | ||
{ | ||
variant: 'dark', | ||
style: _styles._dark, | ||
}, | ||
], | ||
{ | ||
dark: false, | ||
} | ||
) | ||
); |
Oops, something went wrong.