Bot releases are hidden (Show)
Published by ilyalesik over 2 years ago
An example:
<Page name="New page" style={{ backgroundColor: '#ff0000' }}>
<View>
<View style={{ width: 200, height: 100, backgroundColor: '#ffffff' }} />
</View>
</Page>
Published by ilyalesik over 2 years ago
Add useStyleByKey hook which allows one to pass in specific textStyleId, fillStyleId, etc.
const ViewComponent = () => {
const fillStyle = useStyleByKey('testStyleId');
return (
<View
style={{
fillStyleId: fillStyle && fillStyle.id
}}
/>
);
};
const TextComponent = () => {
const textStyle = useStyleByKey('testStyleId');
return (
<Text
style={{
textStyleId: textStyle && textStyle.id
}}
/>
);
};
Published by ilyalesik over 2 years ago
Args | Type | Default | Note |
---|---|---|---|
style.blurType |
LAYER_BLUR or BACKGROUND_BLUR |
LAYER_BLUR |
Type of blur effect |
style.blurRadius |
number |
0 |
Blur radius. Must be >= 0 |
Published by ilyalesik over 2 years ago
The useEffectStyle
hook creates (or updates) EffectStyle
and returns an object that contains effectStyleId
and can be consumed in style
prop.
Args | Type | Default | Note |
---|---|---|---|
style |
Style Object |
The style will applied to a local style |
|
style.shadowType |
DROP_SHADOW or INNER_SHADOW
|
DROP_SHADOW |
Type of shadow effect |
style.shadowSpread |
number |
0 |
Shadow expansion distance |
params |
Object |
||
params.id |
String |
A style id | |
params.name |
String |
A style name | |
params.description |
String |
A style description |
Published by ilyalesik over 3 years ago
Text
component got hyperlink prop supporting.onNodeId
callback supporting. onNodeId
returns Figma Node ID.An example:
<View>
<Text
style={{ color: '#308eff', marginBottom: 50 }}
hyperlink={{
type: 'URL',
value: 'https://react-figma.dev/'
}}>
React Figma website
</Text>
{nodeId && (
<Text
style={{ color: '#308eff', marginBottom: 50 }}
hyperlink={{
type: 'NODE',
value: nodeId
}}>
Rectangle link
</Text>
)}
<View onNodeId={setNodeId}>
<View style={{ width: 200, height: 100, backgroundColor: '#dd55aa' }} />
</View>
</View>
Published by ilyalesik over 3 years ago
Example:
<View
style={{
shadows: [{
shadowColor: 'rgba(0, 0, 0, 0.2)', shadowRadius: 1
}, {
shadowColor: 'rgba(0, 0, 0, 0.3)', shadowRadius: 2
}]
}}
/>
Published by ilyalesik over 3 years ago
A new prop has added in the Instance component:
detach: boolean;
When detach=true
an instance detached through detachInstance method.
Thanks, @n0ruSh!
Published by ilyalesik over 3 years ago
Component
and ComponentSet
got publishable props supporting:
Prop | Type | Default | Note |
---|---|---|---|
description |
String |
'' |
The annotation entered by the user for this component |
documentationLinks |
ReadonlyArray<DocumentationLink> |
[] |
The documentation links for this component |
Introduced in the Figma API Version 1, Update 23
Published by ilyalesik over 3 years ago
Published by ilyalesik over 3 years ago
Published by ilyalesik over 3 years ago
Published by ilyalesik over 3 years ago
React Native Easing
Published by ilyalesik over 3 years ago
Published by ilyalesik over 3 years ago
React Native docs:
Published by ilyalesik over 3 years ago
#384
Published by ilyalesik over 3 years ago
Demo:
Code example:
import * as React from 'react';
import { Page, View, Text, StyleSheet, useFillPaintStyle, useStrokePaintStyle, useTextStyle } from 'react-figma';
const styles = StyleSheet.create({
root: {
backgroundColor: '#76ff1c',
borderColor: '#ffffff',
borderWidth: 5
},
heading: {
fontFamily: 'Roboto',
fontWeight: 'bold',
fontSize: 24,
color: '#000000'
}
});
export const App = () => {
const rootFillStyle = useFillPaintStyle(styles.root, {
name: 'root/background'
});
const rootStrokeStyle = useStrokePaintStyle(styles.root, {
name: 'root/border'
});
const headingTextStyle = useTextStyle(styles.heading, {
name: 'heading'
});
return (
<Page name="New page" isCurrent>
<View>
<View style={{ width: 200, height: 100, ...styles.root, ...rootFillStyle, ...rootStrokeStyle }} />
<Text style={{ ...headingTextStyle }}>Local styles</Text>
</View>
</Page>
);
};
Published by ilyalesik almost 4 years ago
#377
Published by ilyalesik almost 4 years ago
The doc
It's possible to enable a CSS-like inheritance.
Available under the flag process.env.REACT_FIGMA_STYLE_INHERITANCE_ENABLED
.
An example:
<View style={{ fontSize: 50, fontWeight: 'bold', fontFamily: 'Roboto' }}>
<View style={{ fontSize: 48 }}>
<View style={{ width: 200, height: 100, backgroundColor: '#dd55aa' }} />
<Text style={{ color: '#ffffff' }}>text</Text>
</View>
</View>
The text got a combined style:
({fontWeight: 'bold', fontFamily: 'Roboto', fontSize: 48, color: '#ffffff' })
Published by ilyalesik almost 4 years ago
#369
Published by ilyalesik almost 4 years ago
#367