react-figma

⚛️ A React renderer for Figma

MIT License

Downloads
6.2K
Stars
2.4K
Committers
30

Bot releases are hidden (Show)

react-figma - Add support for Page backgrounds Latest Release

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>
react-figma - Add useStyleByKey hook

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
                    }}
                />
            );
        };
react-figma - Support blur effect style

Published by ilyalesik over 2 years ago

Added useEffectStyle new props

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
react-figma - Add useEffectStyle

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
react-figma - Hyperlink & onNodeId supporting

Published by ilyalesik over 3 years ago

  • Text component got hyperlink prop supporting.
  • All components over Figma Nodes go 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>                                                                                
react-figma - Multiple shadows supporting

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 
    }]
  }}
/>
react-figma - Detaching instances supporting

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!

react-figma - Publishable Props supporting

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

react-figma - Implement (RN) Animated module stub

Published by ilyalesik over 3 years ago

react-figma - Implement (React Native) NativeModules support

Published by ilyalesik over 3 years ago

react-figma - Add I18nManager stub implementation

Published by ilyalesik over 3 years ago

react-figma - Add Easing implementation

Published by ilyalesik over 3 years ago

React Native Easing

react-figma - Add StatusBar stub implementation

Published by ilyalesik over 3 years ago

RN

react-figma - Added a stub implementation of Dimensions, useWindowDimensions from react-native

Published by ilyalesik over 3 years ago

React Native docs:

react-figma - Support Frame props on Component

Published by ilyalesik over 3 years ago

#384

react-figma - TextStyle, PaintStyle supporting

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>
    );
};                                                                                    
react-figma - Web defaults mode

Published by ilyalesik almost 4 years ago

#377

react-figma - Implement text styles inheritance

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' })
react-figma - Fix images importing bug (with .default)

Published by ilyalesik almost 4 years ago

#369

react-figma - Fix Group renders with duplicates and console errors

Published by ilyalesik almost 4 years ago

#367

Package Rankings
Top 2.31% on Npmjs.org
Top 6.66% on Proxy.golang.org
Badges
Extracted from project README's
npm version CircleCI