/** * Copyright (c) 2015-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format * @flow */ 'use strict'; const React = require('react'); const RNTesterBlock = require('RNTesterBlock'); const RNTesterPage = require('RNTesterPage'); const { Animated, Image, MaskedViewIOS, StyleSheet, Text, View, } = require('react-native'); class MaskedViewExample extends React.Component<{}, $FlowFixMeState> { static title = ''; static description = 'Renders the child view with a mask specified in the `renderMask` prop.'; state = { alternateChildren: true, }; _maskRotateAnimatedValue = new Animated.Value(0); _maskScaleAnimatedValue = new Animated.Value(1); componentDidMount() { setInterval(() => { this.setState(state => ({ alternateChildren: !state.alternateChildren, })); }, 1000); Animated.loop( Animated.sequence([ Animated.timing(this._maskScaleAnimatedValue, { toValue: 1.3, timing: 750, useNativeDriver: true, }), Animated.timing(this._maskScaleAnimatedValue, { toValue: 1, timing: 750, useNativeDriver: true, }), ]), ).start(); Animated.loop( Animated.timing(this._maskRotateAnimatedValue, { toValue: 360, timing: 2000, useNativeDriver: true, }), ).start(); } render() { return ( Basic Mask }> }> Basic Mask }> Basic Mask }> {this.state.alternateChildren ? [ , , ] : null} ); } } const styles = StyleSheet.create({ maskContainerStyle: { flex: 1, backgroundColor: 'transparent', justifyContent: 'center', alignItems: 'center', }, maskTextStyle: { backgroundColor: 'transparent', fontSize: 40, fontWeight: 'bold', }, }); module.exports = MaskedViewExample;