├── .watchmanconfig ├── .gitattributes ├── app.json ├── images ├── 001.png ├── 002.png ├── 003.png ├── 004.png ├── 005.png ├── 006.png ├── 007.png ├── 008.png ├── 009.png ├── 010.png └── 011.png ├── .eslintrc.js ├── babel.config.js ├── android ├── app │ ├── debug.keystore │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── values │ │ │ │ │ ├── strings.xml │ │ │ │ │ └── styles.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── drawable-xxhdpi │ │ │ │ │ └── react_native.png │ │ │ │ └── mipmap-xxxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── maxieernlab │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ ├── MainApplication.java │ │ │ │ │ └── yoga │ │ │ │ │ ├── YogaActivity2.java │ │ │ │ │ └── YogaActivity1.java │ │ │ └── AndroidManifest.xml │ │ └── debug │ │ │ └── AndroidManifest.xml │ ├── proguard-rules.pro │ ├── build_defs.bzl │ ├── _BUCK │ └── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── settings.gradle ├── gradle.properties ├── build.gradle ├── gradlew.bat └── gradlew ├── src ├── pages │ ├── basic │ │ ├── img │ │ │ ├── Swiper1.jpg │ │ │ ├── Swiper2.jpg │ │ │ ├── Swiper3.jpg │ │ │ └── Swiper4.jpg │ │ ├── RNScrollableTabView.js │ │ ├── RNBasicScrollView.js │ │ └── RNThirdSwiper.js │ ├── demo │ │ ├── weather │ │ │ └── img │ │ │ │ ├── w2.png │ │ │ │ └── w3.png │ │ ├── twitter │ │ │ ├── img │ │ │ │ └── day3.png │ │ │ ├── TwitterPost.js │ │ │ ├── TwitterTab.js │ │ │ └── TwitterHome.js │ │ ├── meituan │ │ │ ├── img │ │ │ │ ├── mine │ │ │ │ │ ├── avatar.png │ │ │ │ │ ├── icon_mine_member.png │ │ │ │ │ ├── icon_mine_wallet.png │ │ │ │ │ ├── icon_mine_balance.png │ │ │ │ │ ├── icon_mine_comment.png │ │ │ │ │ ├── icon_mine_friends.png │ │ │ │ │ ├── icon_mine_voucher.png │ │ │ │ │ ├── beauty_technician_v15.png │ │ │ │ │ ├── icon_mine_collection.png │ │ │ │ │ ├── icon_mine_membercard.png │ │ │ │ │ ├── icon_mine_mineorder.png │ │ │ │ │ ├── icon_mine_aboutmeituan.png │ │ │ │ │ ├── icon_mine_membercenter.png │ │ │ │ │ ├── icon_mine_customerService.png │ │ │ │ │ ├── icon_user_avatar_anonymous.png │ │ │ │ │ ├── icon_navigation_item_set_white.png │ │ │ │ │ ├── icon_userreview_defaultavatar.png │ │ │ │ │ └── icon_navigation_item_message_white.png │ │ │ │ ├── home │ │ │ │ │ ├── search_icon.png │ │ │ │ │ ├── icon_homepage_map.png │ │ │ │ │ ├── icon_homepage_default.png │ │ │ │ │ ├── icon_homepage_map_old.png │ │ │ │ │ ├── icon_homepage_search.png │ │ │ │ │ ├── icon_deal_anytime_refund.png │ │ │ │ │ ├── icon_homepage_ktv_category.png │ │ │ │ │ ├── icon_homepage_map_selected.png │ │ │ │ │ ├── icon_homepage_food_category.png │ │ │ │ │ ├── icon_homepage_hotel_category.png │ │ │ │ │ ├── icon_homepage_movie_category.png │ │ │ │ │ ├── bg_customReview_image_default.png │ │ │ │ │ ├── icon_homepage_beauty_category.png │ │ │ │ │ ├── icon_homepage_map_selected_old.png │ │ │ │ │ ├── icon_homepage_shopping_category.png │ │ │ │ │ ├── icon_homepage_foottreat_category.png │ │ │ │ │ ├── icon_homepage_entertainment_category.png │ │ │ │ │ └── icon_homepage_life_service_category.png │ │ │ │ ├── public │ │ │ │ │ ├── cell_arrow.png │ │ │ │ │ ├── icon_food_merchant_address.png │ │ │ │ │ └── icon_navigation_item_share.png │ │ │ │ ├── tabbar │ │ │ │ │ ├── tabbar_mine.png │ │ │ │ │ ├── tabbar_order.png │ │ │ │ │ ├── tabbar_discover.png │ │ │ │ │ ├── tabbar_homepage.png │ │ │ │ │ ├── tabbar_merchant.png │ │ │ │ │ ├── tabbar_mine_selected.png │ │ │ │ │ ├── tabbar_order_selected.png │ │ │ │ │ ├── tabbar_discover_selected.png │ │ │ │ │ ├── tabbar_homepage_selected.png │ │ │ │ │ └── tabbar_merchant_selected.png │ │ │ │ └── order │ │ │ │ │ ├── order_tab_need_pay@2x.png │ │ │ │ │ ├── order_tab_need_use@2x.png │ │ │ │ │ ├── order_tab_need_review@2x.png │ │ │ │ │ └── order_tab_needoffer_aftersale@2x.png │ │ │ ├── home │ │ │ │ ├── MTHomeMenuItem.js │ │ │ │ ├── MTHomeMenuView.js │ │ │ │ └── MTHomeScene.js │ │ │ ├── nearby │ │ │ │ ├── MTNearbyHeaderView.js │ │ │ │ └── MTNearbyScene.js │ │ │ ├── widget │ │ │ │ └── GroupPrchaseCell.js │ │ │ ├── mine │ │ │ │ ├── MTDetailCell.js │ │ │ │ └── MTMineScene.js │ │ │ ├── MeituanHome.js │ │ │ └── common │ │ │ │ └── MTAPI.js │ │ ├── DemoHome.js │ │ ├── mylocation │ │ │ ├── Map.js │ │ │ └── MyLocationHome.js │ │ └── StopWatch │ │ │ └── StopWatchHome.js │ ├── template │ │ └── TemplateHome.js │ └── home │ │ ├── HomeBasic.js │ │ └── index.js ├── config │ ├── actions.js │ └── store.js ├── common │ ├── utils │ │ └── HomeUtils.js │ └── screen.js ├── demo │ ├── ReactNativeUIDemo │ │ ├── CheckBoxes │ │ │ └── index.js │ │ ├── DemoSimpleView.js │ │ ├── demos │ │ │ └── ReactNativeUIImage.js │ │ ├── buttons │ │ │ └── GradientButton.js │ │ └── DemoButton.js │ ├── NavigationDemo │ │ ├── doc │ │ │ └── DocHelloNavigation.js │ │ ├── CustomHeader │ │ │ └── index.js │ │ ├── NavigationHello │ │ │ └── index.js │ │ ├── StackDemo │ │ │ └── index.js │ │ └── Custom │ │ │ └── BottomNavigation │ │ │ └── HeartBeatBottomNavi │ │ │ ├── index.js │ │ │ └── HeartBeatBottomNavigation.js │ ├── LoginDemo │ │ └── DemoLogin1.js │ ├── ChartDemo │ │ └── DemoLineChart.js │ ├── ChatDemo │ │ └── index.js │ └── ReduxDemo │ │ └── demos │ │ └── ReduxTodo.js ├── reducers │ └── todo │ │ ├── actions │ │ ├── todo-add.js │ │ ├── todo-finish.js │ │ └── todo-unfinish.js │ │ └── reducer.js └── widgets │ ├── tab │ └── bottom │ │ └── TabBarItem.js │ ├── gridview │ ├── GridView.js │ └── GridItem.js │ ├── navi │ └── NavigationItem.js │ └── text │ └── Text.js ├── ios ├── MaxieeRNLab │ ├── Images.xcassets │ │ ├── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── AppDelegate.h │ ├── main.m │ ├── AppDelegate.m │ ├── Info.plist │ └── Base.lproj │ │ └── LaunchScreen.xib ├── MaxieeRNLab.xcodeproj │ ├── contents.scworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ ├── MaxieeRNLab.xcscheme │ │ └── MaxieeRNLab-tvOS.xcscheme ├── MaxieeRNLabTests │ ├── Info.plist │ └── MaxieeRNLabTests.m ├── MaxieeRNLab-tvOSTests │ └── Info.plist ├── MaxieeRNLab-tvOS │ └── Info.plist └── Podfile ├── .buckconfig ├── .prettierrc.js ├── __tests__ └── App.js ├── metro.config.js ├── index.js ├── .gitignore ├── README.md ├── package.json └── .flowconfig /.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "MaxieeRNLab", 3 | "displayName": "MaxieeRNLab" 4 | } -------------------------------------------------------------------------------- /images/001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/images/001.png -------------------------------------------------------------------------------- /images/002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/images/002.png -------------------------------------------------------------------------------- /images/003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/images/003.png -------------------------------------------------------------------------------- /images/004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/images/004.png -------------------------------------------------------------------------------- /images/005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/images/005.png -------------------------------------------------------------------------------- /images/006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/images/006.png -------------------------------------------------------------------------------- /images/007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/images/007.png -------------------------------------------------------------------------------- /images/008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/images/008.png -------------------------------------------------------------------------------- /images/009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/images/009.png -------------------------------------------------------------------------------- /images/010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/images/010.png -------------------------------------------------------------------------------- /images/011.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/images/011.png -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: '@react-native-community', 4 | }; -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'] 3 | } 4 | -------------------------------------------------------------------------------- /android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/android/app/debug.keystore -------------------------------------------------------------------------------- /src/pages/basic/img/Swiper1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/basic/img/Swiper1.jpg -------------------------------------------------------------------------------- /src/pages/basic/img/Swiper2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/basic/img/Swiper2.jpg -------------------------------------------------------------------------------- /src/pages/basic/img/Swiper3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/basic/img/Swiper3.jpg -------------------------------------------------------------------------------- /src/pages/basic/img/Swiper4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/basic/img/Swiper4.jpg -------------------------------------------------------------------------------- /src/pages/demo/weather/img/w2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/weather/img/w2.png -------------------------------------------------------------------------------- /src/pages/demo/weather/img/w3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/weather/img/w3.png -------------------------------------------------------------------------------- /src/pages/demo/twitter/img/day3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/twitter/img/day3.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | MaxieeRNLab 3 | 4 | -------------------------------------------------------------------------------- /ios/MaxieeRNLab/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/mine/avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/mine/avatar.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/home/search_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/home/search_icon.png -------------------------------------------------------------------------------- /.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/public/cell_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/public/cell_arrow.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/tabbar/tabbar_mine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/tabbar/tabbar_mine.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/mine/icon_mine_member.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/mine/icon_mine_member.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/mine/icon_mine_wallet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/mine/icon_mine_wallet.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/tabbar/tabbar_order.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/tabbar/tabbar_order.png -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | bracketSpacing: false, 3 | jsxBracketSameLine: true, 4 | singleQuote: true, 5 | trailingComma: 'all', 6 | }; -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/home/icon_homepage_map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/home/icon_homepage_map.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/mine/icon_mine_balance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/mine/icon_mine_balance.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/mine/icon_mine_comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/mine/icon_mine_comment.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/mine/icon_mine_friends.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/mine/icon_mine_friends.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/mine/icon_mine_voucher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/mine/icon_mine_voucher.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/tabbar/tabbar_discover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/tabbar/tabbar_discover.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/tabbar/tabbar_homepage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/tabbar/tabbar_homepage.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/tabbar/tabbar_merchant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/tabbar/tabbar_merchant.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/react_native.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/android/app/src/main/res/drawable-xxhdpi/react_native.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/home/icon_homepage_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/home/icon_homepage_default.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/home/icon_homepage_map_old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/home/icon_homepage_map_old.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/home/icon_homepage_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/home/icon_homepage_search.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/mine/beauty_technician_v15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/mine/beauty_technician_v15.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/mine/icon_mine_collection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/mine/icon_mine_collection.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/mine/icon_mine_membercard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/mine/icon_mine_membercard.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/mine/icon_mine_mineorder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/mine/icon_mine_mineorder.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /src/config/actions.js: -------------------------------------------------------------------------------- 1 | export const ACTION_TODO_ADD = "TODO_ADD"; 2 | export const ACTION_TODO_FINISH = "TODO_FINISH"; 3 | export const ACTION_TODO_UNFINISH = "TODO_UNFINISH"; -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/mine/icon_mine_aboutmeituan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/mine/icon_mine_aboutmeituan.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/mine/icon_mine_membercenter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/mine/icon_mine_membercenter.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/order/order_tab_need_pay@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/order/order_tab_need_pay@2x.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/order/order_tab_need_use@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/order/order_tab_need_use@2x.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/tabbar/tabbar_mine_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/tabbar/tabbar_mine_selected.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/tabbar/tabbar_order_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/tabbar/tabbar_order_selected.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/home/icon_deal_anytime_refund.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/home/icon_deal_anytime_refund.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/home/icon_homepage_ktv_category.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/home/icon_homepage_ktv_category.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/home/icon_homepage_map_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/home/icon_homepage_map_selected.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/mine/icon_mine_customerService.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/mine/icon_mine_customerService.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/mine/icon_user_avatar_anonymous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/mine/icon_user_avatar_anonymous.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/order/order_tab_need_review@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/order/order_tab_need_review@2x.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/tabbar/tabbar_discover_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/tabbar/tabbar_discover_selected.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/tabbar/tabbar_homepage_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/tabbar/tabbar_homepage_selected.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/tabbar/tabbar_merchant_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/tabbar/tabbar_merchant_selected.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/home/icon_homepage_food_category.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/home/icon_homepage_food_category.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/home/icon_homepage_hotel_category.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/home/icon_homepage_hotel_category.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/home/icon_homepage_movie_category.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/home/icon_homepage_movie_category.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/public/icon_food_merchant_address.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/public/icon_food_merchant_address.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/public/icon_navigation_item_share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/public/icon_navigation_item_share.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/home/bg_customReview_image_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/home/bg_customReview_image_default.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/home/icon_homepage_beauty_category.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/home/icon_homepage_beauty_category.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/home/icon_homepage_map_selected_old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/home/icon_homepage_map_selected_old.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/home/icon_homepage_shopping_category.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/home/icon_homepage_shopping_category.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/mine/icon_navigation_item_set_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/mine/icon_navigation_item_set_white.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/mine/icon_userreview_defaultavatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/mine/icon_userreview_defaultavatar.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/home/icon_homepage_foottreat_category.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/home/icon_homepage_foottreat_category.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/order/order_tab_needoffer_aftersale@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/order/order_tab_needoffer_aftersale@2x.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/home/icon_homepage_entertainment_category.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/home/icon_homepage_entertainment_category.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/home/icon_homepage_life_service_category.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/home/icon_homepage_life_service_category.png -------------------------------------------------------------------------------- /src/pages/demo/meituan/img/mine/icon_navigation_item_message_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxiee/MaxieeRNLab/HEAD/src/pages/demo/meituan/img/mine/icon_navigation_item_message_white.png -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'MaxieeRNLab' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | 4 | include ':app' 5 | -------------------------------------------------------------------------------- /src/common/utils/HomeUtils.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Text } from 'react-native-elements'; 3 | 4 | export function createHeader(title) { 5 | return {title} 8 | } -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip -------------------------------------------------------------------------------- /src/demo/ReactNativeUIDemo/CheckBoxes/index.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import { View, CheckBox } from 'react-native'; 3 | 4 | export default () => { 5 | return 6 | console.log("check = " + bool)} /> 7 | 8 | } -------------------------------------------------------------------------------- /src/common/screen.js: -------------------------------------------------------------------------------- 1 | import { Dimensions, Platform, PixelRatio } from 'react-native' 2 | 3 | export default { 4 | width: Dimensions.get('window').width, 5 | height: Dimensions.get('window').height, 6 | onePixel: 1 / PixelRatio.get(), 7 | statusBarHeight: (Platform.OS === 'ios' ? 20 : 0) 8 | } -------------------------------------------------------------------------------- /src/reducers/todo/actions/todo-add.js: -------------------------------------------------------------------------------- 1 | import { ACTION_TODO_ADD } from "../../../config/actions"; 2 | 3 | export default function todoAdd(item) { 4 | return (dispatch, getState) => { 5 | dispatch({ 6 | type: ACTION_TODO_ADD, 7 | payload: item 8 | }) 9 | } 10 | } -------------------------------------------------------------------------------- /ios/MaxieeRNLab.xcodeproj/contents.scworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | -------------------------------------------------------------------------------- /src/reducers/todo/actions/todo-finish.js: -------------------------------------------------------------------------------- 1 | import { ACTION_TODO_FINISH } from "../../../config/actions"; 2 | 3 | export default function todoFinish(id) { 4 | return (dispatch, getState) => { 5 | dispatch({ 6 | type: ACTION_TODO_FINISH, 7 | payload: id 8 | }) 9 | } 10 | } -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/reducers/todo/actions/todo-unfinish.js: -------------------------------------------------------------------------------- 1 | import { ACTION_TODO_UNFINISH } from "../../../config/actions"; 2 | 3 | export default function todoUnfinish(id) { 4 | return (dispatch, getState) => { 5 | dispatch({ 6 | type: ACTION_TODO_UNFINISH, 7 | payload: id 8 | }) 9 | } 10 | } -------------------------------------------------------------------------------- /__tests__/App.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import 'react-native'; 6 | import React from 'react'; 7 | import App from '../App'; 8 | 9 | // Note: test renderer must be required after react-native. 10 | import renderer from 'react-test-renderer'; 11 | 12 | it('renders correctly', () => { 13 | renderer.create(); 14 | }); 15 | -------------------------------------------------------------------------------- /src/demo/NavigationDemo/doc/DocHelloNavigation.js: -------------------------------------------------------------------------------- 1 | export default ` 2 | # Intro 3 | 4 | Getting start React Navigation. 5 | 6 | This doc shows the core code of the page. 7 | 8 | # Install 9 | 10 | visit doc page: [https://reactnavigation.org/docs/en/getting-started.html](https://reactnavigation.org/docs/en/getting-started.html) 11 | 12 | 13 | ` -------------------------------------------------------------------------------- /src/config/store.js: -------------------------------------------------------------------------------- 1 | import { combineReducers, createStore, applyMiddleware } from "redux"; 2 | import todo from '../reducers/todo/reducer'; 3 | import thunk from 'redux-thunk'; 4 | 5 | const rootReducer = combineReducers({ 6 | todo 7 | }); 8 | 9 | const store = createStore( 10 | rootReducer, 11 | applyMiddleware(thunk) 12 | ); 13 | 14 | export default store; -------------------------------------------------------------------------------- /src/demo/ReactNativeUIDemo/DemoSimpleView.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import { View } from 'react-native'; 3 | 4 | // import MessageQueue from 'react-native/Libraries/BatchedBridge/MessageQueue' 5 | // MessageQueue.spy(true) 6 | 7 | export default () => { 8 | return 12 | } -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | module.exports = { 8 | transformer: { 9 | getTransformOptions: async () => ({ 10 | transform: { 11 | experimentalImportSupport: false, 12 | inlineRequires: false, 13 | }, 14 | }), 15 | }, 16 | }; -------------------------------------------------------------------------------- /src/pages/template/TemplateHome.js: -------------------------------------------------------------------------------- 1 | import React, {PureComponent} from 'react'; 2 | import { ScrollView } from 'react-native'; 3 | 4 | export default class TemplateHome extends PureComponent { 5 | static navigationOptions = { 6 | title: 'Template' 7 | } 8 | 9 | render() { 10 | return ( 11 | 12 | 13 | 14 | ) 15 | } 16 | } -------------------------------------------------------------------------------- /ios/MaxieeRNLab/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (nonatomic, strong) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /ios/MaxieeRNLab/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /src/demo/ReactNativeUIDemo/demos/ReactNativeUIImage.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import { View, Image } from 'react-native'; 3 | 4 | export default () => { 5 | console.log("maxieeee :" + JSON.stringify(Image.getSize('react_native'))) 6 | 7 | return 8 | 16 | 17 | } -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | import React from "react"; 5 | import {AppRegistry, YellowBox} from 'react-native'; 6 | import App from './src/pages/home'; 7 | import {name as appName} from './app.json'; 8 | import { Provider } from 'react-redux' 9 | import store from './src/config/store'; 10 | 11 | 12 | YellowBox.ignoreWarnings([ 13 | 'Require cycle:', 14 | ]); 15 | 16 | class ConnectedApp extends React.Component { 17 | render() { 18 | return 19 | 20 | 21 | } 22 | } 23 | 24 | AppRegistry.registerComponent(appName, () => ConnectedApp); 25 | -------------------------------------------------------------------------------- /src/widgets/tab/bottom/TabBarItem.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react' 2 | import { Image } from 'react-native'; 3 | 4 | export default class TabBarItem extends Component { 5 | render() { 6 | let selectedImage = this.props.selectedImage ? 7 | this.props.selectedImage : this.props.normalImage; 8 | return ( 9 | 16 | ) 17 | } 18 | } -------------------------------------------------------------------------------- /android/app/build_defs.bzl: -------------------------------------------------------------------------------- 1 | """Helper definitions to glob .aar and .jar targets""" 2 | 3 | def create_aar_targets(aarfiles): 4 | for aarfile in aarfiles: 5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] 6 | lib_deps.append(":" + name) 7 | android_prebuilt_aar( 8 | name = name, 9 | aar = aarfile, 10 | ) 11 | 12 | def create_jar_targets(jarfiles): 13 | for jarfile in jarfiles: 14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] 15 | lib_deps.append(":" + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | -------------------------------------------------------------------------------- /ios/MaxieeRNLab/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /ios/MaxieeRNLabTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/demo/NavigationDemo/CustomHeader/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { View, Text, Button } from 'react-native'; 3 | 4 | class HeaderComp extends React.Component { 5 | render() { 6 | console.log(this.props) 7 | return ( 8 | 11 | {this.props.title} with CustomHeader 12 | 13 | ) 14 | } 15 | } 16 | 17 | export default class CustomHeader extends React.Component { 18 | static navigationOptions = { 19 | headerTitle: , 20 | title: 'CustomHeaderPage' // 无效 21 | } 22 | 23 | constructor(props) { 24 | super(props); 25 | 26 | } 27 | 28 | render() { 29 | return CustomHeader 30 | } 31 | } -------------------------------------------------------------------------------- /src/widgets/gridview/GridView.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { View, Text, StyleSheet } from 'react-native' 3 | import screen from '../../common/screen'; 4 | import GridItem from './GridItem'; 5 | 6 | export default (props) => { 7 | return ( 8 | 9 | {props.infos.map((info, index) => ( 10 | props.onGridSelected(index)} /> 14 | ))} 15 | 16 | ) 17 | } 18 | 19 | const styles = StyleSheet.create({ 20 | container: { 21 | flexDirection: 'row', 22 | flexWrap: 'wrap', 23 | justifyContent: 'space-between', 24 | borderTopWidth: screen.onePixel, 25 | borderLeftWidth: screen.onePixel, 26 | borderColor: '#e0e0e0' 27 | }, 28 | }) -------------------------------------------------------------------------------- /ios/MaxieeRNLab-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/demo/NavigationDemo/NavigationHello/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { View } from 'react-native' 3 | import Markdown from "react-native-markdown-renderer"; 4 | import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs' 5 | import DocHelloNavigation from "../doc/DocHelloNavigation"; 6 | 7 | let DocComp = () => 8 | {DocHelloNavigation} 9 | 10 | 11 | let CodeComp = () => 12 | 13 | const Tab = createMaterialTopTabNavigator(); 14 | 15 | export default () => { 16 | return ( 17 | 18 | 21 | 24 | 25 | ) 26 | } 27 | -------------------------------------------------------------------------------- /src/pages/basic/RNScrollableTabView.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { View } from 'react-native'; 3 | import { Heading2 } from '../../widgets/text/Text'; 4 | import ScrollableTabView from 'react-native-scrollable-tab-view'; 5 | import screen from '../../common/screen'; 6 | 7 | const SimpleTab = () => 8 | 9 | 10 | 11 | 12 | 13 | export default (props) => { 14 | return ( 15 | 16 | Simple 17 | 18 | 19 | ) 20 | } -------------------------------------------------------------------------------- /android/app/src/main/java/com/maxieernlab/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.maxieernlab; 2 | 3 | import com.facebook.react.ReactActivity; 4 | import com.facebook.react.ReactActivityDelegate; 5 | import com.facebook.react.ReactRootView; 6 | import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView; 7 | 8 | public class MainActivity extends ReactActivity { 9 | 10 | /** 11 | * Returns the name of the main component registered from JavaScript. 12 | * This is used to schedule rendering of the component. 13 | */ 14 | @Override 15 | protected String getMainComponentName() { 16 | return "MaxieeRNLab"; 17 | } 18 | 19 | @Override 20 | protected ReactActivityDelegate createReactActivityDelegate() { 21 | return new ReactActivityDelegate(this, getMainComponentName()) { 22 | @Override 23 | protected ReactRootView createRootView() { 24 | return new RNGestureHandlerEnabledRootView(MainActivity.this); 25 | } 26 | }; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | android.useAndroidX=true 20 | # Automatically convert third-party libraries to use AndroidX 21 | android.enableJetifier=true -------------------------------------------------------------------------------- /src/demo/ReactNativeUIDemo/buttons/GradientButton.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import LinearGradient from 'react-native-linear-gradient'; 3 | import { TouchableOpacity, Text, StyleSheet } from 'react-native'; 4 | 5 | export default ({text, style, ...props}) => 8 | 13 | { text } 14 | 15 | 16 | 17 | const styles = StyleSheet.create({ 18 | LinearGradientStyle: { 19 | height: 48, 20 | paddingLeft: 15, 21 | paddingRight: 15, 22 | borderRadius: 5, 23 | marginBottom: 20, 24 | alignItems: 'center', 25 | justifyContent: 'center' 26 | }, 27 | buttonText: { 28 | fontSize: 18, 29 | textAlign: 'center', 30 | margin: 7, 31 | color : '#fff', 32 | backgroundColor: 'transparent' 33 | }, 34 | }); -------------------------------------------------------------------------------- /src/reducers/todo/reducer.js: -------------------------------------------------------------------------------- 1 | import { ACTION_TODO_ADD, ACTION_TODO_FINISH, ACTION_TODO_UNFINISH } from "../../config/actions"; 2 | 3 | const initialState = { 4 | todos: [] 5 | } 6 | 7 | let toggleTodoFromTodos = (todos, id, status) => todos.map(v => { 8 | if (v.id !== id) { 9 | return v; 10 | } 11 | return { 12 | ...v, 13 | finished: status 14 | } 15 | }) 16 | 17 | const todoReducer = (state = initialState, { type, payload }) => { 18 | switch (type) { 19 | case ACTION_TODO_ADD: 20 | return { 21 | ...state, 22 | todos: [...state.todos, payload] 23 | } 24 | case ACTION_TODO_FINISH: 25 | return { 26 | ...state, 27 | todos: toggleTodoFromTodos(state.todos, payload, true) 28 | } 29 | case ACTION_TODO_UNFINISH: 30 | return { 31 | ...state, 32 | todos: toggleTodoFromTodos(state.todos, payload, false) 33 | } 34 | default: 35 | return state 36 | } 37 | } 38 | 39 | export default todoReducer -------------------------------------------------------------------------------- /src/widgets/navi/NavigationItem.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Image, Text, TouchableOpacity, StyleSheet } from 'react-native'; 3 | 4 | export default class NavigationItem extends React.Component { 5 | render() { 6 | let icon = this.props.icon && 7 | 8 | 9 | let title = this.props.title && 10 | {this.props.title} 11 | 12 | return ( 13 | 14 | {icon} 15 | {title} 16 | 17 | ) 18 | } 19 | } 20 | 21 | const styles = StyleSheet.create({ 22 | container: { 23 | flex: 1, 24 | flexDirection: 'row', 25 | justifyContent: 'center', 26 | alignItems: 'center', 27 | }, 28 | icon: { 29 | width: 27, 30 | height: 27, 31 | margin: 8, 32 | }, 33 | title: { 34 | fontSize: 15, 35 | color: '#333333', 36 | margin: 8, 37 | } 38 | }) -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | 24 | # Android/IntelliJ 25 | # 26 | build/ 27 | .idea 28 | .gradle 29 | local.properties 30 | *.iml 31 | android/captures/* 32 | .project 33 | .classpath 34 | .settings 35 | 36 | # node.js 37 | # 38 | node_modules/ 39 | npm-debug.log 40 | yarn-error.log 41 | 42 | # BUCK 43 | buck-out/ 44 | \.buckd/ 45 | *.keystore 46 | !debug.keystore 47 | 48 | # fastlane 49 | # 50 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 51 | # screenshots whenever they are needed. 52 | # For more information about the recommended setup visit: 53 | # https://docs.fastlane.tools/best-practices/source-control/ 54 | 55 | */fastlane/report.xml 56 | */fastlane/Preview.html 57 | */fastlane/screenshots 58 | 59 | # Bundle artifact 60 | *.jsbundle 61 | 62 | # CocoaPods 63 | /ios/Pods/ -------------------------------------------------------------------------------- /src/widgets/text/Text.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { StyleSheet, Text } from 'react-native' 3 | 4 | export function Heading1({ style, ...props }) { 5 | return 6 | } 7 | 8 | export function Heading2({ style, ...props }) { 9 | return 10 | } 11 | 12 | export function Heading3({ style, ...props }) { 13 | return 14 | } 15 | 16 | export function Paragraph({ style, ...props }) { 17 | return 18 | } 19 | 20 | export function Tip({ style, ...props }) { 21 | return 22 | } 23 | 24 | const styles = StyleSheet.create({ 25 | h1: { 26 | fontSize: 40, 27 | color: '#333333', 28 | }, 29 | h2: { 30 | fontSize: 15, 31 | fontWeight: 'bold', 32 | color: '#222222', 33 | }, 34 | h3: { 35 | fontSize: 14, 36 | color: '#222222', 37 | }, 38 | p: { 39 | fontSize: 13, 40 | color: '#777777', 41 | }, 42 | tip: { 43 | fontSize: 13, 44 | color: '#999999' 45 | } 46 | }) 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

MaxieeRNLab

2 | 3 |

4 | My React Native learning experiences
5 | Awesome React Native demos. 6 |

7 | 8 | MaxieeRNLab is my learning experiences of React Native. This project includes many aspect of developing a React 9 | Native: 10 | 11 | - A better understand of React Native Framework 12 | - Yoga layout engine 13 | - BatchedBridge message queue 14 | - React Navigation with react-navigation 15 | - stack navigator 16 | - material top tab navigator 17 | - custom bottom navigation with center button 18 | - Redux 19 | - Todo demo 20 | - UI 21 | - usage of react-native-paper 22 | - usage of react-native-elements 23 | 24 | ## Screenshots 25 | 26 | |HomePage|Yoga Layout Engine|Stack Navigator| 27 | |--|--|---| 28 | |![](./images/001.png)|![](./images/002.png)|![](./images/003.png)| 29 | |Redux Todo 1|Redux Todo 2|Custom Bottom Navigator| 30 | |![](./images/004.png)|![](./images/005.png)|![](./images/006.png)| 31 | |Material Top Tab|Image|Buttons| 32 | |![](./images/007.png)|![](./images/008.png)|![](./images/009.png)| 33 | |Chat Demo|Line Chart Demo|| 34 | |![](./images/010.png)|![](./images/011.png)|| -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "28.0.3" 6 | minSdkVersion = 16 7 | compileSdkVersion = 28 8 | targetSdkVersion = 28 9 | } 10 | repositories { 11 | google() 12 | jcenter() 13 | } 14 | dependencies { 15 | classpath("com.android.tools.build:gradle:3.4.2") 16 | 17 | // NOTE: Do not place your application dependencies here; they belong 18 | // in the individual module build.gradle files 19 | } 20 | } 21 | 22 | allprojects { 23 | repositories { 24 | mavenLocal() 25 | maven { 26 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 27 | url("$rootDir/../node_modules/react-native/android") 28 | } 29 | maven { 30 | // Android JSC is installed from npm 31 | url("$rootDir/../node_modules/jsc-android/dist") 32 | } 33 | google() 34 | jcenter() 35 | maven { url 'https://jitpack.io' } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/pages/demo/DemoHome.js: -------------------------------------------------------------------------------- 1 | import React, {PureComponent} from 'react'; 2 | import { ScrollView, View } from 'react-native'; 3 | import { Button } from 'react-native-elements'; 4 | 5 | export default class DemoHome extends PureComponent { 6 | static navigationOptions = { 7 | title: 'Demos' 8 | } 9 | 10 | render() { 11 | return ( 12 | 13 | 14 | 15 | 16 | 17 | 29 | 30 | 33 | Add Todo 34 | 35 | this.setState({ 40 | dialogInputTodoName: text 41 | })} /> 42 | 43 | 44 | 45 | 61 | 62 | 63 | 64 | { 65 | todo.todos.map((v,index) => ( 66 | { 71 | v.finished ? "DONE" : "TODO" 72 | }} 73 | right={props => } /> 79 | )) 80 | } 81 | 82 | 83 | } 84 | } 85 | 86 | const mapStateToProps = ({todo}) => ({todo}) 87 | const actions = {todoAdd, todoFinish, todoUnfinish} 88 | 89 | export default connect(mapStateToProps, actions)(Component) -------------------------------------------------------------------------------- /src/demo/NavigationDemo/Custom/BottomNavigation/HeartBeatBottomNavi/HeartBeatBottomNavigation.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { View, TouchableWithoutFeedback, StyleSheet } from 'react-native'; 3 | import Icon from 'react-native-vector-icons/Ionicons' 4 | 5 | const HEIGHT_TABBAR = 48 6 | const HEIGHT_CIRCLE = 56 7 | 8 | /** 9 | * references: 10 | * 1. https://medium.com/@sxia/how-to-customize-tab-bar-in-react-navigation-a0dc6d4d7e61 11 | * 2. https://maxiee.github.io/post/ReactNavigationCustomTabBar.md/ 12 | */ 13 | export default class HeartBeatBottomNavigation extends React.Component { 14 | constructor(props) { 15 | super(props) 16 | } 17 | 18 | renderIcon() { 19 | return 20 | } 21 | 22 | renderTabButton(route, index) { 23 | const { 24 | activeTintColor, 25 | inactiveTintColor, 26 | navigation, 27 | getLabelText, 28 | renderIcon 29 | } = this.props 30 | 31 | const currentIndex = navigation.state.index; 32 | const label = getLabelText({ route, focused: currentIndex === index, index: index }); 33 | 34 | return ( 35 | 37 | { 39 | navigation.navigate(route.routeName) 40 | }}> 41 | 42 | {this.renderIcon()} 43 | {/* {label} */} 46 | 47 | 48 | 49 | ) 50 | } 51 | 52 | render() { 53 | const { navigation, style } = this.props; 54 | let tabBarButtons = navigation.state.routes.map(this.renderTabButton.bind(this)); 55 | 56 | tabBarButtons.splice(2, 0, 57 | ) 61 | 62 | return ( 63 | 64 | 65 | {tabBarButtons} 66 | 67 | 68 | 72 | 73 | 74 | ); 75 | } 76 | } 77 | 78 | const styles = StyleSheet.create({ 79 | container: { 80 | flex: 1, 81 | justifyContent: 'center', 82 | alignItems: 'center', 83 | height: HEIGHT_CIRCLE 84 | }, 85 | tabbarContainer: { 86 | position: 'absolute', 87 | bottom: 0, 88 | left: 0, 89 | right: 0, 90 | borderTopWidth: 0.5, 91 | height: HEIGHT_TABBAR, 92 | flex: 1, 93 | justifyContent: 'space-evenly', 94 | flexDirection: 'row', 95 | borderTopColor: "#CCCCCC", 96 | }, 97 | circleButton: { 98 | width: HEIGHT_CIRCLE, 99 | height: HEIGHT_CIRCLE, 100 | position: 'absolute', 101 | bottom: 4, 102 | borderRadius: HEIGHT_CIRCLE/2, 103 | backgroundColor: 'pink', 104 | borderWidth: 0.5, 105 | borderColor: 'white', 106 | flex: 1, 107 | justifyContent: 'center', 108 | alignItems: 'center', 109 | }, 110 | tabButtonSizer: { 111 | height: HEIGHT_TABBAR, 112 | width: HEIGHT_TABBAR, 113 | }, 114 | tabButtonContainer: { 115 | flex: 1, 116 | flexDirection: 'column', 117 | justifyContent: 'center', 118 | alignItems: 'center', 119 | } 120 | }) -------------------------------------------------------------------------------- /android/app/src/main/java/com/maxieernlab/yoga/YogaActivity1.java: -------------------------------------------------------------------------------- 1 | package com.maxieernlab.yoga; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.util.Log; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.FrameLayout; 9 | 10 | import androidx.appcompat.app.AppCompatActivity; 11 | 12 | import com.facebook.yoga.YogaEdge; 13 | import com.facebook.yoga.YogaFlexDirection; 14 | import com.facebook.yoga.YogaNode; 15 | import com.facebook.yoga.YogaNodeJNIFinalizer; 16 | 17 | import java.util.ArrayList; 18 | 19 | import javax.annotation.Nullable; 20 | 21 | public class YogaActivity1 extends AppCompatActivity { 22 | private static final int VIEW_WIDTH = 200; 23 | 24 | private float screenHeight; 25 | private float screenWidth; 26 | 27 | private ArrayList poolView = new ArrayList<>(); 28 | private ArrayList poolNode = new ArrayList<>(); 29 | 30 | private String[][] colors = new String[][] { 31 | new String[] { "#d50000", "#ff1744", "#ff5252", "#ff8a80" }, 32 | new String[] { "#c51162", "#f50057", "#ff4081", "#ff80ab" }, 33 | new String[] { "#aa00ff", "#d500f9", "#e040fb", "#ea80fc" }, 34 | new String[] { "#6200ea", "#651fff", "#7c4dff", "#b388ff" } 35 | }; 36 | 37 | @Override 38 | protected void onCreate(@Nullable Bundle savedInstanceState) { 39 | super.onCreate(savedInstanceState); 40 | 41 | FrameLayout container = new FrameLayout(this); 42 | 43 | screenWidth = getWindowManager().getDefaultDisplay().getWidth(); 44 | screenHeight = getWindowManager().getDefaultDisplay().getHeight(); 45 | log("Screen size = (%f, %f)", screenWidth, screenHeight); 46 | 47 | YogaNode root = new YogaNodeJNIFinalizer(); 48 | root.setWidth(screenWidth); 49 | root.setHeight(screenHeight); 50 | root.setFlexDirection(YogaFlexDirection.COLUMN); 51 | 52 | log("start"); 53 | createRow1(root, 0); 54 | createRow1(root, 1); 55 | createRow1(root, 2); 56 | createRow1(root, 3); 57 | 58 | root.calculateLayout(screenWidth, screenHeight); 59 | 60 | for (int i = 0; i < poolView.size(); i++) { 61 | View v = poolView.get(i); 62 | YogaNode n = poolNode.get(i); 63 | YogaNode r = n.getOwner(); 64 | v.setX(r.getLayoutX() + n.getLayoutX()); 65 | v.setY(r.getLayoutY() + n.getLayoutY()); 66 | log("v%d position=(%f, %f)", 67 | i, 68 | r.getLayoutX() + n.getLayoutX(), 69 | r.getLayoutY() + n.getLayoutY()); 70 | container.addView(v); 71 | } 72 | 73 | log("end"); 74 | 75 | setContentView(container); 76 | } 77 | 78 | private void createRow1(YogaNode root, int index) { 79 | log("create index = " + index); 80 | YogaNode row = new YogaNodeJNIFinalizer(); 81 | row.setHeight(VIEW_WIDTH); 82 | row.setWidth(VIEW_WIDTH * 4); 83 | row.setFlexDirection(YogaFlexDirection.ROW); 84 | row.setMargin(YogaEdge.ALL, 20); 85 | 86 | for (int i = 0; i < 4; i++) { 87 | YogaNode n = new YogaNodeJNIFinalizer(); 88 | n.setWidth(VIEW_WIDTH); 89 | n.setHeight(VIEW_WIDTH); 90 | View v = createView(colors[index][i]); 91 | row.addChildAt(n, i); 92 | poolNode.add(n); 93 | poolView.add(v); 94 | } 95 | 96 | root.addChildAt(row, index); 97 | } 98 | 99 | private View createView(String color) { 100 | View v = new View(this); 101 | v.setBackgroundColor(Color.parseColor(color)); 102 | ViewGroup.LayoutParams lp = new FrameLayout.LayoutParams(VIEW_WIDTH, VIEW_WIDTH); 103 | v.setLayoutParams(lp); 104 | return v; 105 | } 106 | 107 | private void log(String template, Object... objects) { 108 | Log.d("max-yoga", String.format(template, objects)); 109 | } 110 | } -------------------------------------------------------------------------------- /src/pages/demo/meituan/home/MTHomeScene.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react' 2 | import { TouchableOpacity, Image, Text, StyleSheet, View, FlatList, StatusBar, Linking } from 'react-native'; 3 | import { Paragraph, Heading3 } from '../../../../widgets/text/Text'; 4 | import screen from '../../../../common/screen'; 5 | import NavigationItem from '../../../../widgets/navi/NavigationItem'; 6 | import MTAPI from '../common/MTAPI'; 7 | import { GroupPurchaseCell } from '../widget/GroupPrchaseCell'; 8 | import MTHomeMenuView from './MTHomeMenuView'; 9 | import GridView from '../../../../widgets/gridview/GridView'; 10 | 11 | const styles = StyleSheet.create({ 12 | container: { 13 | flex: 1, 14 | backgroundColor: '#f3f3f3' 15 | }, 16 | searchBar: { 17 | width: screen.width * 0.7, 18 | height: 30, 19 | borderRadius: 19, 20 | flexDirection: 'row', 21 | justifyContent: 'center', 22 | alignItems: 'center', 23 | backgroundColor: 'white', 24 | alignSelf: 'center', 25 | }, 26 | searchIcon: { 27 | width: 20, 28 | height: 20, 29 | margin: 5, 30 | } 31 | }); 32 | 33 | export default class HomeScene extends Component { 34 | static navigationOptions = { 35 | headerTitle: ( 36 | 37 | 40 | 搜索 41 | 42 | ), 43 | headerRight: ( 44 | 46 | ), 47 | headerLeft: ( 48 | 52 | ), 53 | headerStyle: { backgroundColor: '#21C0AE' } 54 | } 55 | 56 | constructor(props) { 57 | super(props); 58 | 59 | this.state = { 60 | discounts: [], 61 | dataList: [], 62 | refreshing: false, 63 | } 64 | } 65 | 66 | componentDidMount() { 67 | this.requestData(); 68 | } 69 | 70 | requestData = () => { 71 | this.setState({ refreshing: true }); 72 | 73 | this.requestRecommand(); 74 | this.requestDiscout(); 75 | } 76 | 77 | requestRecommand = async () => { 78 | try { 79 | let response = await fetch(MTAPI.recommend); 80 | let json = await response.json(); 81 | 82 | let dataList = json.data.map(info => { 83 | return { 84 | id: info.id, 85 | imageUrl: info.squareimgurl, 86 | title: info.mname, 87 | subtitle: `[${info.range}]${info.title}`, 88 | price: info.price 89 | } 90 | }) 91 | 92 | this.setState({ 93 | dataList: dataList, 94 | refreshing: false 95 | }) 96 | } catch (error) { 97 | this.setState({ refreshing: false }) 98 | } 99 | } 100 | 101 | requestDiscout = async () => { 102 | try { 103 | let json = MTAPI.discount; 104 | this.setState({ discounts: json.data }) 105 | } catch (error) { 106 | alert(error) 107 | } 108 | } 109 | 110 | renderCell = (info) => { 111 | return ( 112 | 115 | ) 116 | } 117 | 118 | onCellSelected = (info) => { 119 | StatusBar.setBarStyle('default', false); 120 | 121 | } 122 | 123 | keyExtractor = (item, index) => { 124 | return item.id.toString(); 125 | } 126 | 127 | renderHeader = () => { 128 | return ( 129 | 130 | Linking.openURL("https://github.com/huanxsd/MeiTuan")}> 132 | 本高仿美团项目代码来源自 huanxsd/MeiTuan 138 | 139 | 140 | 141 | 142 | 143 | 144 | 猜你喜欢 145 | 146 | 147 | ) 148 | } 149 | 150 | 151 | render() { 152 | return ( 153 | 154 | 160 | 161 | ) 162 | } 163 | } -------------------------------------------------------------------------------- /src/pages/demo/meituan/mine/MTMineScene.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react' 2 | import { View, StyleSheet, ScrollView, RefreshControl, Text, Image } from 'react-native'; 3 | import NavigationItem from '../../../../widgets/navi/NavigationItem'; 4 | import screen from '../../../../common/screen'; 5 | import DetailCell from './MTDetailCell'; 6 | import { Heading2, Paragraph } from '../../../../widgets/text/Text'; 7 | 8 | const styles = StyleSheet.create({ 9 | icon: { 10 | width: 27, 11 | height: 27, 12 | }, 13 | header: { 14 | backgroundColor: "#21C0AE", 15 | paddingBottom: 20, 16 | flexDirection: 'row', 17 | alignItems: 'center', 18 | margin: 10, 19 | }, 20 | avatar: { 21 | width: 50, 22 | height: 50, 23 | marginRight: 10, 24 | borderRadius: 25, 25 | borderWidth: 2, 26 | borderColor: '#51D3C6' 27 | } 28 | }) 29 | 30 | export class MTMineScene extends Component { 31 | static navigationOptions = { 32 | headerRight: ( 33 | 34 | 36 | 38 | 39 | ), 40 | headerStyle: { 41 | backgroundColor: "#21C0AE", 42 | elevation: 0, 43 | borderBottomWidth: 0 44 | } 45 | } 46 | 47 | constructor(props) { 48 | super(props); 49 | 50 | this.state = { 51 | isRefreshing: false 52 | } 53 | } 54 | 55 | onHeaderRefresh() { 56 | this.setState({ isRefreshing: true}); 57 | 58 | setTimeout(() => { 59 | this.setState({ isRefreshing: false}) 60 | }, 2000); 61 | } 62 | 63 | renderCells() { 64 | let cells = [] 65 | let dataList = this.getDataList(); 66 | dataList.forEach((l, index) => { 67 | l.forEach(data => { 68 | cells.push() 73 | }) 74 | cells.push() 75 | }) 76 | return cells; 77 | } 78 | 79 | renderHeader() { 80 | return ( 81 | 82 | 83 | 84 | 85 | Maxiee 86 | 87 | 88 | 个人信息 > 89 | 90 | 91 | ) 92 | } 93 | 94 | render() { 95 | return ( 96 | 97 | 103 | this.onHeaderRefresh()} 108 | tintColor='gray' /> 109 | }> 110 | {this.renderHeader()} 111 | 112 | {this.renderCells()} 113 | 114 | 115 | ) 116 | } 117 | 118 | getDataList() { 119 | return ( 120 | [ 121 | [ 122 | { title: '我的钱包', subtitle: '办信用卡', image: require('../img/mine/icon_mine_wallet.png') }, 123 | { title: '余额', subtitle: '¥95872385', image: require('../img/mine/icon_mine_balance.png') }, 124 | { title: '抵用券', subtitle: '63', image: require('../img/mine/icon_mine_voucher.png') }, 125 | { title: '会员卡', subtitle: '2', image: require('../img/mine/icon_mine_membercard.png') } 126 | ], 127 | [ 128 | { title: '好友去哪', image: require('../img/mine/icon_mine_friends.png') }, 129 | { title: '我的评价', image: require('../img/mine/icon_mine_comment.png') }, 130 | { title: '我的收藏', image: require('../img/mine/icon_mine_collection.png') }, 131 | { title: '会员中心', subtitle: 'v15', image: require('../img/mine/icon_mine_membercenter.png') }, 132 | { title: '积分商城', subtitle: '好礼已上线', image: require('../img/mine/icon_mine_member.png') } 133 | ], 134 | [ 135 | { title: '客服中心', image: require('../img/mine/icon_mine_customerService.png') }, 136 | { title: '关于美团', subtitle: '我要合作', image: require('../img/mine/icon_mine_aboutmeituan.png') } 137 | ] 138 | ] 139 | ) 140 | } 141 | } -------------------------------------------------------------------------------- /src/pages/demo/twitter/TwitterHome.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | 3 | import Icon from 'react-native-vector-icons/Ionicons'; 4 | import { Animated, StyleSheet, View, Text, Easing } from 'react-native'; 5 | import { FacebookTabBar } from './TwitterTab'; 6 | import TwitterPost from './TwitterPost'; 7 | import screen from '../../../common/screen'; 8 | import ScrollableTabView from 'react-native-scrollable-tab-view'; 9 | 10 | const AnimatedIcon = Animated.createAnimatedComponent(Icon); 11 | 12 | const styles = StyleSheet.create({ 13 | navAndroid: { 14 | backgroundColor: '#3195d7', 15 | width: screen.width, 16 | height: 55, 17 | flexDirection: 'row', 18 | justifyContent: 'space-between', 19 | paddingTop: 15, 20 | paddingLeft: 20, 21 | paddingRight: 10, 22 | }, 23 | logoContainer: { 24 | flexDirection: 'row', 25 | justifyContent: 'flex-start' 26 | }, 27 | }) 28 | 29 | class Entrance extends Component { 30 | constructor(props) { 31 | super(props); 32 | this.state = { 33 | transformAnim: new Animated.Value(1), 34 | opacityAnim: new Animated.Value(1), 35 | } 36 | } 37 | 38 | componentDidMount() { 39 | Animated.timing( 40 | this.state.transformAnim, 41 | { 42 | toValue: 50, 43 | duration: 1200, 44 | delay: 2000, 45 | easing: Easing.elastic(2) 46 | } 47 | ).start(); 48 | Animated.timing( 49 | this.state.opacityAnim, 50 | { 51 | toValue: 0, 52 | duration: 800, 53 | easing: Easing.elastic(1), 54 | delay: 2200 55 | } 56 | ).start(); 57 | setTimeout(() => { 58 | this.props.hideThis(); 59 | }, 3300); 60 | } 61 | 62 | render() { 63 | return ( 64 | 74 | 84 | 85 | ) 86 | } 87 | 88 | } 89 | 90 | export default class TwitterTab extends Component { 91 | static navigationOptions = { 92 | header: null 93 | } 94 | 95 | constructor(props) { 96 | super(props); 97 | this.state = { 98 | selectedTab: '主页', 99 | title: "主页", 100 | show: true 101 | }; 102 | } 103 | 104 | changeTab(tabName) { 105 | this.setState({ 106 | selectedTab: tabName 107 | }); 108 | } 109 | 110 | updateTitle(obj) { 111 | const {i} = obj; 112 | let title = ""; 113 | switch(i) { 114 | case 0: 115 | title = "主页"; 116 | break; 117 | case 1: 118 | title = "通知"; 119 | break; 120 | case 2: 121 | title = "私信"; 122 | break; 123 | case 3: 124 | title = "我"; 125 | break; 126 | } 127 | this.setState({ 128 | title 129 | }); 130 | } 131 | 132 | render() { 133 | let entrance = this.state.show ? this.setState({show: false})} /> : 134 | return ( 135 | 136 | 137 | 138 | 139 | 140 | Twitter 141 | 142 | 143 | 144 | 145 | 146 | 147 | this.updateTitle(obj)} 149 | tabBarPosition='bottom' 150 | renderTabBar={() => null}/>}> 151 | 152 | 153 | 154 | 155 | 156 | 157 | {entrance} 158 | 159 | ) 160 | } 161 | } -------------------------------------------------------------------------------- /ios/MaxieeRNLab.xcodeproj/xcshareddata/xcschemes/MaxieeRNLab.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /ios/MaxieeRNLab.xcodeproj/xcshareddata/xcschemes/MaxieeRNLab-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /src/pages/home/HomeBasic.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import { View, ScrollView } from 'react-native'; 3 | import Icon from 'react-native-vector-icons/Ionicons'; 4 | import IntentLauncher from 'react-native-intent-launcher'; 5 | import GridView from '../../widgets/gridview/GridView'; 6 | import { createHeader } from '../../common/utils/HomeUtils'; 7 | 8 | export default class HomeUsage extends React.Component { 9 | static navigationOptions = { 10 | title: 'Basic' 11 | } 12 | 13 | render() { 14 | let infosYoga = [ 15 | { 16 | title: "Simple Demo", 17 | subtitle: "layouting 3 views", 18 | onPress: () => IntentLauncher.startActivity({ 19 | className: 'com.maxieernlab.yoga.YogaActivity2' 20 | }) 21 | }, { 22 | title: "Complex Demo", 23 | subtitle: "layouting 16 views", 24 | onPress: () => IntentLauncher.startActivity({ 25 | className: 'com.maxieernlab.yoga.YogaActivity1' 26 | }) 27 | }, 28 | ]; 29 | 30 | let infosWidgets = [ 31 | { 32 | title: "Buttons", 33 | icon: , 34 | subtitle: "", 35 | onPress: () => this.props.navigation.navigate("DemoButton") 36 | }, 37 | { 38 | title: "CheckBoxes", 39 | icon: , 40 | subtitle: "", 41 | onPress: () => this.props.navigation.navigate("DemoCheckBoxes") 42 | }, 43 | { 44 | title: "Simple View", 45 | icon: , 46 | subtitle: "", 47 | onPress: () => this.props.navigation.navigate("DemoSimpleView") 48 | }, 49 | { 50 | title: "Image", 51 | icon: , 52 | subtitle: "", 53 | onPress: () => this.props.navigation.navigate("ReactNativeUIImage") 54 | }, 55 | { 56 | title: "ScrollView", 57 | icon: , 58 | subtitle: "", 59 | onPress: () => this.props.navigation.navigate("RNBasicScrollView") 60 | } 61 | ]; 62 | 63 | let infosThirdParty = [ 64 | { 65 | title: 'react-native-swiper', 66 | subtitle: '', 67 | icon: , 68 | onPress: () => this.props.navigation.navigate("RNThirdSwiper") 69 | }, 70 | { 71 | title: 'react-native-scrollable-tab-view', 72 | subtitle: '', 73 | icon: , 74 | onPress: () => this.props.navigation.navigate("RNScrollableTabView") 75 | } 76 | ] 77 | 78 | let infosReactNavigation = [ 79 | { 80 | title: "Simple Stack", 81 | subtitle: "", 82 | icon: , 83 | onPress: () => this.props.navigation.navigate("StackDemo") 84 | }, 85 | { 86 | title: "Custom Header", 87 | subtitle: "", 88 | icon: , 89 | onPress: () => this.props.navigation.navigate("CustomHeader") 90 | }, 91 | ] 92 | 93 | let infosTemplate = [ 94 | { 95 | title: "Login Demo 1", 96 | subtitle: "", 97 | onPress: () => this.props.navigation.navigate("DemoLogin1") 98 | } 99 | ] 100 | 101 | return ( 102 | 103 | {createHeader("Yoga Demo")} 104 | infosYoga[index].onPress()} /> 107 | 108 | {createHeader("RN Widgets")} 109 | infosWidgets[index].onPress()} /> 112 | 113 | {createHeader("3rd Party Widgets")} 114 | infosThirdParty[index].onPress()} /> 117 | 118 | {createHeader("React Navigation")} 119 | infosReactNavigation[index].onPress()} /> 122 | 123 | {createHeader("Template Page")} 124 | infosTemplate[index].onPress()} /> 127 | {/* 128 | // this.createHeader("React Navigation"), 129 | // this.createLink("HeartBeat BottomNavigation 1", "HeartBeatBottomNavi"), 130 | // this.createLink("Material Top Navigation", "NavigationHello"), 131 | // this.createHeader("Redux"), 132 | // this.createLink("Redux Todo Demo", "ReduxTodo"), 133 | // this.createHeader("IM"), 134 | // this.createLink("Gifted Chat Demo", "ChatDemo"), 135 | // this.createHeader("Chart"), 136 | // this.createLink("Line Chart Demo", "DemoLineChart") */} 137 | ) 138 | } 139 | } -------------------------------------------------------------------------------- /src/pages/basic/RNThirdSwiper.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { Text, View, ScrollView, StyleSheet, Button, Image } from 'react-native'; 3 | import Swiper from 'react-native-swiper' 4 | import { createStackNavigator } from '@react-navigation/stack'; 5 | import GridView from '../../widgets/gridview/GridView'; 6 | import Icon from 'react-native-vector-icons/Ionicons'; 7 | 8 | const styles = StyleSheet.create({ 9 | slide1: { 10 | flex: 1, 11 | justifyContent: 'center', 12 | alignItems: 'center', 13 | backgroundColor: '#9DD6EB' 14 | }, 15 | slide2: { 16 | flex: 1, 17 | justifyContent: 'center', 18 | alignItems: 'center', 19 | backgroundColor: '#97CAE5' 20 | }, 21 | slide3: { 22 | flex: 1, 23 | justifyContent: 'center', 24 | alignItems: 'center', 25 | backgroundColor: '#92BBD9' 26 | }, 27 | text: { 28 | color: '#fff', 29 | fontSize: 30, 30 | fontWeight: 'bold' 31 | }, 32 | slide: { 33 | flex: 1, 34 | justifyContent: 'center', 35 | alignItems: 'center', 36 | }, 37 | }) 38 | 39 | const BasicDemo = () => { 40 | return ( 41 | 42 | 43 | Hello Swiper 44 | 45 | 46 | Beautiful 47 | 48 | 49 | And simple 50 | 51 | 52 | ) 53 | } 54 | 55 | const VerticalDemo = () => { 56 | return ( 57 | 58 | 59 | Hello Swiper 60 | 61 | 62 | Beautiful 63 | 64 | 65 | And simple 66 | 67 | 68 | ) 69 | } 70 | 71 | const ImageDemo = () => { 72 | return ( 73 | 74 | 83 | } 84 | activeDot={ 85 | 92 | } 93 | paginationStyle={{ 94 | bottom: -23, 95 | left: null, 96 | right: 10 97 | }}> 98 | Aussie tourist dies at Bali hotel
}> 99 | 100 |
101 | Big lie behind Nine’s new show}> 102 | 103 | 104 | Why Stone split from Garfield}> 105 | 106 | 107 | Learn from Kim K to land that job}> 108 | 109 | 110 | 111 | 112 | ) 113 | } 114 | 115 | const HomeDemo = (props) => { 116 | let infos = [ 117 | { 118 | title: "Basic", 119 | subtitle: "", 120 | icon: , 121 | onPress: () => props.navigation.push('Basic') 122 | }, 123 | { 124 | title: "Vertical", 125 | subtitle: "autoplay", 126 | icon: , 127 | onPress: () => props.navigation.push('Vertical') 128 | }, 129 | { 130 | title: "Image", 131 | subtitle: "", 132 | icon: , 133 | onPress: () => props.navigation.push('Image') 134 | }, 135 | ]; 136 | 137 | return ( 138 | 139 | infos[index].onPress()}/> 142 | 143 | ) 144 | } 145 | 146 | const Stack = createStackNavigator(); 147 | 148 | export default () => { 149 | return ( 150 | 151 | 154 | 157 | 160 | 163 | 164 | ) 165 | } 166 | 167 | // const Stack = createStackNavigator({ 168 | // Home: HomeDemo, 169 | // Basic: BasicDemo, 170 | // Vertical: VerticalDemo, 171 | // Image: ImageDemo 172 | // }, { 173 | // headerMode: "none" 174 | // }); 175 | 176 | // export default Stack; -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin, switch paths to Windows format before running java 129 | if $cygwin ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=$((i+1)) 158 | done 159 | case $i in 160 | (0) set -- ;; 161 | (1) set -- "$args0" ;; 162 | (2) set -- "$args0" "$args1" ;; 163 | (3) set -- "$args0" "$args1" "$args2" ;; 164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=$(save "$@") 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 185 | cd "$(dirname "$0")" 186 | fi 187 | 188 | exec "$JAVACMD" "$@" 189 | -------------------------------------------------------------------------------- /src/pages/home/index.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import { NavigationContainer } from '@react-navigation/native'; 3 | import { createStackNavigator } from '@react-navigation/stack'; 4 | import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; 5 | import HomeBasic from './HomeBasic'; 6 | import DemoSimpleView from '../../demo/ReactNativeUIDemo/DemoSimpleView'; 7 | import DemoButton from '../../demo/ReactNativeUIDemo/DemoButton'; 8 | import DemoLogin1 from '../../demo/LoginDemo/DemoLogin1'; 9 | import ChatDemo from '../../demo/ChatDemo'; 10 | import DemoLineChart from '../../demo/ChartDemo/DemoLineChart'; 11 | import NavigationHello from '../../demo/NavigationDemo/NavigationHello'; 12 | import StackDemo from '../../demo/NavigationDemo/StackDemo' 13 | import HeartBeatBottomNavi from '../../demo/NavigationDemo/Custom/BottomNavigation/HeartBeatBottomNavi'; 14 | import ReactNativeUIImage from '../../demo/ReactNativeUIDemo/demos/ReactNativeUIImage'; 15 | import ReduxTodo from '../../demo/ReduxDemo/demos/ReduxTodo' 16 | import TemplateHome from '../template/TemplateHome'; 17 | import DemoHome from '../demo/DemoHome'; 18 | // Demos 19 | import MeituanHome from '../demo/meituan/MeituanHome'; 20 | import RNBasicScrollView from '../basic/RNBasicScrollView'; 21 | import RNThirdSwiper from '../basic/RNThirdSwiper'; 22 | import StopWatchHome from '../demo/StopWatch/StopWatchHome'; 23 | import WeatherHome from '../demo/weather/WeatherHome'; 24 | import TwitterHome from '../demo/twitter/TwitterHome'; 25 | import RNScrollableTabView from '../basic/RNScrollableTabView'; 26 | import MyLocationHome from '../demo/mylocation/MyLocationHome'; 27 | import CustomHeader from '../../demo/NavigationDemo/CustomHeader'; 28 | 29 | // const Tab = createBottomTabNavigator({ 30 | // Home: { 31 | // screen: createStackNavigator({Home: HomeBasic}), 32 | // navigationOptions: { 33 | // tabBarLabel: 'Basic' 34 | // } 35 | // }, 36 | // Template: { 37 | // screen: createStackNavigator({Template: TemplateHome}), 38 | // navigationOptions: { 39 | // tabBarLabel: 'Template' 40 | // } 41 | // }, 42 | // Demo: { 43 | // screen: createStackNavigator({Demo: DemoHome}), 44 | // navigationOptions: { 45 | // tabBarLabel: 'Demo' 46 | // } 47 | // } 48 | // }); 49 | 50 | // Tab.navigationOptions = { 51 | // header: null 52 | // } 53 | 54 | // const AppNavigator = createStackNavigator({ 55 | // Tab: { screen: Tab }, 56 | // DemoSimpleView: DemoSimpleView, 57 | // // React Navigation 58 | // NavigationHello: NavigationHello, 59 | // StackDemo: StackDemo, 60 | // CustomHeader: CustomHeader, 61 | // HeartBeatBottomNavi: HeartBeatBottomNavi, 62 | // ReactNativeUIImage: ReactNativeUIImage, 63 | // // Redux Demo 64 | // ReduxTodo: ReduxTodo, 65 | // DemoButton: DemoButton, 66 | // DemoLogin1: DemoLogin1, 67 | // // Chat Demo 68 | // ChatDemo: ChatDemo, 69 | // // Charts 70 | // DemoLineChart: DemoLineChart, 71 | // // Demos 72 | // MeituanHome: MeituanHome, 73 | // StopWatch: StopWatchHome, 74 | // Weather: WeatherHome, 75 | // Twitter: TwitterHome, 76 | // // RN Basic 77 | // RNBasicScrollView: RNBasicScrollView, 78 | // RNScrollableTabView: RNScrollableTabView, 79 | // // Third Party Widgets 80 | // RNThirdSwiper: RNThirdSwiper, 81 | // MyLocation: MyLocationHome, 82 | 83 | // }, { 84 | // defaultNavigationOptions: { 85 | // headerBackTitle: null, 86 | // headerTintColor: '#333333', 87 | // showIcon: true, 88 | // } 89 | // }); 90 | 91 | // const AppContainer = createAppContainer(AppNavigator); 92 | 93 | const Stack = createStackNavigator(); 94 | const Tab = createBottomTabNavigator(); 95 | 96 | const HomeTabs = () => { 97 | return ( 98 | 99 | 102 | 105 | 108 | 109 | ) 110 | } 111 | 112 | class HomePage extends React.Component { 113 | 114 | render() { 115 | return 116 | 118 | 121 | 124 | 127 | 130 | 133 | 136 | 139 | 142 | 145 | 148 | 151 | 154 | 157 | 160 | 163 | 166 | 169 | 172 | 175 | 178 | 179 | 180 | } 181 | } 182 | 183 | export default HomePage; -------------------------------------------------------------------------------- /src/pages/demo/meituan/common/MTAPI.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Liu Jinyong 3 | * All rights reserved. 4 | * 5 | * https://github.com/huanxsd/MeiTuan 6 | * @flow 7 | */ 8 | 9 | 10 | export default { 11 | recommend: 'http://api.meituan.com/group/v1/recommend/homepage/city/1?__skck=40aaaf01c2fc4801b9c059efcd7aa146&__skcy=mrUZYo7999nH8WgTicdfzaGjaSQ=&__skno=51156DC4-B59A-4108-8812-AD05BF227A47&__skts=1434530933.303717&__skua=bd6b6e8eadfad15571a15c3b9ef9199a&__vhost=api.mobile.meituan.com&ci=1&client=iphone&limit=40&movieBundleVersion=100&msid=48E2B810-805D-4821-9CDD-D5C9E01BC98A2015-06-17-14-50363&offset=0&position=39.983497,116.318042&userId=10086&userid=10086&utm_campaign=AgroupBgroupD100Fab_chunceshishuju__a__a___b1junglehomepagecatesort__b__leftflow___ab_gxhceshi__nostrategy__leftflow___ab_gxhceshi0202__b__a___ab_pindaochangsha__a__leftflow___ab_xinkeceshi__b__leftflow___ab_gxtest__gd__leftflow___ab_gxh_82__nostrategy__leftflow___ab_pindaoshenyang__a__leftflow___i_group_5_2_deallist_poitype__d__d___ab_b_food_57_purepoilist_extinfo__a__a___ab_trip_yidizhoubianyou__b__leftflow___ab_i_group_5_3_poidetaildeallist__a__b___ab_waimaizhanshi__b__b1___a20141120nanning__m1__leftflow___ab_pind', 12 | 13 | 14 | 15 | discount: { 16 | "stid": "836121754643660800", 17 | "data": [ 18 | { "typeface_color": "#ff9900", "position": 0, "module": false, "maintitle": "莫莉幻想", "type": 1, "deputytitle": "5人行4人免", "solds": 0, "id": 6156, "share": { "message": "莫莉幻想优惠来袭", "url": "http%3A%2F%2Fi.meituan.com%2Ffirework%2Fpd1490755747%3F" }, "title": "莫莉幻想", "deputy_typeface_color": "#21c0ae", "tplurl": "imeituan://www.meituan.com/web?url=http://i.meituan.com/firework/ox1491533539", "imageurl": require('../img/home/icon_homepage_food_category.png') }, 19 | { "typeface_color": "#f6687d", "position": 0, "module": false, "maintitle": "大片特惠", "type": 1, "deputytitle": "速度与激情8", "solds": 0, "id": 6121, "share": { "message": "热门大片特惠,福利再来一波>>", "url": "http://i.meituan.com/firework/ox1491533539" }, "title": "大片特惠", "deputy_typeface_color": "#c280fc", "tplurl": "imeituan://www.meituan.com/web?url=http://i.meituan.com/firework/ox1491533539", "imageurl": require('../img/home/icon_homepage_food_category.png') }, 20 | { "typeface_color": "#6bbd00", "position": 0, "module": false, "maintitle": "清仓特价", "type": 1, "deputytitle": "1元巴厘岛", "solds": 0, "id": 6140, "share": { "message": "清仓特价,1元巴厘岛", "url": "http%3a%2f%2fi.meituan.com%2ffirework%2foverseaWeekend" }, "title": "清仓特价", "deputy_typeface_color": "#fc6a56", "tplurl": "imeituan://www.meituan.com/web?url=http://i.meituan.com/firework/ox1491533539", "imageurl": require('../img/home/icon_homepage_food_category.png') }, 21 | { "typeface_color": "#06c1ae", "position": 0, "module": false, "maintitle": "今日推荐", "type": 1, "deputytitle": "品质生活指南", "solds": 0, "id": 3283, "share": { "message": "吃喝玩乐全都有,尽在美团网!", "url": "http://api.mobile.meituan.com/group/v1/re/p" }, "title": "今日推荐", "deputy_typeface_color": "#fdb32b", "tplurl": "imeituan://www.meituan.com/web?url=http://i.meituan.com/firework/ox1491533539", "imageurl": require('../img/home/icon_homepage_food_category.png') } 22 | ], "server": { "time": 1492267134 }, "paging": { "count": 4 } }, 23 | 24 | 25 | menuInfo: [ 26 | { title: '美食', icon: require('../img/home/icon_homepage_food_category.png') }, 27 | { title: '电影', icon: require('../img/home/icon_homepage_movie_category.png') }, 28 | { title: '酒店', icon: require('../img/home/icon_homepage_hotel_category.png') }, 29 | { title: 'KTV', icon: require('../img/home/icon_homepage_ktv_category.png') }, 30 | { title: '优惠买单', icon: require('../img/home/icon_homepage_default.png') }, 31 | { title: '周边游', icon: require('../img/home/icon_homepage_foottreat_category.png') }, 32 | { title: '生活服务', icon: require('../img/home/icon_homepage_life_service_category.png') }, 33 | { title: '休闲娱乐', icon: require('../img/home/icon_homepage_entertainment_category.png') }, 34 | { title: '丽人/美发', icon: require('../img/home/icon_homepage_beauty_category.png') }, 35 | { title: '购物', icon: require('../img/home/icon_homepage_shopping_category.png') }, 36 | 37 | { title: '丽人/美发', icon: require('../img/home/icon_homepage_beauty_category.png') }, 38 | { title: '电影', icon: require('../img/home/icon_homepage_movie_category.png') }, 39 | { title: '周边游', icon: require('../img/home/icon_homepage_foottreat_category.png') }, 40 | { title: '酒店', icon: require('../img/home/icon_homepage_hotel_category.png') }, 41 | { title: '优惠买单', icon: require('../img/home/icon_homepage_default.png') }, 42 | { title: '休闲娱乐', icon: require('../img/home/icon_homepage_entertainment_category.png') }, 43 | { title: 'KTV', icon: require('../img/home/icon_homepage_ktv_category.png') }, 44 | ] 45 | } 46 | 47 | export function recommendUrlWithId(id) { 48 | return 'http://api.meituan.com/group/v1/deal/recommend/collaborative?__skck=40aaaf01c2fc4801b9c059efcd7aa146&__skcy=hWCwhGYpNTG7TjXWHOwPykgoKX0%3D&__skno=433ACF85-E134-4FEC-94B5-DA35D33AC753&__skts=1436343274.685593&__skua=bd6b6e8eadfad15571a15c3b9ef9199a&__vhost=api.mobile.meituan.com&cate=0&ci=1&cityId=1&client=iphone&did=' + id + '&district=-1&fields=id%2Cslug%2Cimgurl%2Cprice%2Ctitle%2Cbrandname%2Crange%2Cvalue%2Cmlls%2Csolds&hasbuy=0&latlng=0.000000%2C0.000000&movieBundleVersion=100&msid=48E2B810-805D-4821-9CDD-D5C9E01BC98A2015-07-08-15-36746&offset=0&scene=view-v4&userId=10086&userid=10086&utm_campaign=AgroupBgroupD100Fab_i550poi_ktv__d__j___ab_i_group_5_3_poidetaildeallist__a__b___ab_gxhceshi0202__b__a___ab_pindaoquxincelue0630__b__b1___ab_i_group_5_6_searchkuang__a__leftflow___i_group_5_2_deallist_poitype__d__d___ab_i550poi_xxyl__b__leftflow___ab_b_food_57_purepoilist_extinfo__a__a___ab_waimaiwending__a__a___ab_waimaizhanshi__b__b1___ab_i550poi_lr__d__leftflow___ab_i_group_5_5_onsite__b__b___ab_xinkeceshi__b__leftflowGhomepage_guess_27774127&utm_content=4B8C0B46F5B0527D55EA292904FD7E12E48FB7BEA8DF50BFE7828AF7F20BB08D&utm_medium=iphone&utm_source=AppStore&utm_term=5.7&uuid=4B8C0B46F5B0527D55EA292904FD7E12E48FB7BEA8DF50BFE7828AF7F20BB08D&version_name=5.7' 49 | } 50 | 51 | 52 | export function groupPurchaseDetailWithId(id) { 53 | return 'http://api.meituan.com/group/v1/deal/list/id/' + id + '?__skck=40aaaf01c2fc4801b9c059efcd7aa146&__skcy=4NDQ%2BojQ%2BZGArOWQCEgWI19Pzus%3D&__skno=803C28CE-8BA8-4831-B2DE-7BCD484348D9&__skts=1435888257.411030&__skua=bd6b6e8eadfad15571a15c3b9ef9199a&__vhost=api.mobile.meituan.com&ci=1&client=iphone&movieBundleVersion=100&msid=48E2B810-805D-4821-9CDD-D5C9E01BC98A2015-07-03-09-14430&userid=10086&utm_campaign=AgroupBgroupC1080988208017226240_c0_e68cafa9e104898bb8bfcd78b64aef671D100Fab_i_group_5_3_poidetaildeallist__a__b___ab_chunceshishuju__a__a___ab_gxhceshi__nostrategy__leftflow___ab_gxhceshi0202__b__a___ab_pindaochangsha__a__leftflow___ab_xinkeceshi__b__leftflow___ab_gxtest__gd__leftflow___ab_waimaiwending__a__a___ab_gxh_82__nostrategy__leftflow___i_group_5_2_deallist_poitype__d__d___ab_b_food_57_purepoilist_extinfo__a__a___ab_pindaoshenyang__a__leftflow___ab_pindaoquxincelue0630__b__b1___ab_waimaizhanshi__b__b1___a20141120nanning__m1__leftflow___b1junglehomepagecatesort__b__leftflow___ab_i_group_5_5_onsite__b__b___ab_i_group_5_6_searchkuang__a__leftflowGhomepage_guess_27774127&utm_content=4B8C0B46F5B0527D55EA292904FD7E12E48FB7BEA8DF50BFE7828AF7F20BB08D&utm_medium=iphone&utm_source=AppStore&utm_term=5.7&uuid=4B8C0B46F5B0527D55EA292904FD7E12E48FB7BEA8DF50BFE7828AF7F20BB08D&version_name=5.7' 54 | } -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format 19 | * bundleCommand: "ram-bundle", 20 | * 21 | * // the entry file for bundle generation 22 | * entryFile: "index.android.js", 23 | * 24 | * // whether to bundle JS and assets in debug mode 25 | * bundleInDebug: false, 26 | * 27 | * // whether to bundle JS and assets in release mode 28 | * bundleInRelease: true, 29 | * 30 | * // whether to bundle JS and assets in another build variant (if configured). 31 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 32 | * // The configuration property can be in the following formats 33 | * // 'bundleIn${productFlavor}${buildType}' 34 | * // 'bundleIn${buildType}' 35 | * // bundleInFreeDebug: true, 36 | * // bundleInPaidRelease: true, 37 | * // bundleInBeta: true, 38 | * 39 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 40 | * // for example: to disable dev mode in the staging build type (if configured) 41 | * devDisabledInStaging: true, 42 | * // The configuration property can be in the following formats 43 | * // 'devDisabledIn${productFlavor}${buildType}' 44 | * // 'devDisabledIn${buildType}' 45 | * 46 | * // the root of your project, i.e. where "package.json" lives 47 | * root: "../../", 48 | * 49 | * // where to put the JS bundle asset in debug mode 50 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 51 | * 52 | * // where to put the JS bundle asset in release mode 53 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 54 | * 55 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 56 | * // require('./image.png')), in debug mode 57 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 58 | * 59 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 60 | * // require('./image.png')), in release mode 61 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 62 | * 63 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 64 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 65 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 66 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 67 | * // for example, you might want to remove it from here. 68 | * inputExcludes: ["android/**", "ios/**"], 69 | * 70 | * // override which node gets called and with what additional arguments 71 | * nodeExecutableAndArgs: ["node"], 72 | * 73 | * // supply additional arguments to the packager 74 | * extraPackagerArgs: [] 75 | * ] 76 | */ 77 | 78 | project.ext.react = [ 79 | entryFile: "index.js", 80 | enableHermes: false, // clean and rebuild if changing 81 | ] 82 | 83 | apply from: "../../node_modules/react-native/react.gradle" 84 | 85 | project.ext.vectoricons = [ 86 | iconFontNames: [ 'Ionicons.ttf'] // Name of the font files you want to copy 87 | ] 88 | 89 | apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" 90 | 91 | /** 92 | * Set this to true to create two separate APKs instead of one: 93 | * - An APK that only works on ARM devices 94 | * - An APK that only works on x86 devices 95 | * The advantage is the size of the APK is reduced by about 4MB. 96 | * Upload all the APKs to the Play Store and people will download 97 | * the correct one based on the CPU architecture of their device. 98 | */ 99 | def enableSeparateBuildPerCPUArchitecture = false 100 | 101 | /** 102 | * Run Proguard to shrink the Java bytecode in release builds. 103 | */ 104 | def enableProguardInReleaseBuilds = false 105 | 106 | /** 107 | * The preferred build flavor of JavaScriptCore. 108 | * 109 | * For example, to use the international variant, you can use: 110 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 111 | * 112 | * The international variant includes ICU i18n library and necessary data 113 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 114 | * give correct results when using with locales other than en-US. Note that 115 | * this variant is about 6MiB larger per architecture than default. 116 | */ 117 | def jscFlavor = 'org.webkit:android-jsc:+' 118 | 119 | /** 120 | * Whether to enable the Hermes VM. 121 | * 122 | * This should be set on project.ext.react and mirrored here. If it is not set 123 | * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode 124 | * and the benefits of using Hermes will therefore be sharply reduced. 125 | */ 126 | def enableHermes = project.ext.react.get("enableHermes", false); 127 | 128 | android { 129 | compileSdkVersion rootProject.ext.compileSdkVersion 130 | 131 | compileOptions { 132 | sourceCompatibility JavaVersion.VERSION_1_8 133 | targetCompatibility JavaVersion.VERSION_1_8 134 | } 135 | 136 | defaultConfig { 137 | applicationId "com.maxieernlab" 138 | minSdkVersion rootProject.ext.minSdkVersion 139 | targetSdkVersion rootProject.ext.targetSdkVersion 140 | versionCode 1 141 | versionName "1.0" 142 | } 143 | splits { 144 | abi { 145 | reset() 146 | enable enableSeparateBuildPerCPUArchitecture 147 | universalApk false // If true, also generate a universal APK 148 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" 149 | } 150 | } 151 | 152 | signingConfigs { 153 | debug { 154 | storeFile file('debug.keystore') 155 | storePassword 'android' 156 | keyAlias 'androiddebugkey' 157 | keyPassword 'android' 158 | } 159 | } 160 | 161 | buildTypes { 162 | debug { 163 | signingConfig signingConfigs.debug 164 | } 165 | release { 166 | // Caution! In production, you need to generate your own keystore file. 167 | // see https://facebook.github.io/react-native/docs/signed-apk-android. 168 | signingConfig signingConfigs.debug 169 | minifyEnabled enableProguardInReleaseBuilds 170 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 171 | } 172 | } 173 | // applicationVariants are e.g. debug, release 174 | applicationVariants.all { variant -> 175 | variant.outputs.each { output -> 176 | // For each separate APK per architecture, set a unique version code as described here: 177 | // https://developer.android.com/studio/build/configure-apk-splits.html 178 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] 179 | def abi = output.getFilter(OutputFile.ABI) 180 | if (abi != null) { // null for the universal-debug, universal-release variants 181 | output.versionCodeOverride = 182 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 183 | } 184 | } 185 | } 186 | } 187 | 188 | dependencies { 189 | implementation fileTree(dir: "libs", include: ["*.jar"]) 190 | implementation "com.facebook.react:react-native:+" // From node_modules 191 | if (enableHermes) { 192 | def hermesPath = "../../node_modules/hermes-engine/android/"; 193 | debugImplementation files(hermesPath + "hermes-debug.aar") 194 | releaseImplementation files(hermesPath + "hermes-release.aar") 195 | } else { 196 | implementation jscFlavor 197 | } 198 | } 199 | 200 | // Run this once to be able to run the application with _BUCK 201 | // puts all compile dependencies into folder libs for _BUCK to use 202 | task copyDownloadableDepsToLibs(type: Copy) { 203 | from configurations.compile 204 | into 'libs' 205 | } 206 | 207 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) -------------------------------------------------------------------------------- /src/pages/demo/StopWatch/StopWatchHome.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import { View, Text, TouchableHighlight, ListView } from 'react-native'; 3 | import screen from '../../../common/screen'; 4 | 5 | class WatchFace extends Component { 6 | render() { 7 | return ( 8 | 19 | {this.props.sectionTime} 29 | {this.props.totalTime} 35 | 36 | ) 37 | } 38 | } 39 | 40 | class WatchControl extends Component { 41 | constructor(props) { 42 | super(props); 43 | this.state = { 44 | watchOn: false, 45 | startBtnText: "启动", 46 | startBtnColor: "#60B644", 47 | stopBtnText: "计次", 48 | underlayColor:"#fff", 49 | } 50 | } 51 | 52 | startWatch() { 53 | console.log("startWatch max") 54 | if (!this.state.watchOn) { 55 | this.props.startWatch(); 56 | this.setState({ 57 | startBtnText: '停止', 58 | startBtnColor: '#ff0044', 59 | stopBtnText: '计次', 60 | underlayColor: '#eee', 61 | watchOn: true 62 | }) 63 | } else { 64 | this.props.stopWatch(); 65 | this.setState({ 66 | startBtnText: '启动', 67 | startBtnColor: '#60B644', 68 | stopBtnText: '复位', 69 | underlayColor: '#eee', 70 | watchOn: false 71 | }) 72 | } 73 | } 74 | 75 | addRecord() { 76 | if (this.state.watchOn) { 77 | this.props.addRecord() 78 | } else { 79 | this.props.clearRecord() 80 | this.setState({ 81 | stopBtnText: "计次" 82 | }) 83 | } 84 | } 85 | 86 | render() { 87 | return ( 88 | 98 | 99 | this.addRecord()}> 108 | {this.state.stopBtnText} 113 | 114 | 115 | 119 | this.startWatch()}> 129 | {this.state.startBtnText} 134 | 135 | 136 | 137 | ) 138 | } 139 | } 140 | 141 | class WatchRecord extends Component { 142 | render() { 143 | let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}), 144 | theDataSource = ds.cloneWithRows(this.props.record); 145 | return ( 146 | 154 | 165 | {rowData.title} 172 | 173 | {rowData.time} 180 | 181 | 182 | }/> 183 | ) 184 | } 185 | } 186 | 187 | export default class StopWatchHome extends Component { 188 | constructor(props) { 189 | super(props); 190 | 191 | this.state = { 192 | stopWatch: false, 193 | resetWatch: true, 194 | initialTime: 0, 195 | currentTime: 0, 196 | recorderTime: 0, 197 | timeAccumulation: 0, 198 | totalTime: "00:00.00", 199 | sectionTime: "00:00.00", 200 | recordCounter: 0, 201 | record:[ 202 | {title:"",time:""}, 203 | {title:"",time:""}, 204 | {title:"",time:""}, 205 | {title:"",time:""}, 206 | {title:"",time:""}, 207 | {title:"",time:""}, 208 | {title:"",time:""} 209 | ], 210 | } 211 | } 212 | 213 | componentWillUnmount() { 214 | this.stopWatch(); 215 | this.clearRecord(); 216 | } 217 | 218 | startWatch() { 219 | if (this.state.resetWatch) { 220 | this.setState({ 221 | stopWatch: false, 222 | resetWatch: false, 223 | timeAccumulation: 0, 224 | initialTime: (new Date()).getTime() 225 | }) 226 | } else { 227 | this.setState({ 228 | stopWatch: false, 229 | initialTime: (new Date()).getTime() 230 | }) 231 | } 232 | 233 | let milSecond, second, minute, countingTime, secmilSecond, secsecond, secminute, seccountingTime; 234 | let interval = setInterval( 235 | () => { 236 | this.setState({ 237 | currentTime: (new Date()).getTime() 238 | }) 239 | countingTime = this.state.timeAccumulation + this.state.currentTime - this.state.initialTime; 240 | minute = Math.floor(countingTime/(60*1000)); 241 | second = Math.floor((countingTime-6000*minute)/1000); 242 | milSecond = Math.floor((countingTime%1000)/10); 243 | seccountingTime = countingTime - this.state.recordTime; 244 | secminute = Math.floor(seccountingTime/(60*1000)); 245 | secsecond = Math.floor((seccountingTime-6000*secminute)/1000); 246 | secmilSecond = Math.floor((seccountingTime%1000)/10); 247 | this.setState({ 248 | totalTime: (minute<10? "0"+minute:minute)+":"+(second<10? "0"+second:second)+"."+(milSecond<10? "0"+milSecond:milSecond), 249 | sectionTime: (secminute<10? "0"+secminute:secminute)+":"+(secsecond<10? "0"+secsecond:secsecond)+"."+(secmilSecond<10? "0"+secmilSecond:secmilSecond), 250 | }) 251 | if (this.state.stopWatch) { 252 | this.setState({ 253 | timeAccumulation: countingTime 254 | }) 255 | clearInterval(interval) 256 | }; 257 | }, 50); 258 | } 259 | 260 | stopWatch() { 261 | this.setState({ 262 | stopWatch: true 263 | }) 264 | } 265 | 266 | addRecord() { 267 | let {recordCounter, record} = this.state; 268 | recordCounter++; 269 | if (recordCounter<8) { 270 | record.pop(); 271 | } 272 | record.unshift({ 273 | title: "计次" + recordCounter, 274 | time: this.state.sectionTime 275 | }); 276 | this.setState({ 277 | recordTime: this.state.timeAccumulation + this.state.currentTime - this.state.initialTime, 278 | recordCounter: recordCounter, 279 | record: record 280 | }) 281 | } 282 | 283 | clearRecord() { 284 | this.setState({ 285 | stopWatch: false, 286 | resetWatch: true, 287 | intialTime: 0, 288 | currentTime:0, 289 | recordTime:0, 290 | timeAccumulation:0, 291 | totalTime: "00:00.00", 292 | sectionTime: "00:00.00", 293 | recordCounter: 0, 294 | record:[ 295 | {title:"",time:""}, 296 | {title:"",time:""}, 297 | {title:"",time:""}, 298 | {title:"",time:""}, 299 | {title:"",time:""}, 300 | {title:"",time:""}, 301 | {title:"",time:""} 302 | ], 303 | }); 304 | } 305 | 306 | render() { 307 | return ( 308 | 313 | 316 | this.addRecord()} 318 | clearRecord={() => this.clearRecord()} 319 | startWatch={() => this.startWatch()} 320 | stopWatch={() => this.stopWatch()} /> 321 | 322 | 323 | ) 324 | } 325 | } --------------------------------------------------------------------------------