Skip to content

Commit de4fdbb

Browse files
committed
Fix opacity (float not size) + make children optional + remove duplicate vectorEffect value
1 parent 74e8ca2 commit de4fdbb

File tree

1 file changed

+20
-34
lines changed

1 file changed

+20
-34
lines changed

src/ReactNativeSvg.re

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
open ReactNative;
2-
open ReactNative.Style;
2+
3+
type size = Style.size;
34
type sizes = array(size);
45
type opacity = string;
56
external opacity: float => size = "%identity";
@@ -8,7 +9,7 @@ external opacity: float => size = "%identity";
89
module SvgXml = {
910
[@react.component] [@bs.module "react-native-svg"]
1011
external make:
11-
(~xml: string, ~width: size=?, ~height: size=?, ~style: t=?) =>
12+
(~xml: string, ~width: size=?, ~height: size=?, ~style: Style.t=?) =>
1213
React.element =
1314
"SvgXml";
1415
};
@@ -17,7 +18,7 @@ module SvgXml = {
1718
module SvgCss = {
1819
[@react.component] [@bs.module "react-native-svg"]
1920
external make:
20-
(~xml: string, ~width: size=?, ~height: size=?, ~style: t=?) =>
21+
(~xml: string, ~width: size=?, ~height: size=?, ~style: Style.t=?) =>
2122
React.element =
2223
"SvgCss";
2324
};
@@ -37,13 +38,13 @@ module Svg = {
3738
(
3839
~color: Color.t=?,
3940
~viewBox: string=?,
40-
~opacity: size=?,
41+
~opacity: float=?,
4142
~onLayout: unit => unit=?,
4243
~preserveAspectRatio: string=?,
43-
~style: t=?,
44+
~style: Style.t=?,
4445
~width: size=?,
4546
~height: size=?,
46-
~children: React.element,
47+
~children: React.element=?,
4748
// Commons Props
4849
~id: string=?,
4950
~fill: Color.t=?,
@@ -62,7 +63,6 @@ module Svg = {
6263
~transform: string=?,
6364
~vectorEffect: [@bs.string] [
6465
| `none
65-
| [@bs.as "non-scaling-stroke"] `nonScalingStroke
6666
| `nonScalingStroke
6767
| `default
6868
| [@bs.as "inherit"] `_inherit
@@ -90,7 +90,7 @@ module Rect = {
9090
~rx: size=?,
9191
~ry: size=?,
9292
~opacity: opacity=?,
93-
~children: React.element,
93+
~children: React.element=?,
9494
// Commons Props
9595
~id: string=?,
9696
~fill: Color.t=?,
@@ -109,7 +109,6 @@ module Rect = {
109109
~transform: string=?,
110110
~vectorEffect: [@bs.string] [
111111
| `none
112-
| [@bs.as "non-scaling-stroke"] `nonScalingStroke
113112
| `nonScalingStroke
114113
| `default
115114
| [@bs.as "inherit"] `_inherit
@@ -136,7 +135,7 @@ module Circle = {
136135
~cy: size=?,
137136
~r: size=?,
138137
~opacity: opacity=?,
139-
~children: React.element,
138+
~children: React.element=?,
140139
// Commons Props
141140
~id: string=?,
142141
~fill: Color.t=?,
@@ -155,7 +154,6 @@ module Circle = {
155154
~transform: string=?,
156155
~vectorEffect: [@bs.string] [
157156
| `none
158-
| [@bs.as "non-scaling-stroke"] `nonScalingStroke
159157
| `nonScalingStroke
160158
| `default
161159
| [@bs.as "inherit"] `_inherit
@@ -183,7 +181,7 @@ module Ellipse = {
183181
~rx: size=?,
184182
~ry: size=?,
185183
~opacity: opacity=?,
186-
~children: React.element,
184+
~children: React.element=?,
187185
// Commons Props
188186
~id: string=?,
189187
~fill: Color.t=?,
@@ -202,7 +200,6 @@ module Ellipse = {
202200
~transform: string=?,
203201
~vectorEffect: [@bs.string] [
204202
| `none
205-
| [@bs.as "non-scaling-stroke"] `nonScalingStroke
206203
| `nonScalingStroke
207204
| `default
208205
| [@bs.as "inherit"] `_inherit
@@ -230,7 +227,7 @@ module Line = {
230227
~x2: size=?,
231228
~y2: size=?,
232229
~opacity: opacity=?,
233-
~children: React.element,
230+
~children: React.element=?,
234231
// Commons Props
235232
~id: string=?,
236233
~fill: Color.t=?,
@@ -249,7 +246,6 @@ module Line = {
249246
~transform: string=?,
250247
~vectorEffect: [@bs.string] [
251248
| `none
252-
| [@bs.as "non-scaling-stroke"] `nonScalingStroke
253249
| `nonScalingStroke
254250
| `default
255251
| [@bs.as "inherit"] `_inherit
@@ -274,7 +270,7 @@ module Polygon = {
274270
(
275271
~points: string=?,
276272
~opacity: opacity=?,
277-
~children: React.element,
273+
~children: React.element=?,
278274
// Commons Props
279275
~id: string=?,
280276
~fill: Color.t=?,
@@ -293,7 +289,6 @@ module Polygon = {
293289
~transform: string=?,
294290
~vectorEffect: [@bs.string] [
295291
| `none
296-
| [@bs.as "non-scaling-stroke"] `nonScalingStroke
297292
| `nonScalingStroke
298293
| `default
299294
| [@bs.as "inherit"] `_inherit
@@ -318,7 +313,7 @@ module Polyline = {
318313
(
319314
~points: string=?,
320315
~opacity: opacity=?,
321-
~children: React.element,
316+
~children: React.element=?,
322317
// Commons Props
323318
~id: string=?,
324319
~fill: Color.t=?,
@@ -337,7 +332,6 @@ module Polyline = {
337332
~transform: string=?,
338333
~vectorEffect: [@bs.string] [
339334
| `none
340-
| [@bs.as "non-scaling-stroke"] `nonScalingStroke
341335
| `nonScalingStroke
342336
| `default
343337
| [@bs.as "inherit"] `_inherit
@@ -362,7 +356,7 @@ module Path = {
362356
(
363357
~d: string=?,
364358
~opacity: opacity=?,
365-
~children: React.element,
359+
~children: React.element=?,
366360
// Commons Props
367361
~id: string=?,
368362
~fill: Color.t=?,
@@ -381,7 +375,6 @@ module Path = {
381375
~transform: string=?,
382376
~vectorEffect: [@bs.string] [
383377
| `none
384-
| [@bs.as "non-scaling-stroke"] `nonScalingStroke
385378
| `nonScalingStroke
386379
| `default
387380
| [@bs.as "inherit"] `_inherit
@@ -409,7 +402,7 @@ module Text = {
409402
~rotate: size=?,
410403
~inlineSize: size=?,
411404
~opacity: opacity=?,
412-
~children: React.element,
405+
~children: React.element=?,
413406
// Text props
414407
~alignmentBaseline: [@bs.string] [
415408
| `baseline
@@ -504,7 +497,6 @@ module Text = {
504497
~transform: string=?,
505498
~vectorEffect: [@bs.string] [
506499
| `none
507-
| [@bs.as "non-scaling-stroke"] `nonScalingStroke
508500
| `nonScalingStroke
509501
| `default
510502
| [@bs.as "inherit"] `_inherit
@@ -533,7 +525,7 @@ module TextPath = {
533525
~method: [@bs.string] [ | `align | `stretch]=?,
534526
~spacing: [@bs.string] [ | `auto | `exact]=?,
535527
~midLine: [@bs.string] [ | `sharp | `smooth]=?,
536-
~children: React.element,
528+
~children: React.element=?,
537529
// Text props
538530
~alignmentBaseline: [@bs.string] [
539531
| `baseline
@@ -628,7 +620,6 @@ module TextPath = {
628620
~transform: string=?,
629621
~vectorEffect: [@bs.string] [
630622
| `none
631-
| [@bs.as "non-scaling-stroke"] `nonScalingStroke
632623
| `nonScalingStroke
633624
| `default
634625
| [@bs.as "inherit"] `_inherit
@@ -655,7 +646,7 @@ module Tspan = {
655646
~dy: string=?,
656647
~rotate: string=?,
657648
~inlineSize: size=?,
658-
~children: React.element,
649+
~children: React.element=?,
659650
// Font Props
660651
~fontStyle: [@bs.string] [ | `normal | `italic | `oblique]=?,
661652
~fontVariant: [@bs.string] [ | `normal | `smallcaps]=?,
@@ -724,7 +715,6 @@ module Tspan = {
724715
~transform: string=?,
725716
~vectorEffect: [@bs.string] [
726717
| `none
727-
| [@bs.as "non-scaling-stroke"] `nonScalingStroke
728718
| `nonScalingStroke
729719
| `default
730720
| [@bs.as "inherit"] `_inherit
@@ -752,7 +742,7 @@ module Use = {
752742
~width: size=?,
753743
~height: size=?,
754744
~opacity: opacity=?,
755-
~children: React.element,
745+
~children: React.element=?,
756746
// Commons Props
757747
~id: string=?,
758748
~fill: Color.t=?,
@@ -771,7 +761,6 @@ module Use = {
771761
~transform: string=?,
772762
~vectorEffect: [@bs.string] [
773763
| `none
774-
| [@bs.as "non-scaling-stroke"] `nonScalingStroke
775764
| `nonScalingStroke
776765
| `default
777766
| [@bs.as "inherit"] `_inherit
@@ -795,7 +784,7 @@ module G = {
795784
external make:
796785
(
797786
~opacity: opacity=?,
798-
~children: React.element,
787+
~children: React.element=?,
799788
// Commons Props
800789
~id: string=?,
801790
~fill: Color.t=?,
@@ -814,7 +803,6 @@ module G = {
814803
~transform: string=?,
815804
~vectorEffect: [@bs.string] [
816805
| `none
817-
| [@bs.as "non-scaling-stroke"] `nonScalingStroke
818806
| `nonScalingStroke
819807
| `default
820808
| [@bs.as "inherit"] `_inherit
@@ -861,7 +849,7 @@ module Image = {
861849
~height: size=?,
862850
~preserveAspectRatio: string=?,
863851
~opacity: opacity=?,
864-
~children: React.element,
852+
~children: React.element=?,
865853
// Commons Props
866854
~id: string=?,
867855
~fill: Color.t=?,
@@ -880,7 +868,6 @@ module Image = {
880868
~transform: string=?,
881869
~vectorEffect: [@bs.string] [
882870
| `none
883-
| [@bs.as "non-scaling-stroke"] `nonScalingStroke
884871
| `nonScalingStroke
885872
| `default
886873
| [@bs.as "inherit"] `_inherit
@@ -974,7 +961,6 @@ module Mask = {
974961
~transform: string=?,
975962
~vectorEffect: [@bs.string] [
976963
| `none
977-
| [@bs.as "non-scaling-stroke"] `nonScalingStroke
978964
| `nonScalingStroke
979965
| `default
980966
| [@bs.as "inherit"] `_inherit

0 commit comments

Comments
 (0)