react-feather icon indicating copy to clipboard operation
react-feather copied to clipboard

Universal Support

Open du5rte opened this issue 4 years ago • 4 comments

Added svgs to support both react and react-native.

The svgs module is compatibility layer between react-native-svg and regular react (browser) based SVG elements. This allows you to write SVG in the react and react-native using exactly the same API. Bringing your applications a step closer to writing fully isomorphic application.

Screenshot 2020-05-26 at 22 16 41

fixes:

  • #15
  • #42
  • #47

Stays the same for users

Nothing changes in how users use the library. Behind the scenes svgs detects if the environment is run for web or native.

How svgs works

On web, most components are just renamed to conform with react-native-svg exports, here:

function ClipPath(props) {
  return <clipPath { ...prepare(props) } />;
}

on native, it exports react-native-svg, here:

import RNSvg, {
  ClipPath,
  ...
} from 'react-native-svg';

export {
  ClipPath,
  ...
};

export default Svg;

du5rte avatar May 26 '20 21:05 du5rte

This is working perfectly on react-native. Can someone review and merge? Thank you btw, saved my day.

rafaelbpa avatar Jul 27 '20 20:07 rafaelbpa

How's the state of this getting merged?

dunklesToast avatar Nov 23 '20 20:11 dunklesToast

Just stumbled across this, sounds promising - any update on the merge conflict in package.json?

kkelley-leftbrain avatar Apr 21 '21 01:04 kkelley-leftbrain

time goes fast - do it 🗡️

FDiskas avatar Jun 22 '21 18:06 FDiskas