@@ -12,21 +12,122 @@ import type {RNTesterModuleExample} from '../../types/RNTesterTypes';
1212
1313import RNTesterText from '../../components/RNTesterText' ;
1414import * as React from 'react' ;
15- import { StyleSheet , View } from 'react-native' ;
15+ import { Image , StyleSheet , View , Text } from 'react-native' ;
1616
17+ function BackgroundImageBox ( {
18+ style,
19+ children,
20+ testID,
21+ } : {
22+ style ?: ViewStyleProp ,
23+ children ?: React . Node ,
24+ testID : string ,
25+ } ) {
26+ return (
27+ < View style = { [ styles . box , style ] } testID = { testID } >
28+ { children }
29+ </ View >
30+ ) ;
31+ }
32+
33+ const SIZE = 100 ;
34+ const URL = 'https://static.thenounproject.com/png/432965-200.png' ;
35+ const REPEAT = 'https://reactnative.dev/img/tiny_logo.png' ;
36+ const ACCENT = '#4ecdc4' ;
1737function Playground ( ) {
1838 return (
19- < View style = { styles . container } >
20- < RNTesterText >
21- Edit "RNTesterPlayground.js" to change this file
39+ < View style = { styles . row } >
40+ { /* <View style={styles.col}> */ }
41+ < RNTesterText
42+ style = { [
43+ styles . text ,
44+ { fontWeight : 'bold' , width : '100%' , textAlign : 'center' } ,
45+ ] } >
46+ linear-gradient(...)
2247 </ RNTesterText >
48+ < View
49+ style = { [
50+ styles . box ,
51+ {
52+ backgroundColor : ACCENT ,
53+ } ,
54+ ] }
55+ />
56+ < RNTesterText style = { styles . text } > →</ RNTesterText >
57+ < View
58+ style = { [
59+ styles . box ,
60+ {
61+ experimental_backgroundImage :
62+ 'linear-gradient(115deg, black 10%, transparent 30% 70%, black 90%)' ,
63+ } ,
64+ ] }
65+ />
66+ < RNTesterText style = { styles . text } > →</ RNTesterText >
67+ < View
68+ style = { [
69+ styles . box ,
70+ {
71+ backgroundColor : ACCENT ,
72+ maskImage :
73+ 'linear-gradient(115deg, black 10%, transparent 30% 70%, black 90%)' ,
74+ // maskRepeat: 'no-repeat',
75+ } ,
76+ ] }
77+ />
78+ < RNTesterText
79+ style = { [
80+ styles . text ,
81+ { fontWeight : 'bold' , width : '100%' , textAlign : 'center' } ,
82+ ] } >
83+ url(mask.png)
84+ </ RNTesterText >
85+ < View
86+ style = { [
87+ styles . box ,
88+ {
89+ backgroundColor : ACCENT ,
90+ } ,
91+ ] }
92+ />
93+ < RNTesterText style = { styles . text } > →</ RNTesterText >
94+ < Image source = { [ { uri : URL } ] } style = { styles . box } />
95+ < RNTesterText style = { styles . text } > →</ RNTesterText >
96+ < View
97+ style = { [
98+ styles . box ,
99+ {
100+ backgroundColor : ACCENT ,
101+ maskImage :
102+ 'url(https://static.thenounproject.com/png/432965-200.png)' ,
103+ maskRepeat : 'no-repeat' ,
104+ } ,
105+ ] }
106+ />
107+ { /* </View> */ }
23108 </ View >
24109 ) ;
25110}
26111
27112const styles = StyleSheet . create ( {
28- container : {
29- padding : 10 ,
113+ box : {
114+ width : SIZE ,
115+ height : SIZE ,
116+ justifyContent : 'center' ,
117+ alignItems : 'center' ,
118+ marginVertical : 10 ,
119+ } ,
120+ text : {
121+ fontSize : 24 ,
122+ } ,
123+ row : {
124+ flexDirection : 'row' ,
125+ flexWrap : 'wrap' ,
126+ justifyContent : 'space-evenly' ,
127+ alignItems : 'center' ,
128+ } ,
129+ col : {
130+ alignItems : 'center' ,
30131 } ,
31132} ) ;
32133
0 commit comments