diff --git a/packages/react-navigation/examples/NavigationPlayground/js/App.js b/packages/react-navigation/examples/NavigationPlayground/js/App.js index e21d89ff..7ee68abc 100644 --- a/packages/react-navigation/examples/NavigationPlayground/js/App.js +++ b/packages/react-navigation/examples/NavigationPlayground/js/App.js @@ -6,6 +6,8 @@ import { Constants, ScreenOrientation } from 'expo'; ScreenOrientation.allow(ScreenOrientation.Orientation.ALL); import { + Animated, + Image, Platform, ScrollView, StyleSheet, @@ -16,7 +18,6 @@ import { } from 'react-native'; import { SafeAreaView, StackNavigator } from 'react-navigation'; -import Banner from './Banner'; import CustomTabs from './CustomTabs'; import CustomTransitioner from './CustomTransitioner'; import Drawer from './Drawer'; @@ -141,41 +142,117 @@ const ExampleRoutes = { }, }; -class MainScreen extends React.Component<*> { +type State = { + scrollY: Animated.Value, +}; +class MainScreen extends React.Component { + state = { + scrollY: new Animated.Value(0), + }; + render() { const { navigation } = this.props; + const scale = this.state.scrollY.interpolate({ + inputRange: [-450, 0, 100], + outputRange: [2, 1, 0.8], + extrapolate: 'clamp', + }); + + const translateY = this.state.scrollY.interpolate({ + inputRange: [-450, 0, 100], + outputRange: [-150, 0, 40], + }); + + const opacity = this.state.scrollY.interpolate({ + inputRange: [0, 50], + outputRange: [1, 0], + extrapolate: 'clamp', + }); + + const backgroundScale = this.state.scrollY.interpolate({ + inputRange: [-450, 0], + outputRange: [3, 1], + extrapolate: 'clamp', + }); + + const backgroundTranslateY = this.state.scrollY.interpolate({ + inputRange: [-450, 0], + outputRange: [0, 0], + }); + return ( - - - {Object.keys(ExampleRoutes).map((routeName: string) => ( - { - const { path, params, screen } = ExampleRoutes[routeName]; - const { router } = screen; - const action = - path && router.getActionForPathAndParams(path, params); - navigation.navigate(routeName, {}, action); - }} + + + + - - - - {ExampleInfo[routeName].name} - - - {ExampleInfo[routeName].description} - - - - - ))} - + + + + React Navigation Examples + + + + + + + + {Object.keys(ExampleRoutes).map((routeName: string) => ( + { + const { path, params, screen } = ExampleRoutes[routeName]; + const { router } = screen; + const action = + path && router.getActionForPathAndParams(path, params); + navigation.navigate(routeName, {}, action); + }} + > + + + + {ExampleInfo[routeName].name} + + + {ExampleInfo[routeName].description} + + + + + ))} + + + @@ -238,4 +315,36 @@ const styles = StyleSheet.create({ fontSize: 13, color: '#999', }, + backgroundUnderlay: { + backgroundColor: '#673ab7', + position: 'absolute', + top: -100, + height: 300, + left: 0, + right: 0, + }, + bannerContainer: { + // backgroundColor: '#673ab7', + paddingTop: 20, + alignItems: 'center', + }, + banner: { + flexDirection: 'row', + alignItems: 'center', + padding: 16, + }, + bannerImage: { + width: 36, + height: 36, + resizeMode: 'contain', + tintColor: '#fff', + margin: 8, + }, + bannerTitle: { + fontSize: 18, + fontWeight: '200', + color: '#fff', + marginVertical: 8, + marginRight: 5, + }, }); diff --git a/packages/react-navigation/examples/NavigationPlayground/js/StacksWithKeys.js b/packages/react-navigation/examples/NavigationPlayground/js/StacksWithKeys.js index aeb85535..ccffc419 100644 --- a/packages/react-navigation/examples/NavigationPlayground/js/StacksWithKeys.js +++ b/packages/react-navigation/examples/NavigationPlayground/js/StacksWithKeys.js @@ -17,6 +17,10 @@ class HomeScreen extends React.Component { }) } /> +