Skip to content

Commit 9ed118a

Browse files
chore: use built-in linear-gradient() in example
1 parent 79fde8f commit 9ed118a

File tree

3 files changed

+6
-28
lines changed

3 files changed

+6
-28
lines changed

example/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"@expo/metro-runtime": "~4.0.0",
1313
"@react-native-masked-view/masked-view": "0.3.2",
1414
"expo": "~52.0.25",
15-
"expo-linear-gradient": "~14.0.2",
1615
"expo-status-bar": "~2.0.1",
1716
"react": "18.3.1",
1817
"react-dom": "18.3.1",

example/src/App.tsx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
} from 'react-native-css-animations';
88

99
import { Platform, SafeAreaView, StyleSheet, Text, View } from 'react-native';
10-
import { LinearGradient } from 'expo-linear-gradient';
1110
import Animated from 'react-native-reanimated';
1211
import Fontisto from '@expo/vector-icons/Fontisto';
1312
import Entypo from '@expo/vector-icons/Entypo';
@@ -60,15 +59,7 @@ export default function App() {
6059
}
6160
>
6261
{/* Shimmer animation ⬇️ */}
63-
<Animated.View style={[styles.gradientContainer, shimmer]}>
64-
<LinearGradient
65-
colors={['#e2e8f0', '#f8fafc', '#e2e8f0']}
66-
locations={[0.46, 0.5, 0.54]}
67-
start={{ x: 0, y: -5 }}
68-
end={{ x: 1, y: 5 }}
69-
style={styles.gradient}
70-
/>
71-
</Animated.View>
62+
<Animated.View style={[styles.gradient, shimmer]} />
7263
</MaskedView>
7364
</View>
7465
</>
@@ -164,13 +155,13 @@ const styles = StyleSheet.create({
164155
height: 48,
165156
width: 210,
166157
},
167-
gradientContainer: {
158+
gradient: {
168159
flex: 1,
169160
width: '300%',
170161
marginHorizontal: '-100%',
171-
},
172-
gradient: {
173-
flex: 1,
174-
width: '100%',
162+
[process.env.EXPO_OS === 'web'
163+
? 'backgroundImage'
164+
: 'experimental_backgroundImage']:
165+
'linear-gradient(100deg, #e2e8f0 46%, #f8fafc 50%, #e2e8f0 54%)',
175166
},
176167
});

yarn.lock

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6542,17 +6542,6 @@ __metadata:
65426542
languageName: node
65436543
linkType: hard
65446544

6545-
"expo-linear-gradient@npm:~14.0.2":
6546-
version: 14.0.2
6547-
resolution: "expo-linear-gradient@npm:14.0.2"
6548-
peerDependencies:
6549-
expo: "*"
6550-
react: "*"
6551-
react-native: "*"
6552-
checksum: 3f318f50fae44b1f2f90becf421a1c7c0c2822e0a381031fa6d893899173b7ecc6f0c4eddde699e6825fd091d5576cf5960ba81046aeaf0300f44de1147bb543
6553-
languageName: node
6554-
linkType: hard
6555-
65566545
"expo-modules-autolinking@npm:2.0.7":
65576546
version: 2.0.7
65586547
resolution: "expo-modules-autolinking@npm:2.0.7"
@@ -11753,7 +11742,6 @@ __metadata:
1175311742
"@expo/metro-runtime": ~4.0.0
1175411743
"@react-native-masked-view/masked-view": 0.3.2
1175511744
expo: ~52.0.25
11756-
expo-linear-gradient: ~14.0.2
1175711745
expo-status-bar: ~2.0.1
1175811746
react: 18.3.1
1175911747
react-dom: 18.3.1

0 commit comments

Comments
 (0)