Skip to content

Instantly share code, notes, and snippets.

@longsangstan
Created February 24, 2018 09:45
Show Gist options
  • Save longsangstan/03c3f0e833ed2eb75c349f64dc002700 to your computer and use it in GitHub Desktop.
Save longsangstan/03c3f0e833ed2eb75c349f64dc002700 to your computer and use it in GitHub Desktop.
import { MaskedViewIOS, View } from "react-native";
import LinearGradient from "react-native-linear-gradient";
// ...
const MaskedView = Platform.OS == "ios" ? MaskedViewIOS : View;
render = () => {
return (
<MaskedView
style={styles.outputView}
maskElement={
<LinearGradient
locations={[0, 0.1, 0.9, 1]}
colors={[
"transparent",
"black",
"black",
"transparent"
]}
style={styles.outputView}
/>
}
>
<ScrollView
style={styles.outputView}
/>
</MaskedView>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment