/** * The examples provided by Facebook are for non-commercial testing and * evaluation purposes only. * * Facebook reserves all rights not expressly granted. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 'use strict'; var React = require('react-native'); var { NavigationExperimental, StyleSheet, ScrollView, } = React; var NavigationExampleRow = require('./NavigationExampleRow'); var { AnimatedView: NavigationAnimatedView, Card: NavigationCard, RootContainer: NavigationRootContainer, Reducer: NavigationReducer, Header: NavigationHeader, } = NavigationExperimental; const NavigationBasicReducer = NavigationReducer.StackReducer({ initialStates: [ {key: 'First Route'} ], matchAction: action => true, actionStateMap: actionString => ({key: actionString}), }); class NavigationAnimatedExample extends React.Component { componentWillMount() { this._renderNavigated = this._renderNavigated.bind(this); } render() { return ( { this.navRootContainer = navRootContainer; }} persistenceKey="NavigationAnimatedExampleState" renderNavigation={this._renderNavigated} /> ); } handleBackAction() { return ( this.navRootContainer && this.navRootContainer.handleNavigation(NavigationRootContainer.getBackAction()) ); } _renderNavigated(navigationState, onNavigate) { if (!navigationState) { return null; } return ( ( state.key} /> )} renderScene={(state, index, position, layout) => ( { onNavigate('Route #' + navigationState.children.length); }} /> )} /> ); } } const styles = StyleSheet.create({ animatedView: { flex: 1, }, scrollView: { marginTop: 64 }, }); module.exports = NavigationAnimatedExample;