/** * Basic [iOS] Example for react-native-blur * https://github.com/react-native-community/react-native-blur */ import React, {Component} from 'react' import { AppRegistry, StyleSheet, Text, Image, View, SegmentedControlIOS, Switch } from 'react-native' import {BlurView, VibrancyView} from 'react-native-blur' class Basic extends Component { constructor() { super() this.state = { showBlurs: true, blurBlurType: 'light', blurActiveSegment: 1, vibrancyBlurType: 'dark', vibrancyActiveSegment: 2, } } _onBlurChange(event) { this.setState({blurActiveSegment: event.nativeEvent.selectedSegmentIndex}) } _onBlurValueChange(value) { this.setState({blurBlurType: value}) } _onVibrancyChange(event) { this.setState({vibrancyActiveSegment: event.nativeEvent.selectedSegmentIndex}) } _onVibrancyValueChange(value) { this.setState({vibrancyBlurType: value}) } render() { return ( {(this.state.showBlurs ? {`Blur component`} {this._onBlurChange(event)}} onValueChange={(value) => {this._onBlurValueChange(value)}} tintColor={this.state.blurBlurType == 'xlight' ? 'black' : 'white'}/> {`Vibrancy component`} {this._onVibrancyChange(event)}} onValueChange={(value) => {this._onVibrancyValueChange(value)}} tintColor={this.state.vibrancyBlurType == 'xlight' ? 'black' : 'white'}/> : null )} this.setState({showBlurs: value})} value={this.state.showBlurs} /> ); } } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'stretch', backgroundColor: 'transparent', }, blurContainer: { paddingHorizontal: 20, }, img: { position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, height: null, width: null, }, welcome: { fontSize: 20, fontWeight: 'bold', textAlign: 'center', margin: 10, color: 'white', }, blurToggle: { position: 'absolute', top: 30, right: 10, alignItems: 'flex-end', } }); AppRegistry.registerComponent('Basic', () => Basic);