使用Animated.ScrollView在基于本机的选项卡上反应本机问题

时间:2019-06-02 07:02:44

标签: javascript react-native expo native-base

我正在使用基于本机的选项卡,但是如果我将选项卡嵌入到Animated.ScrollView中,它将无法正常工作。

问题如下:

  1. 选项卡不会保持固定,而是会晃动。
  2. 选项卡中的元素不滚动,它们保持固定。

我尝试了不同的解决方案,但找不到解决问题的方法。

我了解的是,当我在Animated.ScrollView中使用选项卡时会发生问题。

有人可以帮我吗?

链接:Expo

代码:

    import React from 'react';
    import {
      View,
      Text,
      TouchableOpacity,
      StatusBar,
      ListView,
      PixelRatio,
      Image,
      Dimensions,
      StyleSheet,
    } from 'react-native';
    import { Container, Tabs, Tab as Tabn } from 'native-base';
    import '@expo/vector-icons/FontAwesome5';

    var { width } = Dimensions.get('window');

    import { createStackNavigator, createAppContainer } from 'react-navigation';
    import {
      RegularNavigationBar,
      CustomStickyNavigationBar,
      BigNavigationBar,
      BigNavigationBarCustomTitle,
      BigImageNavigationBar,
      BigCustomImageNavigationBar,
      BigImageParallaxNavigationBar,
      BigImageToNavigationBar,
      AnimatedNavigationBar,
      AnimatedImageNavigationBar,
    } from './examples';
    import NavigationService from './NavigationService';

    const Movie = [
      {
        id: 640,
        poster_path: '/MywWCQGJNUr5kivAQ7eseCG7rm.jpg',
        title: 'Catch Me If You Can',
      },
      {
        id: 1444,
        poster_path: '/asC6UOPrR6OlNMiyXbeXWu08SOG.jpg',
        title: 'Junebug',
      },
      {
        id: 10490,
        poster_path: '/lWCooTiA6sSLdCA4hzToHKKWBZb.jpg',
        title: 'Drop Dead Gorgeous',
      },
      {
        id: 4523,
        poster_path: '/8KCNzCArLlvLdQoHx6npua2VSVc.jpg',
        title: 'Enchanted',
      },
      {
        id: 5458,
        poster_path: '/cehmfvz2fJtBa1M6a3saRRsj5CD.jpg',
        title: 'Cruel Intentions 2',
      },
      {
        id: 21801,
        poster_path: '/l39vqAh57UjA0c5vBJUUPyuqz32.jpg',
        title: 'The Slaughter Rule',
      },
      {
        id: 6538,
        poster_path: '/uN9tN0ZDyol7VsTlugDZhGc11xQ.jpg',
        title: "Charlie Wilson's War",
      },
      {
        id: 24803,
        poster_path: '/4BFGuCcdV7y8mFYzBhgj00d3b1z.jpg',
        title: 'Julie & Julia',
      },
      {
        id: 25195,
        poster_path: '/9UWKpkQvZaPqpb85Or4e0PghJft.jpg',
        title: 'Leap Year',
      },
      {
        id: 12178,
        poster_path: '/8upvDaxMou1RGU0EqbQYjAxri4p.jpg',
        title: 'Miss Pettigrew Lives for a Day',
      },
      {
        id: 12771,
        poster_path: '/cgLqjuKp5AT1o9xvWhriToS2mHr.jpg',
        title: 'Serving Sara',
      },
      {
        id: 9718,
        poster_path: '/hi8whfL7t6cL2LITLJjzJ7UWuZA.jpg',
        title: 'Talladega Nights: The Ballad of Ricky Bobby',
      },
      {
        id: 13090,
        poster_path: '/9JkxUbOFiomw2Ci8ayTfAT69s0k.jpg',
        title: 'Sunshine Cleaning',
      },
      {
        id: 6961,
        poster_path: '/A2m90ko1FCnJqEkpbHwMq3BDgx6.jpg',
        title: 'The Wedding Date',
      },
      {
        id: 9971,
        poster_path: '/8oY0tWU2HlYhOLki1QvsaU0BdPU.jpg',
        title: 'The Last Run',
      },
      {
        id: 27723,
        poster_path: '/25a4lSkU43K2npb4g1XOJqmgtNb.jpg',
        title: 'Psycho Beach Party',
      },
      {
        id: 28025,
        poster_path: '/7ZAJS9ILCeh7dF61UPdlV8M8fap.jpg',
        title: 'Moonlight Serenade',
      },
      {
        id: 14167,
        poster_path: '/r5a8l1fz6WjLvOmELY0tTfoCXTf.jpg',
        title: 'Standing Still',
      },
      {
        id: 14359,
        poster_path: '/eoxF1LlYvJeVJcEmptfV8PLtpBK.jpg',
        title: 'Doubt',
      },
      {
        id: 45317,
        poster_path: '/ytGIpdxYyvXwch5QILfquSTMA9f.jpg',
        title: 'The Fighter',
      },
      {
        id: 64328,
        poster_path: '/Ai7JRZFEXXOX7rhgfeL861zZtWv.jpg',
        title: 'The Muppets',
      },
      {
        id: 18360,
        poster_path: '/qbU6AxmO69bBwu6Tw8HtcRoltAA.jpg',
        title: 'Night at the Museum: Battle of the Smithsonian',
      },
      {
        id: 48798,
        poster_path: '/it22C6LNuwd4ktP8oDJECdJxxS3.jpg',
        title: 'Love and Distrust',
      },
      {
        id: 49521,
        poster_path: '/xWlaTLnD8NJMTT9PGOD9z5re1SL.jpg',
        title: 'Man of Steel',
      },
      {
        id: 68722,
        poster_path: '/rUSjbyvYWN9H4az8xt0tDtU7I6v.jpg',
        title: 'The Master',
      },
      {
        id: 83770,
        poster_path: '/uORuwLgdDFkA4BuU9b9nuhTkuy.jpg',
        title: 'On the Road',
      },
      {
        id: 87093,
        poster_path: '/tkxE7BLschoqNzTikrGvZN7IL7K.jpg',
        title: 'Big Eyes',
      },
      {
        id: 87825,
        poster_path: '/vNWFhlTseaTupYmpnXxJLoShJe3.jpg',
        title: 'Trouble with the Curve',
      },
      {
        id: 121555,
        poster_path: '/zRh6R3fBT6cVWGG5PvTnVmmwAEn.jpg',
        title: "Stephen Tobolowsky's Birthday Party",
      },
      {
        id: 152601,
        poster_path: '/fsoTLnUXEUTNuVCBxAJMY0HPPd.jpg',
        title: 'Her',
      },
      {
        id: 168672,
        poster_path: '/mhB7C62lSMpGO2HYNaW6d7W3TVH.jpg',
        title: 'American Hustle',
      },
      {
        id: 209112,
        poster_path: '/cGOPbv9wA5gEejkUN892JrveARt.jpg',
        title: 'Batman v Superman: Dawn of Justice',
      },
      {
        id: 219611,
        poster_path: '/mGVmFhYkmJqqad3e4qvFypLlTBK.jpg',
        title: 'Back Beyond',
      },
      {
        id: 141052,
        poster_path: '/9rtrRGeRnL0JKtu9IMBWsmlmmZz.jpg',
        title: 'Justice League',
      },
      {
        id: 261768,
        poster_path: '/qBnNHTLc6GIgEWOtKA0Q3HuGmfE.jpg',
        title: 'Lullaby',
      },
      {
        id: 329865,
        poster_path: '/hLudzvGfpi6JlwUnsNhXwKKg4j.jpg',
        title: 'Arrival',
      },
      {
        id: 378674,
        poster_path: '/xfEZBeUwZGdUQXZ7m8e353r8MqX.jpg',
        title: 'DC Films Presents Dawn of the Justice League',
      },
      {
        id: 447687,
        poster_path: '/yLlmNeZViC68yXztrMzgbJFO9yA.jpg',
        title: 'Secret Ingredients: Creating Julie & Julia',
      },
      {
        id: 340666,
        poster_path: '/9Moizj8qxcZK6DqEE1MTO3pQAEw.jpg',
        title: 'Nocturnal Animals',
      },
      {
        id: 2179,
        poster_path: '/gQThU8AftVJEBug4ToHUbQ3Lg7M.jpg',
        title: 'Tenacious D in The Pick of Destiny',
      },
      {
        id: 9719,
        poster_path: '/jI7tL4uvgUPu6BkyZJ3591rbz44.jpg',
        title: 'Pumpkin',
      },
      {
        id: 13171,
        poster_path: '/shqcS4NosGPBZhWETEufJhP4bCO.jpg',
        title: 'The Ex',
      },
      {
        id: 414031,
        poster_path: '/z9h3gCVrNvdVfbXZ1eWRq9efFlm.jpg',
        title: 'The Chromium Hook',
      },
      {
        id: 640,
        poster_path: '/MywWCQGJNUr5kivAQ7eseCG7rm.jpg',
        title: 'Catch Me If You Can',
      },
      {
        id: 1444,
        poster_path: '/asC6UOPrR6OlNMiyXbeXWu08SOG.jpg',
        title: 'Junebug',
      },
      {
        id: 10490,
        poster_path: '/lWCooTiA6sSLdCA4hzToHKKWBZb.jpg',
        title: 'Drop Dead Gorgeous',
      },
      {
        id: 4523,
        poster_path: '/8KCNzCArLlvLdQoHx6npua2VSVc.jpg',
        title: 'Enchanted',
      },
      {
        id: 5458,
        poster_path: '/cehmfvz2fJtBa1M6a3saRRsj5CD.jpg',
        title: 'Cruel Intentions 2',
      },
      {
        id: 21801,
        poster_path: '/l39vqAh57UjA0c5vBJUUPyuqz32.jpg',
        title: 'The Slaughter Rule',
      },
      {
        id: 6538,
        poster_path: '/uN9tN0ZDyol7VsTlugDZhGc11xQ.jpg',
        title: "Charlie Wilson's War",
      },
      {
        id: 24803,
        poster_path: '/4BFGuCcdV7y8mFYzBhgj00d3b1z.jpg',
        title: 'Julie & Julia',
      },
      {
        id: 25195,
        poster_path: '/9UWKpkQvZaPqpb85Or4e0PghJft.jpg',
        title: 'Leap Year',
      },
      {
        id: 12178,
        poster_path: '/8upvDaxMou1RGU0EqbQYjAxri4p.jpg',
        title: 'Miss Pettigrew Lives for a Day',
      },
      {
        id: 12771,
        poster_path: '/cgLqjuKp5AT1o9xvWhriToS2mHr.jpg',
        title: 'Serving Sara',
      },
      {
        id: 9718,
        poster_path: '/hi8whfL7t6cL2LITLJjzJ7UWuZA.jpg',
        title: 'Talladega Nights: The Ballad of Ricky Bobby',
      },
      {
        id: 13090,
        poster_path: '/9JkxUbOFiomw2Ci8ayTfAT69s0k.jpg',
        title: 'Sunshine Cleaning',
      },
      {
        id: 6961,
        poster_path: '/A2m90ko1FCnJqEkpbHwMq3BDgx6.jpg',
        title: 'The Wedding Date',
      },
      {
        id: 9971,
        poster_path: '/8oY0tWU2HlYhOLki1QvsaU0BdPU.jpg',
        title: 'The Last Run',
      },
      {
        id: 27723,
        poster_path: '/25a4lSkU43K2npb4g1XOJqmgtNb.jpg',
        title: 'Psycho Beach Party',
      },
      {
        id: 28025,
        poster_path: '/7ZAJS9ILCeh7dF61UPdlV8M8fap.jpg',
        title: 'Moonlight Serenade',
      },
      {
        id: 14167,
        poster_path: '/r5a8l1fz6WjLvOmELY0tTfoCXTf.jpg',
        title: 'Standing Still',
      },
      {
        id: 14359,
        poster_path: '/eoxF1LlYvJeVJcEmptfV8PLtpBK.jpg',
        title: 'Doubt',
      },
      {
        id: 45317,
        poster_path: '/ytGIpdxYyvXwch5QILfquSTMA9f.jpg',
        title: 'The Fighter',
      },
      {
        id: 64328,
        poster_path: '/Ai7JRZFEXXOX7rhgfeL861zZtWv.jpg',
        title: 'The Muppets',
      },
      {
        id: 18360,
        poster_path: '/qbU6AxmO69bBwu6Tw8HtcRoltAA.jpg',
        title: 'Night at the Museum: Battle of the Smithsonian',
      },
      {
        id: 48798,
        poster_path: '/it22C6LNuwd4ktP8oDJECdJxxS3.jpg',
        title: 'Love and Distrust',
      },
      {
        id: 49521,
        poster_path: '/xWlaTLnD8NJMTT9PGOD9z5re1SL.jpg',
        title: 'Man of Steel',
      },
      {
        id: 68722,
        poster_path: '/rUSjbyvYWN9H4az8xt0tDtU7I6v.jpg',
        title: 'The Master',
      },
      {
        id: 83770,
        poster_path: '/uORuwLgdDFkA4BuU9b9nuhTkuy.jpg',
        title: 'On the Road',
      },
      {
        id: 87093,
        poster_path: '/tkxE7BLschoqNzTikrGvZN7IL7K.jpg',
        title: 'Big Eyes',
      },
      {
        id: 87825,
        poster_path: '/vNWFhlTseaTupYmpnXxJLoShJe3.jpg',
        title: 'Trouble with the Curve',
      },
      {
        id: 121555,
        poster_path: '/zRh6R3fBT6cVWGG5PvTnVmmwAEn.jpg',
        title: "Stephen Tobolowsky's Birthday Party",
      },
      {
        id: 152601,
        poster_path: '/fsoTLnUXEUTNuVCBxAJMY0HPPd.jpg',
        title: 'Her',
      },
      {
        id: 168672,
        poster_path: '/mhB7C62lSMpGO2HYNaW6d7W3TVH.jpg',
        title: 'American Hustle',
      },
      {
        id: 209112,
        poster_path: '/cGOPbv9wA5gEejkUN892JrveARt.jpg',
        title: 'Batman v Superman: Dawn of Justice',
      },
      {
        id: 219611,
        poster_path: '/mGVmFhYkmJqqad3e4qvFypLlTBK.jpg',
        title: 'Back Beyond',
      },
      {
        id: 141052,
        poster_path: '/9rtrRGeRnL0JKtu9IMBWsmlmmZz.jpg',
        title: 'Justice League',
      },
      {
        id: 261768,
        poster_path: '/qBnNHTLc6GIgEWOtKA0Q3HuGmfE.jpg',
        title: 'Lullaby',
      },
      {
        id: 329865,
        poster_path: '/hLudzvGfpi6JlwUnsNhXwKKg4j.jpg',
        title: 'Arrival',
      },
      {
        id: 378674,
        poster_path: '/xfEZBeUwZGdUQXZ7m8e353r8MqX.jpg',
        title: 'DC Films Presents Dawn of the Justice League',
      },
      {
        id: 447687,
        poster_path: '/yLlmNeZViC68yXztrMzgbJFO9yA.jpg',
        title: 'Secret Ingredients: Creating Julie & Julia',
      },
      {
        id: 340666,
        poster_path: '/9Moizj8qxcZK6DqEE1MTO3pQAEw.jpg',
        title: 'Nocturnal Animals',
      },
      {
        id: 2179,
        poster_path: '/gQThU8AftVJEBug4ToHUbQ3Lg7M.jpg',
        title: 'Tenacious D in The Pick of Destiny',
      },
      {
        id: 9719,
        poster_path: '/jI7tL4uvgUPu6BkyZJ3591rbz44.jpg',
        title: 'Pumpkin',
      },
      {
        id: 13171,
        poster_path: '/shqcS4NosGPBZhWETEufJhP4bCO.jpg',
        title: 'The Ex',
      },
      {
        id: 640,
        poster_path: '/MywWCQGJNUr5kivAQ7eseCG7rm.jpg',
        title: 'Catch Me If You Can',
      },
      {
        id: 1444,
        poster_path: '/asC6UOPrR6OlNMiyXbeXWu08SOG.jpg',
        title: 'Junebug',
      },
      {
        id: 10490,
        poster_path: '/lWCooTiA6sSLdCA4hzToHKKWBZb.jpg',
        title: 'Drop Dead Gorgeous',
      },
      {
        id: 4523,
        poster_path: '/8KCNzCArLlvLdQoHx6npua2VSVc.jpg',
        title: 'Enchanted',
      },
      {
        id: 5458,
        poster_path: '/cehmfvz2fJtBa1M6a3saRRsj5CD.jpg',
        title: 'Cruel Intentions 2',
      },
      {
        id: 21801,
        poster_path: '/l39vqAh57UjA0c5vBJUUPyuqz32.jpg',
        title: 'The Slaughter Rule',
      },
      {
        id: 6538,
        poster_path: '/uN9tN0ZDyol7VsTlugDZhGc11xQ.jpg',
        title: "Charlie Wilson's War",
      },
      {
        id: 24803,
        poster_path: '/4BFGuCcdV7y8mFYzBhgj00d3b1z.jpg',
        title: 'Julie & Julia',
      },
      {
        id: 25195,
        poster_path: '/9UWKpkQvZaPqpb85Or4e0PghJft.jpg',
        title: 'Leap Year',
      },
      {
        id: 12178,
        poster_path: '/8upvDaxMou1RGU0EqbQYjAxri4p.jpg',
        title: 'Miss Pettigrew Lives for a Day',
      },
      {
        id: 12771,
        poster_path: '/cgLqjuKp5AT1o9xvWhriToS2mHr.jpg',
        title: 'Serving Sara',
      },
      {
        id: 9718,
        poster_path: '/hi8whfL7t6cL2LITLJjzJ7UWuZA.jpg',
        title: 'Talladega Nights: The Ballad of Ricky Bobby',
      },
      {
        id: 13090,
        poster_path: '/9JkxUbOFiomw2Ci8ayTfAT69s0k.jpg',
        title: 'Sunshine Cleaning',
      },
      {
        id: 6961,
        poster_path: '/A2m90ko1FCnJqEkpbHwMq3BDgx6.jpg',
        title: 'The Wedding Date',
      },
      {
        id: 9971,
        poster_path: '/8oY0tWU2HlYhOLki1QvsaU0BdPU.jpg',
        title: 'The Last Run',
      },
      {
        id: 27723,
        poster_path: '/25a4lSkU43K2npb4g1XOJqmgtNb.jpg',
        title: 'Psycho Beach Party',
      },
      {
        id: 28025,
        poster_path: '/7ZAJS9ILCeh7dF61UPdlV8M8fap.jpg',
        title: 'Moonlight Serenade',
      },
      {
        id: 14167,
        poster_path: '/r5a8l1fz6WjLvOmELY0tTfoCXTf.jpg',
        title: 'Standing Still',
      },
      {
        id: 14359,
        poster_path: '/eoxF1LlYvJeVJcEmptfV8PLtpBK.jpg',
        title: 'Doubt',
      },
      {
        id: 45317,
        poster_path: '/ytGIpdxYyvXwch5QILfquSTMA9f.jpg',
        title: 'The Fighter',
      },
      {
        id: 64328,
        poster_path: '/Ai7JRZFEXXOX7rhgfeL861zZtWv.jpg',
        title: 'The Muppets',
      },
      {
        id: 18360,
        poster_path: '/qbU6AxmO69bBwu6Tw8HtcRoltAA.jpg',
        title: 'Night at the Museum: Battle of the Smithsonian',
      },
      {
        id: 48798,
        poster_path: '/it22C6LNuwd4ktP8oDJECdJxxS3.jpg',
        title: 'Love and Distrust',
      },
      {
        id: 49521,
        poster_path: '/xWlaTLnD8NJMTT9PGOD9z5re1SL.jpg',
        title: 'Man of Steel',
      },
      {
        id: 68722,
        poster_path: '/rUSjbyvYWN9H4az8xt0tDtU7I6v.jpg',
        title: 'The Master',
      },
      {
        id: 83770,
        poster_path: '/uORuwLgdDFkA4BuU9b9nuhTkuy.jpg',
        title: 'On the Road',
      },
      {
        id: 87093,
        poster_path: '/tkxE7BLschoqNzTikrGvZN7IL7K.jpg',
        title: 'Big Eyes',
      },
      {
        id: 87825,
        poster_path: '/vNWFhlTseaTupYmpnXxJLoShJe3.jpg',
        title: 'Trouble with the Curve',
      },
      {
        id: 121555,
        poster_path: '/zRh6R3fBT6cVWGG5PvTnVmmwAEn.jpg',
        title: "Stephen Tobolowsky's Birthday Party",
      },
      {
        id: 152601,
        poster_path: '/fsoTLnUXEUTNuVCBxAJMY0HPPd.jpg',
        title: 'Her',
      },
      {
        id: 168672,
        poster_path: '/mhB7C62lSMpGO2HYNaW6d7W3TVH.jpg',
        title: 'American Hustle',
      },
      {
        id: 209112,
        poster_path: '/cGOPbv9wA5gEejkUN892JrveARt.jpg',
        title: 'Batman v Superman: Dawn of Justice',
      },
      {
        id: 219611,
        poster_path: '/mGVmFhYkmJqqad3e4qvFypLlTBK.jpg',
        title: 'Back Beyond',
      },
      {
        id: 141052,
        poster_path: '/9rtrRGeRnL0JKtu9IMBWsmlmmZz.jpg',
        title: 'Justice League',
      },
      {
        id: 261768,
        poster_path: '/qBnNHTLc6GIgEWOtKA0Q3HuGmfE.jpg',
        title: 'Lullaby',
      },
      {
        id: 329865,
        poster_path: '/hLudzvGfpi6JlwUnsNhXwKKg4j.jpg',
        title: 'Arrival',
      },
      {
        id: 378674,
        poster_path: '/xfEZBeUwZGdUQXZ7m8e353r8MqX.jpg',
        title: 'DC Films Presents Dawn of the Justice League',
      },
      {
        id: 447687,
        poster_path: '/yLlmNeZViC68yXztrMzgbJFO9yA.jpg',
        title: 'Secret Ingredients: Creating Julie & Julia',
      },
      {
        id: 340666,
        poster_path: '/9Moizj8qxcZK6DqEE1MTO3pQAEw.jpg',
        title: 'Nocturnal Animals',
      },
      {
        id: 2179,
        poster_path: '/gQThU8AftVJEBug4ToHUbQ3Lg7M.jpg',
        title: 'Tenacious D in The Pick of Destiny',
      },
      {
        id: 9719,
        poster_path: '/jI7tL4uvgUPu6BkyZJ3591rbz44.jpg',
        title: 'Pumpkin',
      },
      {
        id: 13171,
        poster_path: '/shqcS4NosGPBZhWETEufJhP4bCO.jpg',
        title: 'The Ex',
      },
      {
        id: 414031,
        poster_path: '/z9h3gCVrNvdVfbXZ1eWRq9efFlm.jpg',
        title: 'The Chromium Hook',
      },
      {
        id: 414031,
        poster_path: '/z9h3gCVrNvdVfbXZ1eWRq9efFlm.jpg',
        title: 'The Chromium Hook',
      },
      {
        id: 416648,
        poster_path: '/gw8CIsFJST4dBkHsuBbToSvGczE.jpg',
        title: 'Man of Steel 2',
      },
      {
        id: 6589,
        poster_path: '/aczrdq26BPu7GDIhEVrzRgwsjpl.jpg',
        title: 'Underdog',
      },
      {
        id: 338958,
        poster_path: null,
        title: 'Disenchanted',
      },
      {
        id: 429197,
        poster_path: null,
        title: 'Backseat',
      },
    ];

    const Description =
      'Amy Lou Adams was born in Vicenza, Veneto, Italy, to American parents Kathryn (Hicken) and Richard Kent Adams, while her father was a U.S. serviceman. She was raised in a Mormon family of seven children in Castle Rock, Colorado, and has English, as well as smaller amounts of Danish, Swiss-German, and Norwegian, ancestry.';

    const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 });

    class Sced extends React.Component {
      constructor() {
        super();
        this.state = {
          info: Description,
          dataSourceMovie: ds.cloneWithRows(Movie),
        };
      }

      renderRow(r) {
        return (
          <View
            style={{
              width: Math.round(width * PixelRatio.get()) / 15,
              elevation: 2,
              borderRadius: 4,
              overflow: 'hidden',
              backgroundColor: '#fff',
              marginTop: 5,
              marginLeft: 8,
            }}>
            <Image
              style={{
                borderTopLeftRadius: 4,
                borderTopRightRadius: 4,
                height: Math.round(width * PixelRatio.get()) / 8,
                width: Math.round(width * PixelRatio.get()) / 15,
              }}
              source={{
                uri:
                  r.poster_path == null
                    ? 'https://techreport.com/forums/styles/canvas/theme/images/no_avatar.jpg'
                    : 'https://image.tmdb.org/t/p/w185' + r.poster_path,
              }}
            />
            <View
              style={{
                flexDirection: 'column',
                paddingTop: 4,
                paddingHorizontal: 8,
              }}>
              <Text style={{ textAlign: 'center', fontSize: 10 }}>{r.title}</Text>
            </View>
          </View>
        );
      }

      render() {
        return (
          <Container>
            <Tabs
              initialPage={0}
              tabBarUnderlineStyle={{
                height: 2,
                backgroundColor: '#FFC107',
              }}>
              <Tabn
                heading={'Info'}
                tabStyle={{ backgroundColor: '#205cb2' }}
                activeTabStyle={{ backgroundColor: '#205cb2' }}
                textStyle={{
                  fontSize: 12,
                  fontWeight: 'bold',
                }}
                activeTextStyle={{
                  fontSize: 12,
                }}>
                <Text>{this.state.info}</Text>
              </Tabn>
              <Tabn
                heading={
                  'Movie(' + this.state.dataSourceMovie._dataBlob.s1.length + ')'
                }
                tabStyle={{ backgroundColor: '#205cb2' }}
                activeTabStyle={{ backgroundColor: '#205cb2' }}
                textStyle={{
                  fontSize: 12,
                  fontWeight: 'bold',
                }}
                activeTextStyle={{
                  fontSize: 12,
                }}>
                <ListView
                  horizontal={false}
                  initialListSize={this.state.dataSourceMovie._dataBlob.s1.length}
                  contentContainerStyle={styles.list}
                  dataSource={this.state.dataSourceMovie}
                  renderRow={this.renderRow.bind(this)}
                  enableEmptySections={true}
                />
              </Tabn>
            </Tabs>
          </Container>
        );
      }
    }

    function Screen(WrapperComponent) {
      //return () => <Sced />;
      return () => (
        <View style={{ backgroundColor: '#6cf90e', flex: 1 }}>
          <WrapperComponent>
            <View style={{ backgroundColor: '#f44242', paddingTop: 0 }}>
              <Sced />
            </View>
          </WrapperComponent>
        </View>
      );
    }

    class HomeScreen extends React.Component {
      renderLink(screen) {
        const { navigation } = this.props;
        return (
          <TouchableOpacity onPress={() => navigation.navigate(screen)}>
            <View style={{ marginVertical: 10 }}>
              <Text style={{ fontSize: 24, fontWeight: '600' }}>{screen}</Text>
            </View>
          </TouchableOpacity>
        );
      }

      render() {
        const { navigation } = this.props;
        return (
          <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
            <StatusBar
              translucent
              backgroundColor="white"
              barStyle="dark-content"
            />
            {this.renderLink('RegularNavigationBar')}
            {this.renderLink('CustomStickyNavigationBar')}
            {this.renderLink('BigNavigationBar')}
            {this.renderLink('BigNavigationBarCustomTitle')}
            {this.renderLink('BigImageNavigationBar')}
            {this.renderLink('BigCustomImageNavigationBar')}
            {this.renderLink('BigImageParallaxNavigationBar')}
            {this.renderLink('BigImageToNavigationBar')}
            {this.renderLink('AnimatedNavigationBar')}
            {this.renderLink('AnimatedImageNavigationBar')}
          </View>
        );
      }
    }

    const AppNavigator = createStackNavigator(
      {
        AnimatedImageNavigationBar: Screen(AnimatedImageNavigationBar),
        HomeScreen,
        RegularNavigationBar: Screen(RegularNavigationBar),
        CustomStickyNavigationBar: Screen(CustomStickyNavigationBar),
        BigNavigationBar: Screen(BigNavigationBar),
        BigNavigationBarCustomTitle: Screen(BigNavigationBarCustomTitle),
        BigImageNavigationBar: Screen(BigImageNavigationBar),
        BigCustomImageNavigationBar: Screen(BigCustomImageNavigationBar),
        BigImageParallaxNavigationBar: Screen(BigImageParallaxNavigationBar),
        BigImageToNavigationBar: Screen(BigImageToNavigationBar),
        AnimatedNavigationBar: Screen(AnimatedNavigationBar),
        //AnimatedImageNavigationBar: Screen(AnimatedImageNavigationBar),
      },
      {
        headerMode: 'none',
      }
    );
    const AppContainer = createAppContainer(AppNavigator);

    export default class App extends React.Component {
      render() {
        return (
          <AppContainer
            ref={navigatorRef => {
              NavigationService.setTopLevelNavigator(navigatorRef);
            }}
          />
        );
      }
    }

    const styles = StyleSheet.create({
      list: {
        flexDirection: 'row',
        flexWrap: 'wrap',
        justifyContent: 'space-between',
        marginRight: 8,
        paddingBottom: 65,
      },
    });

0 个答案:

没有答案