Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

3 changes: 0 additions & 3 deletions .eslintrc.js

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions example/.gitignore → apps/example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ node_modules/

# Expo
.expo/
.build/
dist/
web-build/

Expand Down Expand Up @@ -35,3 +36,4 @@ yarn-error.*
*.tsbuildinfo

app/playground/
components/Screen2.tsx
16 changes: 14 additions & 2 deletions example/app.json → apps/example/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"version": "1.0.0",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"newArchEnabled": true,
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
Expand All @@ -15,7 +16,10 @@
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.anonymous.stacks"
"bundleIdentifier": "com.anonymous.stacks",
"infoPlist": {
"ITSAppUsesNonExemptEncryption": false
}
},
"android": {
"adaptiveIcon": {
Expand All @@ -30,6 +34,14 @@
"plugins": [
"expo-router"
],
"scheme": "stacks"
"scheme": "stacks",
"extra": {
"router": {
"origin": false
},
"eas": {
"projectId": "6c5fdf69-115c-4880-99f1-880467bece9b"
}
}
}
}
4 changes: 2 additions & 2 deletions example/app/_layout.tsx → apps/example/app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable import/no-default-export */
import { Stack } from 'expo-router';
import * as React from 'react';

import './styles/unistyles';
import { Stack } from 'expo-router';

const Layout = () => {
return <Stack screenOptions={{ headerShown: false }} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import * as React from 'react';

import { Bleed, Stack } from '@grapp/stacks';

import { Placeholder } from '../components/Placeholder';
import { Screen } from '../components/Screen';
import { Placeholder } from '../../components/Placeholder';
import { Screen } from '../../components/Screen';

const Page = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,27 @@
import * as React from 'react';

/* eslint-disable import/no-default-export */
import { Column, Columns, Hidden, Stack } from '@grapp/stacks';
import { Box, Column, Columns, Hidden, Stack } from '@grapp/stacks';

import { Placeholder } from '../components/Placeholder';
import { Screen } from '../components/Screen';
import { Placeholder } from '../../components/Placeholder';
import { Screen } from '../../components/Screen';

const Page = () => {
return (
<Screen space={8} paddingX={4}>
<Screen.ScrollView>
<Stack space={8}>
<Stack space={2}>
<Columns
space={2}
backgroundColor="yellow"
borderRadius={10}
borderWidth={1}
borderColor="green"
>
<Column flex="1/2">
<Placeholder label="1/2" backgroundColor="transparent" />
</Column>
<Column flex="1/2">
<Placeholder label="1/2" backgroundColor="transparent" />
</Column>
</Columns>
<Stack space={2} marginTop={1}>
<Box backgroundColor="yellow" outlineColor="red" outlineWidth={1} outlineStyle="solid">
<Columns space={2}>
<Column flex="1/2">
<Placeholder label="1/2" backgroundColor="transparent" />
</Column>
<Column flex="1/2">
<Placeholder label="1/2" backgroundColor="transparent" />
</Column>
</Columns>
</Box>

<Columns space={2}>
<Column flex="1/4">
Expand Down Expand Up @@ -77,8 +73,10 @@ const Page = () => {
</Columns>

<Columns space={2}>
<Column flex="1/4" backgroundColor="red" borderWidth={1}>
<Placeholder label="1/4" backgroundColor="transparent" />
<Column flex="1/4">
<Box backgroundColor="red" outlineColor="green" outlineWidth={1} outlineOffset={-2}>
<Placeholder label="1/4" backgroundColor="transparent" />
</Box>
</Column>
<Column flex="3/4">
<Placeholder label="3/4" />
Expand Down Expand Up @@ -121,7 +119,7 @@ const Page = () => {
<Columns space={2}>
<Placeholder label="1" />
<Hidden below="tablet">
<Placeholder label="2" />
<Placeholder label="2, hidden" />
</Hidden>
<Placeholder label="3" />
</Columns>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import * as React from 'react';
/* eslint-disable import/no-default-export */
import { FloatBox } from '@grapp/stacks';

import { Placeholder } from '../components/Placeholder';
import { Screen } from '../components/Screen';
import { Placeholder } from '../../components/Placeholder';
import { Screen } from '../../components/Screen';

const Page = () => {
return (
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions example/app/index.tsx → apps/example/app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/* eslint-disable react-native/no-raw-text */

/* eslint-disable import/no-default-export */
import { createStyleSheet, useStyles } from 'react-native-unistyles';

import { Stack } from '@grapp/stacks';
import * as React from 'react';
import { StyleSheet } from 'react-native-unistyles';

import { Link } from 'expo-router';

import { Screen } from './components/Screen';
import { Stack } from '@grapp/stacks';

import { Screen } from '../components/Screen';

const Page = () => {
const { styles } = useStyles(stylesheet);
return (
<Screen space={4} paddingX={4}>
<Screen.ScrollView>
Expand Down Expand Up @@ -51,7 +51,7 @@ const Page = () => {
);
};

const stylesheet = createStyleSheet({
const styles = StyleSheet.create({
link: {
color: '#0B0F1A',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import * as React from 'react';
/* eslint-disable import/no-default-export */
import { Inline, Stack } from '@grapp/stacks';

import { Placeholder } from '../components/Placeholder';
import { Screen } from '../components/Screen';
import { Placeholder } from '../../components/Placeholder';
import { Screen } from '../../components/Screen';

const Page = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import * as React from 'react';
/* eslint-disable import/no-default-export */
import { Inset, Stack } from '@grapp/stacks';

import { Placeholder } from '../components/Placeholder';
import { Screen } from '../components/Screen';
import { Placeholder } from '../../components/Placeholder';
import { Screen } from '../../components/Screen';

const Page = () => {
return (
<Screen space={8} paddingX={4}>
<Screen paddingX={4}>
<Screen.ScrollView>
<Stack space={4}>
<Placeholder />
Expand Down Expand Up @@ -37,6 +37,9 @@ const Page = () => {
</Inset>
</Stack>
</Screen.ScrollView>
<Screen.Footer>
<Placeholder label="right = 4" />
</Screen.Footer>
</Screen>
);
};
Expand Down
36 changes: 36 additions & 0 deletions apps/example/app/rows/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* eslint-disable react-native/no-raw-text */
import * as React from 'react';
import { Hide, mq } from 'react-native-unistyles';

/* eslint-disable import/no-default-export */
import { Hidden, Row, Rows } from '@grapp/stacks';

import { Placeholder } from '../../components/Placeholder';

const Page = () => {
return (
<Rows space={4} defaultFlex="1/5" paddingX={4} paddingTop={14} paddingBottom={6}>
<Row>
<Placeholder flex="fluid" label="1" />
</Row>
<Row flex="fluid">
<Rows space={4}>
<Placeholder flex="fluid" label="2.1" />
<Row>
<Rows space={2} alignX="center">
<Placeholder flex="fluid" width={200} label="2.1.1" />
<Placeholder flex="fluid" width={280} label="2.1.2" />
<Placeholder flex="fluid" width={240} label="2.1.3" />
</Rows>
</Row>
<Placeholder flex="fluid" label="2.2" />
</Rows>
</Row>
<Row>
<Placeholder flex="fluid" label="3" />
</Row>
</Rows>
);
};

export default Page;
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import * as React from 'react';

/* eslint-disable import/no-default-export */
import { Stack } from '@grapp/stacks';
import { Box, Stack } from '@grapp/stacks';

import { Divider } from '../components/Divider';
import { Placeholder } from '../components/Placeholder';
import { Screen } from '../components/Screen';
import { Divider } from '../../components/Divider';
import { Placeholder } from '../../components/Placeholder';
import { Screen } from '../../components/Screen';

const Page = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import * as React from 'react';
/* eslint-disable import/no-default-export */
import { Tiles } from '@grapp/stacks';

import { Placeholder } from '../components/Placeholder';
import { Screen } from '../components/Screen';
import { Placeholder } from '../../components/Placeholder';
import { Screen } from '../../components/Screen';

const Page = () => {
return (
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
15 changes: 15 additions & 0 deletions apps/example/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = api => {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: [
require.resolve('../plugin'),
[
'react-native-unistyles/plugin',
{
autoProcessImports: ['@grapp/stacks'],
},
],
],
};
};
Binary file added apps/example/bun.lockb
Binary file not shown.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { Platform, Text } from 'react-native';
import { createStyleSheet, useStyles } from 'react-native-unistyles';
import { StyleSheet } from 'react-native-unistyles';

import { AxisX, AxisY, Box, Flex, FloatBox, Space } from '@grapp/stacks';

Expand All @@ -25,7 +25,6 @@ export const Placeholder = (props: Props) => {
label,
backgroundColor = '#1BCABE',
} = props;
const { styles } = useStyles(stylesheet);

const common = {
backgroundColor,
Expand Down Expand Up @@ -58,7 +57,7 @@ export const Placeholder = (props: Props) => {
);
};

const stylesheet = createStyleSheet({
const styles = StyleSheet.create({
root: {
borderColor: '#1D525640',
borderWidth: 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable react-native/no-color-literals */
import * as React from 'react';
import { Button, ScrollView as RNScrollView, ScrollViewProps } from 'react-native';
import { createStyleSheet, UnistylesRuntime, useStyles } from 'react-native-unistyles';
import { StyleSheet, UnistylesRuntime } from 'react-native-unistyles';

import {
Box,
Expand Down Expand Up @@ -81,16 +81,20 @@ export const Screen = (props: ScreenProps) => {
);
};

const Content = Row.from<Props>(props => {
const Content = Row.from((props: Props) => {
const { paddingX } = useScreen();
return <Box paddingX={paddingX} {...props} />;
});

const ScrollView = Row.from<Props & ScrollViewProps>(props => {
const Footer = Row.from((props: Props) => {
const { children } = props;
return <Content flex="content">{children}</Content>;
});

const ScrollView = Row.from((props: Props & ScrollViewProps) => {
const { children, contentContainerStyle, flex = 'fluid', horizontal } = props;
const { paddingX } = useScreen();
const { multiply } = useSpacingHelpers();
const { styles } = useStyles(stylesheet);

return (
<Box flex={flex}>
Expand All @@ -108,11 +112,12 @@ const ScrollView = Row.from<Props & ScrollViewProps>(props => {
);
});

const stylesheet = createStyleSheet({
const styles = StyleSheet.create({
scrollContainer: {
flexGrow: 1,
},
});

Screen.Content = Content;
Screen.ScrollView = ScrollView;
Screen.Footer = Footer;
16 changes: 16 additions & 0 deletions apps/example/eas.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"cli": {
"version": ">= 14.7.1",
"appVersionSource": "remote"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal",
"ios": {
"simulator": true
}
}
}
}

3 changes: 3 additions & 0 deletions apps/example/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import 'expo-router/entry';

import './styles/unistyles';
Loading
Loading