@@ -38,17 +38,86 @@ ForeignObjectExample.title = 'ForeignObject with centered Text';
3838
3939function ForeignObjectWithView ( ) {
4040 return (
41- < Svg height = "300" width = "300" style = { { backgroundColor : 'lightgray' } } >
42- < ForeignObject width = { 300 } height = { 300 } >
41+ < Svg
42+ height = "300"
43+ width = "300"
44+ style = { { backgroundColor : 'lightgray' } }
45+ viewBox = "0 0 400 400" >
46+ < ForeignObject x = { 50 } y = { 50 } width = { 300 } height = { 300 } >
47+ < View style = { { width : '100%' , height : '100%' , backgroundColor : 'blue' } } >
48+ < View
49+ style = { {
50+ width : '50%' ,
51+ height : '50%' ,
52+ backgroundColor : 'red' ,
53+ } }
54+ />
55+ </ View >
56+ </ ForeignObject >
57+ < ForeignObject x = { 150 } y = { 150 } width = { 100 } height = { 100 } >
4358 < View
44- style = { { width : '100%' , height : '100%' , backgroundColor : 'blue' } }
45- />
59+ style = { { width : '100%' , height : '100%' , backgroundColor : 'red' } }
60+ collapsable = { false } >
61+ < View
62+ style = { {
63+ width : '50%' ,
64+ height : '50%' ,
65+ backgroundColor : 'blue' ,
66+ } }
67+ />
68+ </ View >
4669 </ ForeignObject >
4770 </ Svg >
4871 ) ;
4972}
5073ForeignObjectWithView . title = 'ForeignObject with full size View' ;
5174
75+ function ForeignObjectWithBigView ( ) {
76+ return (
77+ < Svg
78+ height = "300"
79+ width = "300"
80+ style = { { backgroundColor : 'lightgray' } }
81+ viewBox = "0 0 600 600" >
82+ < ForeignObject width = { 600 } height = { 600 } >
83+ < View style = { { width : 600 , height : 600 , backgroundColor : 'blue' } } >
84+ < View
85+ style = { {
86+ width : 300 ,
87+ height : 300 ,
88+ backgroundColor : 'red' ,
89+ } }
90+ />
91+ </ View >
92+ </ ForeignObject >
93+ </ Svg >
94+ ) ;
95+ }
96+ ForeignObjectWithBigView . title = 'ForeignObject with big View' ;
97+
98+ function ForeignObjectWithFlexView ( ) {
99+ return (
100+ < Svg
101+ height = "300"
102+ width = "300"
103+ style = { { backgroundColor : 'lightgray' } }
104+ viewBox = "0 0 600 600" >
105+ < ForeignObject width = { 600 } height = { 600 } >
106+ < View
107+ style = { {
108+ width : '100%' ,
109+ height : '100%' ,
110+ backgroundColor : 'blue' ,
111+ flexDirection : 'row' ,
112+ } } >
113+ < View style = { { flex : 1 / 2 , backgroundColor : 'red' } } />
114+ </ View >
115+ </ ForeignObject >
116+ </ Svg >
117+ ) ;
118+ }
119+ ForeignObjectWithFlexView . title = 'ForeignObject with flex View' ;
120+
52121const styles = StyleSheet . create ( {
53122 iconContainer : {
54123 width : 15 ,
@@ -75,6 +144,11 @@ const icon = (
75144 </ ForeignObject >
76145 </ Svg >
77146) ;
78- const samples = [ ForeignObjectExample , ForeignObjectWithView ] ;
147+ const samples = [
148+ ForeignObjectExample ,
149+ ForeignObjectWithView ,
150+ ForeignObjectWithBigView ,
151+ ForeignObjectWithFlexView ,
152+ ] ;
79153
80154export { icon , samples } ;
0 commit comments