import {
Artboard,
Document,
Page,
View,
ViewProps,
Text,
StyleSheet,
TextStyles,
Svg,
render,
renderToJSON,
Platform,
} from 'react-sketchapp';
import Circle from 'react-sketchapp/lib/components/Svg/Circle';
import Path from 'react-sketchapp/lib/components/Svg/Path';
import Rect from 'react-sketchapp/lib/components/Svg/Rect';
// the styles object should be a mapped typed mapping the keys of the object literal to numbers
const styles = StyleSheet.create({
red: {
backgroundColor: '#FF0000',
},
flexRow: {
flexDirection: 'row',
},
});
// style references are numbers
const styleReference = styles.red;
// Create a blue block
const BlueBlock = (props: ViewProps) => {
const { name = "some blue block", style, ...otherProps } = props;
return (
Blue
);
};
// An Artboard
const SketchArtboard = () => (
text must be a string
);
// A Page containing multiple Artboards
const SketchPage = () => (
);
// The Document containing a page
const SketchDocument = () => (
);
render();
renderToJSON();
// Artboard is typed with a class so the prototype should be typed too (not very useful though)
Artboard.prototype.componentDidMount;
// TODO: currently this interface returns any but it looks like this method produces a side-effect
// and the return type isn't used anyway
TextStyles.create(context as any, {
normal: {
fontSize: 16,
},
heading: {
fontSize: 16 * 1.618,
fontWeight: 'bold',
},
});
const shouldBeSketch = Platform.OS;
const shouldBe1 = Platform.Version;
const svg = () => (
);
const secondSvg = () => (
);