diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 468962eb0..d08660dac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: node-version: 14 - name: Look Changelog - uses: jaywcjlove/changelog-generator@v1.4.2 + uses: jaywcjlove/changelog-generator@v1.4.3 with: token: ${{ secrets.GITHUB_TOKEN }} filter-author: (jaywcjlove|小弟调调™|dependabot\[bot\]|Renovate Bot) @@ -21,16 +21,16 @@ jobs: - run: yarn install - - name: package/react-native-uiw - working-directory: package/react-native-uiw - run: npm install && npm run start + - name: packages/core + # working-directory: packages/react-native-uiw + run: npm run build - name: Is a tag created auto? id: create_tag uses: jaywcjlove/create-tag-action@v1.2.0 with: token: ${{ secrets.GITHUB_TOKEN }} - package-path: ./package/react-native-uiw/package.json + package-path: ./packages/core/package.json - name: Generate Changelog id: changelog diff --git a/.gitignore b/.gitignore index ad572e632..805c4b9e0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,59 +1,113 @@ -# OSX -# -.DS_Store +# Created by https://www.gitignore.io/api/node +# Edit at https://www.gitignore.io/?templates=node -# Xcode -# -build/ -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata -*.xccheckout -*.moved-aside -DerivedData -*.hmap -*.ipa -*.xcuserstate - -# Android/IntelliJ -# -build/ -.idea -.gradle -local.properties -*.iml +doc +lib + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +package-lock.json + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output -# node.js -# +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories node_modules/ -npm-debug.log -yarn-error.log - -# BUCK -buck-out/ -\.buckd/ -*.keystore -!debug.keystore - -# fastlane -# -# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the -# screenshots whenever they are needed. -# For more information about the recommended setup visit: -# https://docs.fastlane.tools/best-practices/source-control/ - -*/fastlane/report.xml -*/fastlane/Preview.html -*/fastlane/screenshots - -# Bundle artifact -*.jsbundle - -# CocoaPods -/ios/Pods/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# next.js build output +.next + +# nuxt.js build output +.nuxt + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# End of https://www.gitignore.io/api/node + +.DS_Store +.cache +.vscode +.idea +.env + +*.bak +*.tem +*.temp +#.swp +*.*~ +~*.* + +# IDEA +*.iml +*.ipr +*.iws +.idea/ \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..caeab5a89 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,10 @@ +**/*.md +**/*.svg +**/*.ejs +**/*.yml +package.json +node_modules +dist +build +lib +test \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..2936709c9 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,11 @@ +{ + "singleQuote": true, + "trailingComma": "all", + "printWidth": 120, + "overrides": [ + { + "files": ".prettierrc", + "options": { "parser": "json" } + } + ] +} \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 8a47ac70a..000000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 uiw - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md index 0a00ad05d..a400165f9 100644 --- a/README.md +++ b/README.md @@ -1,150 +1,6 @@ -

- - - -

-

- - - - - - - - - -
- - - - - - - - - -

+etn +=== -UIW Design for React Native ---- - -(Android & iOS) - -## Install - -```bash -yarn add @uiw/react-native react-native-svg -``` - -## Basic Usage - -```jsx -import React from 'react'; -import { View } from 'react-native'; -import { Icon } from '@uiw/react-native' - -export default class Demo extends React.Component { - render() { - return ( - - - - ) - } -} -``` - -## Components - -#### Layout - -- [Divider](https://github.com/uiwjs/react-native-uiw/tree/master/components/Divider/README.md) -- [Flex](https://github.com/uiwjs/react-native-uiw/tree/master/components/Flex/README.md) -- [Spacing](https://github.com/uiwjs/react-native-uiw/tree/master/components/Spacing/README.md) -- [WingBlank](https://github.com/uiwjs/react-native-uiw/tree/master/components/WingBlank/README.md) - -#### Navigation - -- [Drawer](https://github.com/uiwjs/react-native-uiw/tree/master/components/Drawer/README.md) -- [MenuDropdown](https://github.com/uiwjs/react-native-uiw/tree/master/components/MenuDropdown/README.md) -- [SwipeAction](https://github.com/uiwjs/react-native-uiw/tree/master/components/SwipeAction/README.md) - -#### Data Entry - -- [Button](https://github.com/uiwjs/react-native-uiw/tree/master/components/Button/README.md) -- [ButtonGroup](https://github.com/uiwjs/react-native-uiw/tree/master/components/ButtonGroup/README.md) -- [CheckBox](https://github.com/uiwjs/react-native-uiw/tree/master/components/CheckBox/README.md) -- [Input](https://github.com/uiwjs/react-native-uiw/tree/master/components/Input/README.md) -- [Radio](https://github.com/uiwjs/react-native-uiw/tree/master/components/Radio/README.md) -- [SegmentedControl](https://github.com/uiwjs/react-native-uiw/tree/master/components/SegmentedControl/README.md) -- [Slider](https://github.com/uiwjs/react-native-uiw/tree/master/components/Slider/README.md) -- [Switch](https://github.com/uiwjs/react-native-uiw/tree/master/components/Switch/README.md) -- [SearchBar](https://github.com/uiwjs/react-native-uiw/tree/master/components/SearchBar/README.md) -- [SelectCascader](https://github.com/uiwjs/react-native-uiw/tree/master/components/SelectCascader/README.md) - -#### Data Display - -- [Avatar](https://github.com/uiwjs/react-native-uiw/tree/master/components/Avatar/README.md) -- [Badge](https://github.com/uiwjs/react-native-uiw/tree/master/components/Badge/README.md) -- [Ellipsis](https://github.com/uiwjs/react-native-uiw/tree/master/components/Ellipsis/README.md) -- [Empty](https://github.com/uiwjs/react-native-uiw/tree/master/components/Empty/README.md) -- [Grid](https://github.com/uiwjs/react-native-uiw/tree/master/components/Grid/README.md) -- [Icon](https://github.com/uiwjs/react-native-uiw/tree/master/components/Icon/README.md) -- [List](https://github.com/uiwjs/react-native-uiw/tree/master/components/List/README.md) -- [Table](https://github.com/uiwjs/react-native-uiw/tree/master/components/Table/README.md) -- [Typography](https://github.com/uiwjs/react-native-uiw/tree/master/components/Typography/README.md) [`H1~H6`](https://github.com/uiwjs/react-native-uiw/tree/master/components/Typography/README.md#标题) · [``](https://github.com/uiwjs/react-native-uiw/tree/master/components/Typography/README.md#删除线) · [``](https://github.com/uiwjs/react-native-uiw/tree/master/components/Typography/README.md#删除线) · [``](https://github.com/uiwjs/react-native-uiw/tree/master/components/Typography/README.md#下划线) · [``](https://github.com/uiwjs/react-native-uiw/tree/master/components/Typography/README.md#加粗) · [`
`](https://github.com/uiwjs/react-native-uiw/tree/master/components/Typography/README.md#换行) · [`

`](https://github.com/uiwjs/react-native-uiw/tree/master/components/Typography/README.md#段落) · [`


`](https://github.com/uiwjs/react-native-uiw/tree/master/components/Typography/README.md#水平线) · [`
`](https://github.com/uiwjs/react-native-uiw/tree/master/components/Typography/README.md#div) - -#### Feedback - -- [Loader](https://github.com/uiwjs/react-native-uiw/tree/master/components/Loader/README.md) -- [Modal](https://github.com/uiwjs/react-native-uiw/tree/master/components/Modal/README.md) -- [MaskLayer](https://github.com/uiwjs/react-native-uiw/tree/master/components/MaskLayer/README.md) -- [Result](https://github.com/uiwjs/react-native-uiw/tree/master/components/Result/README.md) -- [Toast](https://github.com/uiwjs/react-native-uiw/tree/master/components/Toast/README.md) - -## Other - -- [@uiw/react-native-alipay](https://github.com/uiwjs/react-native-alipay) -- [@uiw/react-native-amap-geolocation](https://github.com/uiwjs/react-native-amap-geolocation) - -## Development - -```bash -Run instructions for iOS: - • cd react-native-uiw && react-native run-ios - - or - - • Open ReactNativeUIW/ios/ReactNativeUIW.xcworkspace in Xcode or run "xed -b ios" - • Hit the Run button -Run instructions for Android: - • Have an Android emulator running (quickest way to get started), or a device connected. - • cd react-native-uiw && react-native run-android -``` - -⚠️ MacBook Pro with a M1 - -```bash -# Install ffi -sudo arch -x86_64 gem install ffi -# Re-install dependency -arch -x86_64 pod install -``` - -```bash -rm -rf ios/build -# https://github.com/react-navigation/react-navigation/issues/6071 -cd ios/ -pod install - -# Clear pods. -pod deintegrate -# pod rm Podfile.lock -pod install -# Reinstall pods -pod install --repo-update --verbose - -# Run Project -yarn run ios -``` - -- [React Native upgrade helper](https://react-native-community.github.io/upgrade-helper/) +Simplify the use of [`Express`](https://github.com/expressjs/express) + [`TypeORM`](https://github.com/typeorm/typeorm) + [`Node.js`](https://github.com/nodejs/node) = ETN +:) diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml deleted file mode 100644 index c93ea2dd7..000000000 --- a/android/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - UIW - diff --git a/app.json b/app.json deleted file mode 100644 index 7e3bee60f..000000000 --- a/app.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "UIW", - "displayName": "UIW" -} \ No newline at end of file diff --git a/components/index.tsx b/components/index.tsx deleted file mode 100644 index 291cc5b83..000000000 --- a/components/index.tsx +++ /dev/null @@ -1,49 +0,0 @@ -export {default as Avatar} from './Avatar'; -export {default as Badge} from './Badge'; -export {default as Button} from './Button'; -export {default as ButtonGroup} from './ButtonGroup'; -export {default as CheckBox} from './CheckBox'; -export {default as Divider} from './Divider'; -export {default as Drawer} from './Drawer'; -export {default as Empty} from './Empty'; -export {default as Ellipsis} from './Ellipsis'; -export {default as Flex} from './Flex'; -export {default as Grid} from './Grid'; -export {default as Icon} from './Icon'; -export {default as List} from './List'; -export {default as Loader} from './Loader'; -export {default as Modal} from './Modal'; -export {default as MaskLayer} from './MaskLayer'; -export * from './MaskLayer'; -export {default as Radio} from './Radio'; -export {default as Result} from './Result'; -export {default as SegmentedControl} from './SegmentedControl'; -export {default as Slider} from './Slider'; -export {default as Spacing} from './Spacing'; -export {default as Switch} from './Switch'; -export {default as WingBlank} from './WingBlank'; -export {default as MenuDropdown} from './MenuDropdown'; -export {default as Toast} from './Toast'; -export {default as SwipeAction} from './SwipeAction'; -export {default as Input} from './Input'; -export {default as SelectCascader} from './SelectCascader'; -export {default as ExpandableSection} from './ExpandableSection'; - -/** - * Typography - */ -export {default as H1} from './Typography/H1'; -export {default as H2} from './Typography/H2'; -export {default as H3} from './Typography/H3'; -export {default as H4} from './Typography/H4'; -export {default as H5} from './Typography/H5'; -export {default as H6} from './Typography/H6'; -export {default as Strong} from './Typography/Strong'; -export {default as S} from './Typography/S'; -export {default as Del} from './Typography/S'; -export {default as U} from './Typography/U'; -export {default as P} from './Typography/P'; -export {default as Br} from './Typography/Br'; -export {default as Div} from './Typography/Div'; -export {default as Hr} from './Typography/Hr'; -export {default as Em} from './Typography/Em'; diff --git a/.buckconfig b/example/base/.buckconfig similarity index 100% rename from .buckconfig rename to example/base/.buckconfig diff --git a/.editorconfig b/example/base/.editorconfig similarity index 55% rename from .editorconfig rename to example/base/.editorconfig index 52e7e9418..7c286132f 100644 --- a/.editorconfig +++ b/example/base/.editorconfig @@ -1,3 +1,3 @@ # Windows files [*.bat] -end_of_line = crlf \ No newline at end of file +end_of_line = crlf diff --git a/.eslintrc.js b/example/base/.eslintrc.js similarity index 55% rename from .eslintrc.js rename to example/base/.eslintrc.js index b7923cf67..40c6dcd05 100644 --- a/.eslintrc.js +++ b/example/base/.eslintrc.js @@ -1,7 +1,4 @@ module.exports = { root: true, extends: '@react-native-community', - rulers: { - 'eslintreact-hooks/exhaustive-deps': 0 - } }; diff --git a/.flowconfig b/example/base/.flowconfig similarity index 99% rename from .flowconfig rename to example/base/.flowconfig index 37e566eb8..315f2747b 100644 --- a/.flowconfig +++ b/example/base/.flowconfig @@ -63,4 +63,4 @@ untyped-import untyped-type-import [version] -^0.137.0 \ No newline at end of file +^0.137.0 diff --git a/.gitattributes b/example/base/.gitattributes similarity index 84% rename from .gitattributes rename to example/base/.gitattributes index 59b845bf9..45a3dcb2a 100644 --- a/.gitattributes +++ b/example/base/.gitattributes @@ -1,3 +1,3 @@ # Windows files should use crlf line endings # https://help.github.com/articles/dealing-with-line-endings/ -*.bat text eol=crlf \ No newline at end of file +*.bat text eol=crlf diff --git a/package/react-native-uiw/.gitignore b/example/base/.gitignore similarity index 86% rename from package/react-native-uiw/.gitignore rename to example/base/.gitignore index ba7eec767..ad572e632 100644 --- a/package/react-native-uiw/.gitignore +++ b/example/base/.gitignore @@ -1,10 +1,3 @@ -lib -src -node_modules -package-lock.json -tsconfig.json -yarn.lock - # OSX # .DS_Store @@ -27,7 +20,6 @@ DerivedData *.hmap *.ipa *.xcuserstate -project.xcworkspace # Android/IntelliJ # @@ -37,10 +29,6 @@ build/ local.properties *.iml -# Visual Studio Code -# -.vscode/ - # node.js # node_modules/ @@ -51,6 +39,7 @@ yarn-error.log buck-out/ \.buckd/ *.keystore +!debug.keystore # fastlane # @@ -67,4 +56,4 @@ buck-out/ *.jsbundle # CocoaPods -/ios/Pods/ \ No newline at end of file +/ios/Pods/ diff --git a/.prettierrc.js b/example/base/.prettierrc.js similarity index 100% rename from .prettierrc.js rename to example/base/.prettierrc.js diff --git a/.watchmanconfig b/example/base/.watchmanconfig similarity index 100% rename from .watchmanconfig rename to example/base/.watchmanconfig diff --git a/example/base/App.js b/example/base/App.js new file mode 100644 index 000000000..f85f38d87 --- /dev/null +++ b/example/base/App.js @@ -0,0 +1,112 @@ +/** + * Sample React Native App + * https://github.com/facebook/react-native + * + * @format + * @flow strict-local + */ + +import React from 'react'; +import type {Node} from 'react'; +import { + SafeAreaView, + ScrollView, + StatusBar, + StyleSheet, + Text, + useColorScheme, + View, +} from 'react-native'; + +import { + Colors, + DebugInstructions, + Header, + LearnMoreLinks, + ReloadInstructions, +} from 'react-native/Libraries/NewAppScreen'; + +const Section = ({children, title}): Node => { + const isDarkMode = useColorScheme() === 'dark'; + return ( + + + {title} + + + {children} + + + ); +}; + +const App: () => Node = () => { + const isDarkMode = useColorScheme() === 'dark'; + + const backgroundStyle = { + backgroundColor: isDarkMode ? Colors.darker : Colors.lighter, + }; + + return ( + + + +
+ +
+ Edit App.js to change this + screen and then come back to see your edits. +
+
+ +
+
+ +
+
+ Read the docs to discover what to do next: +
+ +
+ + + ); +}; + +const styles = StyleSheet.create({ + sectionContainer: { + marginTop: 32, + paddingHorizontal: 24, + }, + sectionTitle: { + fontSize: 24, + fontWeight: '600', + }, + sectionDescription: { + marginTop: 8, + fontSize: 18, + fontWeight: '400', + }, + highlight: { + fontWeight: '700', + }, +}); + +export default App; diff --git a/example/base/README.md b/example/base/README.md new file mode 100644 index 000000000..e0189a3f6 --- /dev/null +++ b/example/base/README.md @@ -0,0 +1,3 @@ +https://medium.com/@huntie/a-concise-guide-to-configuring-react-native-with-yarn-workspaces-d7efa71b6906 + +https://gist.github.com/huntie/85ea491763b444bfa1bdc8e997fc2765#file-package-json-L12-L21 \ No newline at end of file diff --git a/__tests__/App-test.tsx b/example/base/__tests__/App-test.js similarity index 82% rename from __tests__/App-test.tsx rename to example/base/__tests__/App-test.js index 176ee3c5d..178476699 100644 --- a/__tests__/App-test.tsx +++ b/example/base/__tests__/App-test.js @@ -1,6 +1,10 @@ +/** + * @format + */ + import 'react-native'; import React from 'react'; -import App from '../src/App'; +import App from '../App'; // Note: test renderer must be required after react-native. import renderer from 'react-test-renderer'; diff --git a/android/app/BUCK b/example/base/android/app/_BUCK similarity index 94% rename from android/app/BUCK rename to example/base/android/app/_BUCK index 7b9052200..f28680878 100644 --- a/android/app/BUCK +++ b/example/base/android/app/_BUCK @@ -35,12 +35,12 @@ android_library( android_build_config( name = "build_config", - package = "com.uiw", + package = "com.awesomeproject", ) android_resource( name = "res", - package = "com.uiw", + package = "com.awesomeproject", res = "src/main/res", ) diff --git a/android/app/build.gradle b/example/base/android/app/build.gradle similarity index 99% rename from android/app/build.gradle rename to example/base/android/app/build.gradle index c2ec5dede..22331ae20 100644 --- a/android/app/build.gradle +++ b/example/base/android/app/build.gradle @@ -131,7 +131,7 @@ android { } defaultConfig { - applicationId "com.uiw" + applicationId "com.awesomeproject" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 diff --git a/android/app/build_defs.bzl b/example/base/android/app/build_defs.bzl similarity index 100% rename from android/app/build_defs.bzl rename to example/base/android/app/build_defs.bzl diff --git a/android/app/debug.keystore b/example/base/android/app/debug.keystore similarity index 100% rename from android/app/debug.keystore rename to example/base/android/app/debug.keystore diff --git a/android/app/proguard-rules.pro b/example/base/android/app/proguard-rules.pro similarity index 100% rename from android/app/proguard-rules.pro rename to example/base/android/app/proguard-rules.pro diff --git a/android/app/src/debug/AndroidManifest.xml b/example/base/android/app/src/debug/AndroidManifest.xml similarity index 100% rename from android/app/src/debug/AndroidManifest.xml rename to example/base/android/app/src/debug/AndroidManifest.xml diff --git a/android/app/src/debug/java/com/uiw/ReactNativeFlipper.java b/example/base/android/app/src/debug/java/com/awesomeproject/ReactNativeFlipper.java similarity index 99% rename from android/app/src/debug/java/com/uiw/ReactNativeFlipper.java rename to example/base/android/app/src/debug/java/com/awesomeproject/ReactNativeFlipper.java index f4426c15f..24e473eb6 100644 --- a/android/app/src/debug/java/com/uiw/ReactNativeFlipper.java +++ b/example/base/android/app/src/debug/java/com/awesomeproject/ReactNativeFlipper.java @@ -4,7 +4,7 @@ *

This source code is licensed under the MIT license found in the LICENSE file in the root * directory of this source tree. */ -package com.uiw; +package com.awesomeproject; import android.content.Context; import com.facebook.flipper.android.AndroidFlipperClient; diff --git a/android/app/src/main/AndroidManifest.xml b/example/base/android/app/src/main/AndroidManifest.xml similarity index 96% rename from android/app/src/main/AndroidManifest.xml rename to example/base/android/app/src/main/AndroidManifest.xml index a682678c6..813152f7e 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/example/base/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.awesomeproject"> diff --git a/android/app/src/main/java/com/uiw/MainActivity.java b/example/base/android/app/src/main/java/com/awesomeproject/MainActivity.java similarity index 83% rename from android/app/src/main/java/com/uiw/MainActivity.java rename to example/base/android/app/src/main/java/com/awesomeproject/MainActivity.java index 8fc446b92..2a39cb860 100644 --- a/android/app/src/main/java/com/uiw/MainActivity.java +++ b/example/base/android/app/src/main/java/com/awesomeproject/MainActivity.java @@ -1,4 +1,4 @@ -package com.uiw; +package com.awesomeproject; import com.facebook.react.ReactActivity; @@ -10,6 +10,6 @@ public class MainActivity extends ReactActivity { */ @Override protected String getMainComponentName() { - return "UIW"; + return "AwesomeProject"; } } diff --git a/android/app/src/main/java/com/uiw/MainApplication.java b/example/base/android/app/src/main/java/com/awesomeproject/MainApplication.java similarity index 95% rename from android/app/src/main/java/com/uiw/MainApplication.java rename to example/base/android/app/src/main/java/com/awesomeproject/MainApplication.java index a2ad25d33..aee045417 100644 --- a/android/app/src/main/java/com/uiw/MainApplication.java +++ b/example/base/android/app/src/main/java/com/awesomeproject/MainApplication.java @@ -1,4 +1,4 @@ -package com.uiw; +package com.awesomeproject; import android.app.Application; import android.content.Context; @@ -62,7 +62,7 @@ private static void initializeFlipper( We use reflection here to pick up the class that initializes Flipper, since Flipper library is not available in release mode */ - Class aClass = Class.forName("com.uiw.ReactNativeFlipper"); + Class aClass = Class.forName("com.awesomeproject.ReactNativeFlipper"); aClass .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) .invoke(null, context, reactInstanceManager); diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/example/base/android/app/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from android/app/src/main/res/mipmap-hdpi/ic_launcher.png rename to example/base/android/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/example/base/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png similarity index 100% rename from android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png rename to example/base/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/example/base/android/app/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from android/app/src/main/res/mipmap-mdpi/ic_launcher.png rename to example/base/android/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/example/base/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png similarity index 100% rename from android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png rename to example/base/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/example/base/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from android/app/src/main/res/mipmap-xhdpi/ic_launcher.png rename to example/base/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/example/base/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png similarity index 100% rename from android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png rename to example/base/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/example/base/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to example/base/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/example/base/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png similarity index 100% rename from android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png rename to example/base/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/example/base/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png rename to example/base/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/example/base/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png similarity index 100% rename from android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png rename to example/base/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png diff --git a/example/base/android/app/src/main/res/values/strings.xml b/example/base/android/app/src/main/res/values/strings.xml new file mode 100644 index 000000000..cad480c7b --- /dev/null +++ b/example/base/android/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + AwesomeProject + diff --git a/android/app/src/main/res/values/styles.xml b/example/base/android/app/src/main/res/values/styles.xml similarity index 100% rename from android/app/src/main/res/values/styles.xml rename to example/base/android/app/src/main/res/values/styles.xml diff --git a/android/build.gradle b/example/base/android/build.gradle similarity index 100% rename from android/build.gradle rename to example/base/android/build.gradle diff --git a/android/gradle.properties b/example/base/android/gradle.properties similarity index 100% rename from android/gradle.properties rename to example/base/android/gradle.properties diff --git a/android/gradle/wrapper/gradle-wrapper.jar b/example/base/android/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from android/gradle/wrapper/gradle-wrapper.jar rename to example/base/android/gradle/wrapper/gradle-wrapper.jar diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/example/base/android/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from android/gradle/wrapper/gradle-wrapper.properties rename to example/base/android/gradle/wrapper/gradle-wrapper.properties diff --git a/android/gradlew b/example/base/android/gradlew similarity index 100% rename from android/gradlew rename to example/base/android/gradlew diff --git a/android/gradlew.bat b/example/base/android/gradlew.bat similarity index 100% rename from android/gradlew.bat rename to example/base/android/gradlew.bat diff --git a/android/settings.gradle b/example/base/android/settings.gradle similarity index 81% rename from android/settings.gradle rename to example/base/android/settings.gradle index d06d8054a..a58ec5fad 100644 --- a/android/settings.gradle +++ b/example/base/android/settings.gradle @@ -1,3 +1,3 @@ -rootProject.name = 'UIW' +rootProject.name = 'AwesomeProject' apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':app' diff --git a/example/base/app.json b/example/base/app.json new file mode 100644 index 000000000..227dd7548 --- /dev/null +++ b/example/base/app.json @@ -0,0 +1,4 @@ +{ + "name": "AwesomeProject", + "displayName": "AwesomeProject" +} diff --git a/babel.config.js b/example/base/babel.config.js similarity index 100% rename from babel.config.js rename to example/base/babel.config.js diff --git a/index.js b/example/base/index.js similarity index 75% rename from index.js rename to example/base/index.js index ef707c254..a850d031d 100644 --- a/index.js +++ b/example/base/index.js @@ -1,5 +1,9 @@ +/** + * @format + */ + import {AppRegistry} from 'react-native'; -import App from './src/App'; +import App from './App'; import {name as appName} from './app.json'; AppRegistry.registerComponent(appName, () => App); diff --git a/ios/UIW.xcodeproj/project.pbxproj b/example/base/ios/AwesomeProject.xcodeproj/project.pbxproj similarity index 69% rename from ios/UIW.xcodeproj/project.pbxproj rename to example/base/ios/AwesomeProject.xcodeproj/project.pbxproj index 157373332..d9e52634a 100644 --- a/ios/UIW.xcodeproj/project.pbxproj +++ b/example/base/ios/AwesomeProject.xcodeproj/project.pbxproj @@ -7,12 +7,12 @@ objects = { /* Begin PBXBuildFile section */ - 00E356F31AD99517003FC87E /* UIWTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* UIWTests.m */; }; + 00E356F31AD99517003FC87E /* AwesomeProjectTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* AwesomeProjectTests.m */; }; 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; - 3D78B6D80B3E8038A9BCCEA8 /* libPods-UIW.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C717EDD505AD8D703340ED3A /* libPods-UIW.a */; }; - 6CFE28944770F3A6AAFDFD28 /* libPods-UIW-UIWTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E885AA9DE669C6F7F7567AF6 /* libPods-UIW-UIWTests.a */; }; + 164B955793AF46174A082410 /* libPods-AwesomeProject.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003D8F286915CCD9B2CDC6FF /* libPods-AwesomeProject.a */; }; + 293AAE5386DE47AF34270275 /* libPods-AwesomeProject-AwesomeProjectTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 660D6FC4B17DC9EE2615297F /* libPods-AwesomeProject-AwesomeProjectTests.a */; }; 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; /* End PBXBuildFile section */ @@ -22,28 +22,28 @@ containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; proxyType = 1; remoteGlobalIDString = 13B07F861A680F5B00A75B9A; - remoteInfo = UIW; + remoteInfo = AwesomeProject; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 00E356EE1AD99517003FC87E /* UIWTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UIWTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 003D8F286915CCD9B2CDC6FF /* libPods-AwesomeProject.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AwesomeProject.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 00E356EE1AD99517003FC87E /* AwesomeProjectTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AwesomeProjectTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 00E356F21AD99517003FC87E /* UIWTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UIWTests.m; sourceTree = ""; }; - 13B07F961A680F5B00A75B9A /* UIW.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UIW.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = UIW/AppDelegate.h; sourceTree = ""; }; - 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = UIW/AppDelegate.m; sourceTree = ""; }; - 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = UIW/Images.xcassets; sourceTree = ""; }; - 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = UIW/Info.plist; sourceTree = ""; }; - 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = UIW/main.m; sourceTree = ""; }; - 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = UIW/LaunchScreen.storyboard; sourceTree = ""; }; - 8F995570FAE948A2C5C5E185 /* Pods-UIW-UIWTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UIW-UIWTests.debug.xcconfig"; path = "Target Support Files/Pods-UIW-UIWTests/Pods-UIW-UIWTests.debug.xcconfig"; sourceTree = ""; }; - C717EDD505AD8D703340ED3A /* libPods-UIW.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-UIW.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - C96DAF1A4E98E8F0FC5D7BB2 /* Pods-UIW-UIWTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UIW-UIWTests.release.xcconfig"; path = "Target Support Files/Pods-UIW-UIWTests/Pods-UIW-UIWTests.release.xcconfig"; sourceTree = ""; }; - E885AA9DE669C6F7F7567AF6 /* libPods-UIW-UIWTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-UIW-UIWTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 00E356F21AD99517003FC87E /* AwesomeProjectTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AwesomeProjectTests.m; sourceTree = ""; }; + 09245B81BA8B97616D9F7EFF /* Pods-AwesomeProject-AwesomeProjectTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AwesomeProject-AwesomeProjectTests.debug.xcconfig"; path = "Target Support Files/Pods-AwesomeProject-AwesomeProjectTests/Pods-AwesomeProject-AwesomeProjectTests.debug.xcconfig"; sourceTree = ""; }; + 13B07F961A680F5B00A75B9A /* AwesomeProject.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AwesomeProject.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = AwesomeProject/AppDelegate.h; sourceTree = ""; }; + 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = AwesomeProject/AppDelegate.m; sourceTree = ""; }; + 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = AwesomeProject/Images.xcassets; sourceTree = ""; }; + 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = AwesomeProject/Info.plist; sourceTree = ""; }; + 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = AwesomeProject/main.m; sourceTree = ""; }; + 5ECBEB7FC749825839CEA812 /* Pods-AwesomeProject-AwesomeProjectTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AwesomeProject-AwesomeProjectTests.release.xcconfig"; path = "Target Support Files/Pods-AwesomeProject-AwesomeProjectTests/Pods-AwesomeProject-AwesomeProjectTests.release.xcconfig"; sourceTree = ""; }; + 660D6FC4B17DC9EE2615297F /* libPods-AwesomeProject-AwesomeProjectTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AwesomeProject-AwesomeProjectTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 6EE79FB8B01FA0E6E8121FCC /* Pods-AwesomeProject.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AwesomeProject.release.xcconfig"; path = "Target Support Files/Pods-AwesomeProject/Pods-AwesomeProject.release.xcconfig"; sourceTree = ""; }; + 714C2CE42448EB2D6085D570 /* Pods-AwesomeProject.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AwesomeProject.debug.xcconfig"; path = "Target Support Files/Pods-AwesomeProject/Pods-AwesomeProject.debug.xcconfig"; sourceTree = ""; }; + 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = AwesomeProject/LaunchScreen.storyboard; sourceTree = ""; }; ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; - F093E960082FFFBD3C5A83E4 /* Pods-UIW.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UIW.debug.xcconfig"; path = "Target Support Files/Pods-UIW/Pods-UIW.debug.xcconfig"; sourceTree = ""; }; - FDADA376287EBFF5A7E12759 /* Pods-UIW.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UIW.release.xcconfig"; path = "Target Support Files/Pods-UIW/Pods-UIW.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -51,7 +51,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 6CFE28944770F3A6AAFDFD28 /* libPods-UIW-UIWTests.a in Frameworks */, + 293AAE5386DE47AF34270275 /* libPods-AwesomeProject-AwesomeProjectTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -59,20 +59,20 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 3D78B6D80B3E8038A9BCCEA8 /* libPods-UIW.a in Frameworks */, + 164B955793AF46174A082410 /* libPods-AwesomeProject.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 00E356EF1AD99517003FC87E /* UIWTests */ = { + 00E356EF1AD99517003FC87E /* AwesomeProjectTests */ = { isa = PBXGroup; children = ( - 00E356F21AD99517003FC87E /* UIWTests.m */, + 00E356F21AD99517003FC87E /* AwesomeProjectTests.m */, 00E356F01AD99517003FC87E /* Supporting Files */, ); - path = UIWTests; + path = AwesomeProjectTests; sourceTree = ""; }; 00E356F01AD99517003FC87E /* Supporting Files */ = { @@ -83,7 +83,7 @@ name = "Supporting Files"; sourceTree = ""; }; - 13B07FAE1A68108700A75B9A /* UIW */ = { + 13B07FAE1A68108700A75B9A /* AwesomeProject */ = { isa = PBXGroup; children = ( 13B07FAF1A68108700A75B9A /* AppDelegate.h */, @@ -93,19 +93,31 @@ 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */, 13B07FB71A68108700A75B9A /* main.m */, ); - name = UIW; + name = AwesomeProject; sourceTree = ""; }; 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { isa = PBXGroup; children = ( ED297162215061F000B7C4FE /* JavaScriptCore.framework */, - C717EDD505AD8D703340ED3A /* libPods-UIW.a */, - E885AA9DE669C6F7F7567AF6 /* libPods-UIW-UIWTests.a */, + 003D8F286915CCD9B2CDC6FF /* libPods-AwesomeProject.a */, + 660D6FC4B17DC9EE2615297F /* libPods-AwesomeProject-AwesomeProjectTests.a */, ); name = Frameworks; sourceTree = ""; }; + 3454E00E135FBF6D99A9DB61 /* Pods */ = { + isa = PBXGroup; + children = ( + 714C2CE42448EB2D6085D570 /* Pods-AwesomeProject.debug.xcconfig */, + 6EE79FB8B01FA0E6E8121FCC /* Pods-AwesomeProject.release.xcconfig */, + 09245B81BA8B97616D9F7EFF /* Pods-AwesomeProject-AwesomeProjectTests.debug.xcconfig */, + 5ECBEB7FC749825839CEA812 /* Pods-AwesomeProject-AwesomeProjectTests.release.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; 832341AE1AAA6A7D00B99B32 /* Libraries */ = { isa = PBXGroup; children = ( @@ -116,12 +128,12 @@ 83CBB9F61A601CBA00E9B192 = { isa = PBXGroup; children = ( - 13B07FAE1A68108700A75B9A /* UIW */, + 13B07FAE1A68108700A75B9A /* AwesomeProject */, 832341AE1AAA6A7D00B99B32 /* Libraries */, - 00E356EF1AD99517003FC87E /* UIWTests */, + 00E356EF1AD99517003FC87E /* AwesomeProjectTests */, 83CBBA001A601CBA00E9B192 /* Products */, 2D16E6871FA4F8E400B85C8A /* Frameworks */, - A6C9B2932B29E5736F22B1AC /* Pods */, + 3454E00E135FBF6D99A9DB61 /* Pods */, ); indentWidth = 2; sourceTree = ""; @@ -131,68 +143,56 @@ 83CBBA001A601CBA00E9B192 /* Products */ = { isa = PBXGroup; children = ( - 13B07F961A680F5B00A75B9A /* UIW.app */, - 00E356EE1AD99517003FC87E /* UIWTests.xctest */, + 13B07F961A680F5B00A75B9A /* AwesomeProject.app */, + 00E356EE1AD99517003FC87E /* AwesomeProjectTests.xctest */, ); name = Products; sourceTree = ""; }; - A6C9B2932B29E5736F22B1AC /* Pods */ = { - isa = PBXGroup; - children = ( - F093E960082FFFBD3C5A83E4 /* Pods-UIW.debug.xcconfig */, - FDADA376287EBFF5A7E12759 /* Pods-UIW.release.xcconfig */, - 8F995570FAE948A2C5C5E185 /* Pods-UIW-UIWTests.debug.xcconfig */, - C96DAF1A4E98E8F0FC5D7BB2 /* Pods-UIW-UIWTests.release.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 00E356ED1AD99517003FC87E /* UIWTests */ = { + 00E356ED1AD99517003FC87E /* AwesomeProjectTests */ = { isa = PBXNativeTarget; - buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "UIWTests" */; + buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "AwesomeProjectTests" */; buildPhases = ( - 5CFD090198DD02B469D80E80 /* [CP] Check Pods Manifest.lock */, + 39F49076DE878F96D80E161A /* [CP] Check Pods Manifest.lock */, 00E356EA1AD99517003FC87E /* Sources */, 00E356EB1AD99517003FC87E /* Frameworks */, 00E356EC1AD99517003FC87E /* Resources */, - 685A7F6EEF269E63DEF3A666 /* [CP] Embed Pods Frameworks */, - 35D87186FF16D75A0DDEA2FB /* [CP] Copy Pods Resources */, + CE912708502FF114AC3C077C /* [CP] Embed Pods Frameworks */, + B559E235E661DA5F35842380 /* [CP] Copy Pods Resources */, ); buildRules = ( ); dependencies = ( 00E356F51AD99517003FC87E /* PBXTargetDependency */, ); - name = UIWTests; - productName = UIWTests; - productReference = 00E356EE1AD99517003FC87E /* UIWTests.xctest */; + name = AwesomeProjectTests; + productName = AwesomeProjectTests; + productReference = 00E356EE1AD99517003FC87E /* AwesomeProjectTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; - 13B07F861A680F5B00A75B9A /* UIW */ = { + 13B07F861A680F5B00A75B9A /* AwesomeProject */ = { isa = PBXNativeTarget; - buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "UIW" */; + buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "AwesomeProject" */; buildPhases = ( - FF9499E143269BEF559F5E45 /* [CP] Check Pods Manifest.lock */, + 0A4B7ADF4E02585575CA98D8 /* [CP] Check Pods Manifest.lock */, FD10A7F022414F080027D42C /* Start Packager */, 13B07F871A680F5B00A75B9A /* Sources */, 13B07F8C1A680F5B00A75B9A /* Frameworks */, 13B07F8E1A680F5B00A75B9A /* Resources */, 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, - ABDE74309E54DB642CA3B35A /* [CP] Embed Pods Frameworks */, - BDE5A71A7F734A72071F9957 /* [CP] Copy Pods Resources */, + A6E1358C61BFAC39BA186A95 /* [CP] Embed Pods Frameworks */, + C64FD48FCE33269D792B45DC /* [CP] Copy Pods Resources */, ); buildRules = ( ); dependencies = ( ); - name = UIW; - productName = UIW; - productReference = 13B07F961A680F5B00A75B9A /* UIW.app */; + name = AwesomeProject; + productName = AwesomeProject; + productReference = 13B07F961A680F5B00A75B9A /* AwesomeProject.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ @@ -212,7 +212,7 @@ }; }; }; - buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "UIW" */; + buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "AwesomeProject" */; compatibilityVersion = "Xcode 12.0"; developmentRegion = en; hasScannedForEncodings = 0; @@ -225,8 +225,8 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 13B07F861A680F5B00A75B9A /* UIW */, - 00E356ED1AD99517003FC87E /* UIWTests */, + 13B07F861A680F5B00A75B9A /* AwesomeProject */, + 00E356ED1AD99517003FC87E /* AwesomeProjectTests */, ); }; /* End PBXProject section */ @@ -265,24 +265,29 @@ shellPath = /bin/sh; shellScript = "set -e\n\nexport NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n"; }; - 35D87186FF16D75A0DDEA2FB /* [CP] Copy Pods Resources */ = { + 0A4B7ADF4E02585575CA98D8 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-UIW-UIWTests/Pods-UIW-UIWTests-resources-${CONFIGURATION}-input-files.xcfilelist", ); - name = "[CP] Copy Pods Resources"; + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-UIW-UIWTests/Pods-UIW-UIWTests-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-AwesomeProject-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-UIW-UIWTests/Pods-UIW-UIWTests-resources.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 5CFD090198DD02B469D80E80 /* [CP] Check Pods Manifest.lock */ = { + 39F49076DE878F96D80E161A /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -297,84 +302,82 @@ outputFileListPaths = ( ); outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-UIW-UIWTests-checkManifestLockResult.txt", + "$(DERIVED_FILE_DIR)/Pods-AwesomeProject-AwesomeProjectTests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 685A7F6EEF269E63DEF3A666 /* [CP] Embed Pods Frameworks */ = { + A6E1358C61BFAC39BA186A95 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-UIW-UIWTests/Pods-UIW-UIWTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", + "${PODS_ROOT}/Target Support Files/Pods-AwesomeProject/Pods-AwesomeProject-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-UIW-UIWTests/Pods-UIW-UIWTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", + "${PODS_ROOT}/Target Support Files/Pods-AwesomeProject/Pods-AwesomeProject-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-UIW-UIWTests/Pods-UIW-UIWTests-frameworks.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AwesomeProject/Pods-AwesomeProject-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - ABDE74309E54DB642CA3B35A /* [CP] Embed Pods Frameworks */ = { + B559E235E661DA5F35842380 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-UIW/Pods-UIW-frameworks-${CONFIGURATION}-input-files.xcfilelist", + "${PODS_ROOT}/Target Support Files/Pods-AwesomeProject-AwesomeProjectTests/Pods-AwesomeProject-AwesomeProjectTests-resources-${CONFIGURATION}-input-files.xcfilelist", ); - name = "[CP] Embed Pods Frameworks"; + name = "[CP] Copy Pods Resources"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-UIW/Pods-UIW-frameworks-${CONFIGURATION}-output-files.xcfilelist", + "${PODS_ROOT}/Target Support Files/Pods-AwesomeProject-AwesomeProjectTests/Pods-AwesomeProject-AwesomeProjectTests-resources-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-UIW/Pods-UIW-frameworks.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AwesomeProject-AwesomeProjectTests/Pods-AwesomeProject-AwesomeProjectTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; - BDE5A71A7F734A72071F9957 /* [CP] Copy Pods Resources */ = { + C64FD48FCE33269D792B45DC /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-UIW/Pods-UIW-resources-${CONFIGURATION}-input-files.xcfilelist", + "${PODS_ROOT}/Target Support Files/Pods-AwesomeProject/Pods-AwesomeProject-resources-${CONFIGURATION}-input-files.xcfilelist", ); name = "[CP] Copy Pods Resources"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-UIW/Pods-UIW-resources-${CONFIGURATION}-output-files.xcfilelist", + "${PODS_ROOT}/Target Support Files/Pods-AwesomeProject/Pods-AwesomeProject-resources-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-UIW/Pods-UIW-resources.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AwesomeProject/Pods-AwesomeProject-resources.sh\"\n"; showEnvVarsInLog = 0; }; - FD10A7F022414F080027D42C /* Start Packager */ = { + CE912708502FF114AC3C077C /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-AwesomeProject-AwesomeProjectTests/Pods-AwesomeProject-AwesomeProjectTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); - inputPaths = ( - ); - name = "Start Packager"; + name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( - ); - outputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-AwesomeProject-AwesomeProjectTests/Pods-AwesomeProject-AwesomeProjectTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AwesomeProject-AwesomeProjectTests/Pods-AwesomeProject-AwesomeProjectTests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - FF9499E143269BEF559F5E45 /* [CP] Check Pods Manifest.lock */ = { + FD10A7F022414F080027D42C /* Start Packager */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -382,18 +385,15 @@ inputFileListPaths = ( ); inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", ); - name = "[CP] Check Pods Manifest.lock"; + name = "Start Packager"; outputFileListPaths = ( ); outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-UIW-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -403,7 +403,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 00E356F31AD99517003FC87E /* UIWTests.m in Sources */, + 00E356F31AD99517003FC87E /* AwesomeProjectTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -421,7 +421,7 @@ /* Begin PBXTargetDependency section */ 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 13B07F861A680F5B00A75B9A /* UIW */; + target = 13B07F861A680F5B00A75B9A /* AwesomeProject */; targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -429,14 +429,14 @@ /* Begin XCBuildConfiguration section */ 00E356F61AD99517003FC87E /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 8F995570FAE948A2C5C5E185 /* Pods-UIW-UIWTests.debug.xcconfig */; + baseConfigurationReference = 09245B81BA8B97616D9F7EFF /* Pods-AwesomeProject-AwesomeProjectTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); - INFOPLIST_FILE = UIWTests/Info.plist; + INFOPLIST_FILE = AwesomeProjectTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -450,17 +450,17 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UIW.app/UIW"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AwesomeProject.app/AwesomeProject"; }; name = Debug; }; 00E356F71AD99517003FC87E /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = C96DAF1A4E98E8F0FC5D7BB2 /* Pods-UIW-UIWTests.release.xcconfig */; + baseConfigurationReference = 5ECBEB7FC749825839CEA812 /* Pods-AwesomeProject-AwesomeProjectTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; COPY_PHASE_STRIP = NO; - INFOPLIST_FILE = UIWTests/Info.plist; + INFOPLIST_FILE = AwesomeProjectTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -474,19 +474,19 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UIW.app/UIW"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AwesomeProject.app/AwesomeProject"; }; name = Release; }; 13B07F941A680F5B00A75B9A /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = F093E960082FFFBD3C5A83E4 /* Pods-UIW.debug.xcconfig */; + baseConfigurationReference = 714C2CE42448EB2D6085D570 /* Pods-AwesomeProject.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = 1; ENABLE_BITCODE = NO; - INFOPLIST_FILE = UIW/Info.plist; + INFOPLIST_FILE = AwesomeProject/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -497,7 +497,7 @@ "-lc++", ); PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = UIW; + PRODUCT_NAME = AwesomeProject; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; @@ -506,12 +506,12 @@ }; 13B07F951A680F5B00A75B9A /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FDADA376287EBFF5A7E12759 /* Pods-UIW.release.xcconfig */; + baseConfigurationReference = 6EE79FB8B01FA0E6E8121FCC /* Pods-AwesomeProject.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = 1; - INFOPLIST_FILE = UIW/Info.plist; + INFOPLIST_FILE = AwesomeProject/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -522,7 +522,7 @@ "-lc++", ); PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = UIW; + PRODUCT_NAME = AwesomeProject; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; @@ -654,7 +654,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "UIWTests" */ = { + 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "AwesomeProjectTests" */ = { isa = XCConfigurationList; buildConfigurations = ( 00E356F61AD99517003FC87E /* Debug */, @@ -663,7 +663,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "UIW" */ = { + 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "AwesomeProject" */ = { isa = XCConfigurationList; buildConfigurations = ( 13B07F941A680F5B00A75B9A /* Debug */, @@ -672,7 +672,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "UIW" */ = { + 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "AwesomeProject" */ = { isa = XCConfigurationList; buildConfigurations = ( 83CBBA201A601CBA00E9B192 /* Debug */, diff --git a/ios/UIW.xcodeproj/xcshareddata/xcschemes/UIW.xcscheme b/example/base/ios/AwesomeProject.xcodeproj/xcshareddata/xcschemes/AwesomeProject.xcscheme similarity index 79% rename from ios/UIW.xcodeproj/xcshareddata/xcschemes/UIW.xcscheme rename to example/base/ios/AwesomeProject.xcodeproj/xcshareddata/xcschemes/AwesomeProject.xcscheme index cc07c2a72..20f13d11a 100644 --- a/ios/UIW.xcodeproj/xcshareddata/xcschemes/UIW.xcscheme +++ b/example/base/ios/AwesomeProject.xcodeproj/xcshareddata/xcschemes/AwesomeProject.xcscheme @@ -15,9 +15,9 @@ + BuildableName = "AwesomeProject.app" + BlueprintName = "AwesomeProject" + ReferencedContainer = "container:AwesomeProject.xcodeproj"> @@ -33,9 +33,9 @@ + BuildableName = "AwesomeProjectTests.xctest" + BlueprintName = "AwesomeProjectTests" + ReferencedContainer = "container:AwesomeProject.xcodeproj"> @@ -55,9 +55,9 @@ + BuildableName = "AwesomeProject.app" + BlueprintName = "AwesomeProject" + ReferencedContainer = "container:AwesomeProject.xcodeproj"> @@ -72,9 +72,9 @@ + BuildableName = "AwesomeProject.app" + BlueprintName = "AwesomeProject" + ReferencedContainer = "container:AwesomeProject.xcodeproj"> diff --git a/ios/UIW.xcworkspace/contents.xcworkspacedata b/example/base/ios/AwesomeProject.xcworkspace/contents.xcworkspacedata similarity index 78% rename from ios/UIW.xcworkspace/contents.xcworkspacedata rename to example/base/ios/AwesomeProject.xcworkspace/contents.xcworkspacedata index 3734ce96d..575b8628b 100644 --- a/ios/UIW.xcworkspace/contents.xcworkspacedata +++ b/example/base/ios/AwesomeProject.xcworkspace/contents.xcworkspacedata @@ -2,7 +2,7 @@ + location = "group:AwesomeProject.xcodeproj"> diff --git a/ios/UIW/AppDelegate.h b/example/base/ios/AwesomeProject/AppDelegate.h similarity index 100% rename from ios/UIW/AppDelegate.h rename to example/base/ios/AwesomeProject/AppDelegate.h diff --git a/ios/UIW/AppDelegate.m b/example/base/ios/AwesomeProject/AppDelegate.m similarity index 99% rename from ios/UIW/AppDelegate.m rename to example/base/ios/AwesomeProject/AppDelegate.m index ad0333856..9c33023f1 100644 --- a/ios/UIW/AppDelegate.m +++ b/example/base/ios/AwesomeProject/AppDelegate.m @@ -33,7 +33,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge - moduleName:@"UIW" + moduleName:@"AwesomeProject" initialProperties:nil]; if (@available(iOS 13.0, *)) { diff --git a/example/base/ios/AwesomeProject/Images.xcassets/AppIcon.appiconset/Contents.json b/example/base/ios/AwesomeProject/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..48e64ae8a --- /dev/null +++ b/example/base/ios/AwesomeProject/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,38 @@ +{ + "images": [ + { + "idiom": "iphone", + "size": "29x29", + "scale": "2x" + }, + { + "idiom": "iphone", + "size": "29x29", + "scale": "3x" + }, + { + "idiom": "iphone", + "size": "40x40", + "scale": "2x" + }, + { + "idiom": "iphone", + "size": "40x40", + "scale": "3x" + }, + { + "idiom": "iphone", + "size": "60x60", + "scale": "2x" + }, + { + "idiom": "iphone", + "size": "60x60", + "scale": "3x" + } + ], + "info": { + "version": 1, + "author": "xcode" + } +} diff --git a/example/base/ios/AwesomeProject/Images.xcassets/Contents.json b/example/base/ios/AwesomeProject/Images.xcassets/Contents.json new file mode 100644 index 000000000..97a8662eb --- /dev/null +++ b/example/base/ios/AwesomeProject/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info": { + "version": 1, + "author": "xcode" + } +} diff --git a/ios/UIW/Info.plist b/example/base/ios/AwesomeProject/Info.plist similarity index 97% rename from ios/UIW/Info.plist rename to example/base/ios/AwesomeProject/Info.plist index 0685a2e84..6d0cf5c27 100644 --- a/ios/UIW/Info.plist +++ b/example/base/ios/AwesomeProject/Info.plist @@ -5,7 +5,7 @@ CFBundleDevelopmentRegion en CFBundleDisplayName - UIW + AwesomeProject CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier diff --git a/ios/UIW/LaunchScreen.storyboard b/example/base/ios/AwesomeProject/LaunchScreen.storyboard similarity index 94% rename from ios/UIW/LaunchScreen.storyboard rename to example/base/ios/AwesomeProject/LaunchScreen.storyboard index 46f5eba62..1ba1a6464 100644 --- a/ios/UIW/LaunchScreen.storyboard +++ b/example/base/ios/AwesomeProject/LaunchScreen.storyboard @@ -16,7 +16,7 @@ -

+
{child}
); diff --git a/components/ButtonGroup/README.md b/packages/core/src/ButtonGroup/README.md similarity index 100% rename from components/ButtonGroup/README.md rename to packages/core/src/ButtonGroup/README.md diff --git a/components/ButtonGroup/index.tsx b/packages/core/src/ButtonGroup/index.tsx similarity index 86% rename from components/ButtonGroup/index.tsx rename to packages/core/src/ButtonGroup/index.tsx index f0a03a720..dc26aa07d 100644 --- a/components/ButtonGroup/index.tsx +++ b/packages/core/src/ButtonGroup/index.tsx @@ -1,7 +1,7 @@ -import React, {Component} from 'react'; -import {StyleSheet} from 'react-native'; -import {ButtonProps} from '../Button'; -import Flex, {FlexProps} from '../Flex'; +import React, { Component } from 'react'; +import { StyleSheet } from 'react-native'; +import { ButtonProps } from '../Button'; +import Flex, { FlexProps } from '../Flex'; const styles = StyleSheet.create({ default: { @@ -45,8 +45,8 @@ export default class ButtonGroup extends Component { wrap, // Flex Props ...otherProps } = this.props; - const porps = {color, type, bordered, disabled, textStyle}; - const flexProps = {direction, justify, align, wrap}; + const porps = { color, type, bordered, disabled, textStyle }; + const flexProps = { direction, justify, align, wrap }; const childs = React.Children.toArray(children); if (inline) { @@ -80,10 +80,7 @@ export default class ButtonGroup extends Component { childStyle.borderWidth = 0; } if (bordered && !gutter) { - if ( - (idx > 0 && idx < (children as ButtonProps[]).length - 1) || - idx === 0 - ) { + if ((idx > 0 && idx < (children as ButtonProps[]).length - 1) || idx === 0) { childStyle.borderRightWidth = StyleSheet.hairlineWidth; } if (idx > 0 && idx < (children as ButtonProps[]).length) { diff --git a/components/CheckBox/README.md b/packages/core/src/CheckBox/README.md similarity index 100% rename from components/CheckBox/README.md rename to packages/core/src/CheckBox/README.md diff --git a/components/CheckBox/index.tsx b/packages/core/src/CheckBox/index.tsx similarity index 74% rename from components/CheckBox/index.tsx rename to packages/core/src/CheckBox/index.tsx index a91b198bf..aa25ed8f5 100644 --- a/components/CheckBox/index.tsx +++ b/packages/core/src/CheckBox/index.tsx @@ -9,8 +9,8 @@ import { ViewStyle, TextStyle, } from 'react-native'; -import Icon, {IconsName} from '../Icon'; -import {color} from '../utils'; +import Icon, { IconsName } from '../Icon'; +import { color } from '../utils'; import Div from '../Typography/Div'; export interface CheckBoxProps extends TouchableOpacityProps { @@ -27,10 +27,7 @@ export interface CheckBoxState { checked: boolean; } -export default class CheckBox extends React.Component< - CheckBoxProps, - CheckBoxState -> { +export default class CheckBox extends React.Component { constructor(props: CheckBoxProps) { super(props); this.state = { @@ -44,12 +41,12 @@ export default class CheckBox extends React.Component< }; UNSAFE_componentWillReceiveProps(nextProps: CheckBoxProps) { if (nextProps.checked !== this.props.checked) { - this.setState({checked: !!nextProps.checked}); + this.setState({ checked: !!nextProps.checked }); } } onPress = () => { - const {onChange} = this.props; - this.setState({checked: !this.state.checked}, () => { + const { onChange } = this.props; + this.setState({ checked: !this.state.checked }, () => { onChange && onChange(this.state.checked); }); }; @@ -66,7 +63,7 @@ export default class CheckBox extends React.Component< color: $color, ...otherProps } = this.props; - const {checked: $checked} = this.state; + const { checked: $checked } = this.state; const iconName = ($checked ? checkedIcon : unCheckedIcon) as IconsName; const styIcon: ViewProps['style'] = {}; if (children) { @@ -79,17 +76,9 @@ export default class CheckBox extends React.Component< divStyl.opacity = 0.5; } return ( - + - {typeof iconName === 'string' ? ( - - ) : ( - iconName - )} + {typeof iconName === 'string' ? : iconName} {children &&
} diff --git a/components/Divider/README.md b/packages/core/src/Divider/README.md similarity index 100% rename from components/Divider/README.md rename to packages/core/src/Divider/README.md diff --git a/components/Divider/index.tsx b/packages/core/src/Divider/index.tsx similarity index 84% rename from components/Divider/index.tsx rename to packages/core/src/Divider/index.tsx index b2011b631..940e0b2a1 100644 --- a/components/Divider/index.tsx +++ b/packages/core/src/Divider/index.tsx @@ -1,5 +1,5 @@ -import React, {Component} from 'react'; -import {View, Text, ViewProps, TextProps, StyleSheet} from 'react-native'; +import React, { Component } from 'react'; +import { View, Text, ViewProps, TextProps, StyleSheet } from 'react-native'; export interface DividerProps extends ViewProps { label?: string; @@ -16,16 +16,7 @@ export default class Divider extends Component { gutter: 8, }; render() { - let { - children, - style, - gutter, - label, - lineStyle, - labelStyle, - type, - ...restProps - } = this.props; + let { children, style, gutter, label, lineStyle, labelStyle, type, ...restProps } = this.props; if (typeof children === 'string') { label = children; children = null; @@ -35,12 +26,12 @@ export default class Divider extends Component { if (type === 'horizontal') { warpperStyles.unshift(styles.horizontal); lineStyleArr.unshift(styles.lineHorizontal); - lineStyleArr.unshift({marginHorizontal: gutter}); + lineStyleArr.unshift({ marginHorizontal: gutter }); } if (type === 'vertical') { warpperStyles.unshift(styles.vertical); lineStyleArr.unshift(styles.lineVertical); - lineStyleArr.unshift({marginVertical: gutter}); + lineStyleArr.unshift({ marginVertical: gutter }); } if (!children && label) { if (labelStyle && typeof labelStyle === 'number') { diff --git a/components/Drawer/README.md b/packages/core/src/Drawer/README.md similarity index 100% rename from components/Drawer/README.md rename to packages/core/src/Drawer/README.md diff --git a/components/Drawer/index.tsx b/packages/core/src/Drawer/index.tsx similarity index 83% rename from components/Drawer/index.tsx rename to packages/core/src/Drawer/index.tsx index 4af4c0286..becff80c7 100644 --- a/components/Drawer/index.tsx +++ b/packages/core/src/Drawer/index.tsx @@ -1,4 +1,4 @@ -import React, {Component, Fragment} from 'react'; +import React, { Component, Fragment } from 'react'; import { Animated, StyleSheet, @@ -47,7 +47,7 @@ export default class Drawer extends Component { this.state = { zIndexValue: 0, overlayValue: new Animated.Value(0), - drawerValue: new Animated.ValueXY({...this.getInitPosition()}), + drawerValue: new Animated.ValueXY({ ...this.getInitPosition() }), }; } componentDidMount() { @@ -61,7 +61,7 @@ export default class Drawer extends Component { } } onOverlayClick = (e: GestureResponderEvent) => { - const {maskClosable} = this.props; + const { maskClosable } = this.props; if (!maskClosable) { return false; } @@ -69,16 +69,8 @@ export default class Drawer extends Component { this.closeDrawer(); }; render() { - const { - isOpen, - style, - drawerWidth, - drawerBackgroundColor, - maskProps, - placement, - drawerHeight, - } = this.props; - const {drawerValue, overlayValue, zIndexValue} = this.state; + const { isOpen, style, drawerWidth, drawerBackgroundColor, maskProps, placement, drawerHeight } = this.props; + const { drawerValue, overlayValue, zIndexValue } = this.state; const isTopOrBottom = placement === 'top' || placement === 'bottom'; const changeStyle = isTopOrBottom ? 'height' : 'width'; const dynamicDrawerStyles: any = { @@ -110,17 +102,14 @@ export default class Drawer extends Component { style, // eslint-disable-next-line react-native/no-inline-styles { - [changeStyle]: isOpen - ? isTopOrBottom - ? drawerHeight - : drawerWidth - : 0, + [changeStyle]: isOpen ? (isTopOrBottom ? drawerHeight : drawerWidth) : 0, transform: [ - {translateX: drawerValue.x}, // x轴移动 - {translateY: drawerValue.y}, // y轴移动 + { translateX: drawerValue.x }, // x轴移动 + { translateY: drawerValue.y }, // y轴移动 ], }, - ]}> + ]} + > {this.props.children} { opacity: overlayOpacity, zIndex: zIndexValue, }, - ]}> + ]} + > { isOpen ? this.openDrawer() : this.closeDrawer(); } getInitPosition() { - const {drawerWidth, placement, drawerHeight} = this.props; - const xy = {x: 0, y: 0}; + const { drawerWidth, placement, drawerHeight } = this.props; + const xy = { x: 0, y: 0 }; if (placement === 'left') { xy.x = -(drawerWidth || 0); } @@ -171,10 +161,10 @@ export default class Drawer extends Component { return xy; } openDrawer() { - this.setState({zIndexValue: 3002}); + this.setState({ zIndexValue: 3002 }); Animated.parallel([ Animated.spring(this.state.drawerValue, { - toValue: {x: 0, y: 0}, + toValue: { x: 0, y: 0 }, overshootClamping: true, useNativeDriver: true, }), @@ -189,10 +179,10 @@ export default class Drawer extends Component { }); } closeDrawer() { - const {drawerValue, overlayValue} = this.state; + const { drawerValue, overlayValue } = this.state; Animated.parallel([ Animated.spring(drawerValue, { - toValue: {...this.getInitPosition()}, + toValue: { ...this.getInitPosition() }, overshootClamping: true, useNativeDriver: true, }), @@ -204,7 +194,7 @@ export default class Drawer extends Component { ]).start(() => { this.props.closeDrawer!(false); this.props.onChange!(false); - this.setState({zIndexValue: 0}); + this.setState({ zIndexValue: 0 }); }); } } diff --git a/components/Ellipsis/README.md b/packages/core/src/Ellipsis/README.md similarity index 100% rename from components/Ellipsis/README.md rename to packages/core/src/Ellipsis/README.md diff --git a/components/Ellipsis/index.tsx b/packages/core/src/Ellipsis/index.tsx similarity index 54% rename from components/Ellipsis/index.tsx rename to packages/core/src/Ellipsis/index.tsx index 8e0589a23..c3c5864fe 100644 --- a/components/Ellipsis/index.tsx +++ b/packages/core/src/Ellipsis/index.tsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import {Text, TextProps} from 'react-native'; +import { Text, TextProps } from 'react-native'; export interface EllipsisProps extends TextProps { children?: React.ReactNode; @@ -8,28 +8,16 @@ export interface EllipsisProps extends TextProps { maxLen?: number; } -export default function Ellipsis({ - maxLen, - children, - placeholder, - ...props -}: EllipsisProps) { +export default function Ellipsis({ maxLen, children, placeholder, ...props }: EllipsisProps) { let content = children; if (maxLen && content && typeof content === 'string') { - content = - content.length > maxLen - ? content.substr(0, maxLen) + placeholder - : content; + content = content.length > maxLen ? content.substr(0, maxLen) + placeholder : content; } return {content}; } Ellipsis.propTypes = { - children: PropTypes.oneOfType([ - PropTypes.arrayOf(PropTypes.node), - PropTypes.node, - PropTypes.string, - ]), + children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node, PropTypes.string]), placeholder: PropTypes.string, maxLen: PropTypes.number, }; diff --git a/components/Empty/README.md b/packages/core/src/Empty/README.md similarity index 100% rename from components/Empty/README.md rename to packages/core/src/Empty/README.md diff --git a/components/Empty/index.tsx b/packages/core/src/Empty/index.tsx similarity index 80% rename from components/Empty/index.tsx rename to packages/core/src/Empty/index.tsx index 74b4eafa5..05e19271f 100644 --- a/components/Empty/index.tsx +++ b/packages/core/src/Empty/index.tsx @@ -1,7 +1,7 @@ -import React, {Component} from 'react'; -import {StyleSheet, Text, TextProps} from 'react-native'; +import React, { Component } from 'react'; +import { StyleSheet, Text, TextProps } from 'react-native'; import Icon from '../Icon'; -import Flex, {FlexProps} from '../Flex'; +import Flex, { FlexProps } from '../Flex'; const iconStr = ` @@ -45,18 +45,14 @@ export default class Empty extends Component { xml: iconStr, }; render() { - const {size, label, xml, labelStyle, children, ...props} = this.props; + const { size, label, xml, labelStyle, children, ...props } = this.props; return ( {xml && } {!!children ? children : label && - typeof label === 'string' && ( - - {label} - - )} + typeof label === 'string' && {label}} ); } diff --git a/components/ExpandableSection/README.md b/packages/core/src/ExpandableSection/README.md similarity index 100% rename from components/ExpandableSection/README.md rename to packages/core/src/ExpandableSection/README.md diff --git a/components/ExpandableSection/index.tsx b/packages/core/src/ExpandableSection/index.tsx similarity index 97% rename from components/ExpandableSection/index.tsx rename to packages/core/src/ExpandableSection/index.tsx index a995eb187..4ea594b1e 100644 --- a/components/ExpandableSection/index.tsx +++ b/packages/core/src/ExpandableSection/index.tsx @@ -24,7 +24,6 @@ export type ExpandableSectionProps = { onPress?: () => void; }; - function ExpandableSection(props: ExpandableSectionProps) { const { expanded, sectionHeader, children, top } = props; @@ -46,6 +45,6 @@ export default ExpandableSection; const styles = StyleSheet.create({ container: { - overflow: 'hidden' - } + overflow: 'hidden', + }, }); diff --git a/components/Flex/FlexItem.tsx b/packages/core/src/Flex/FlexItem.tsx similarity index 66% rename from components/Flex/FlexItem.tsx rename to packages/core/src/Flex/FlexItem.tsx index b8fc0e517..77c03e686 100644 --- a/components/Flex/FlexItem.tsx +++ b/packages/core/src/Flex/FlexItem.tsx @@ -1,5 +1,5 @@ -import React, {Component} from 'react'; -import {View, ViewProps} from 'react-native'; +import React, { Component } from 'react'; +import { View, ViewProps } from 'react-native'; export interface FlexItemProps extends ViewProps {} diff --git a/components/Flex/README.md b/packages/core/src/Flex/README.md similarity index 100% rename from components/Flex/README.md rename to packages/core/src/Flex/README.md diff --git a/components/Flex/index.tsx b/packages/core/src/Flex/index.tsx similarity index 80% rename from components/Flex/index.tsx rename to packages/core/src/Flex/index.tsx index 346b7c458..66344180f 100644 --- a/components/Flex/index.tsx +++ b/packages/core/src/Flex/index.tsx @@ -1,5 +1,5 @@ -import React, {Component} from 'react'; -import {View, ViewProps, FlexStyle} from 'react-native'; +import React, { Component } from 'react'; +import { View, ViewProps, FlexStyle } from 'react-native'; import FlexItem from './FlexItem'; export interface FlexProps extends ViewProps { @@ -18,7 +18,7 @@ export default class Flex extends Component { align: 'start', }; render() { - const {direction, justify, align, wrap, children, style} = this.props; + const { direction, justify, align, wrap, children, style } = this.props; const sty: FlexProps['style'] = {}; if (direction) { sty.flexDirection = direction; @@ -35,9 +35,7 @@ export default class Flex extends Component { .replace(/^evenly$/g, 'space-evenly') as FlexStyle['justifyContent']; } if (align) { - sty.alignItems = align - .replace(/^start$/g, 'flex-start') - .replace(/^end$/g, 'flex-end') as FlexStyle['alignItems']; + sty.alignItems = align.replace(/^start$/g, 'flex-start').replace(/^end$/g, 'flex-end') as FlexStyle['alignItems']; } return ( @@ -49,7 +47,7 @@ export default class Flex extends Component { if (child.type && (child.type as any).displayName === 'FlexItem') { return React.cloneElement(, { ...child.props, - style: [{flex: 1}, child.props.style], + style: [{ flex: 1 }, child.props.style], }); } return child; diff --git a/components/Grid/README.md b/packages/core/src/Grid/README.md similarity index 100% rename from components/Grid/README.md rename to packages/core/src/Grid/README.md diff --git a/components/Grid/index.tsx b/packages/core/src/Grid/index.tsx similarity index 69% rename from components/Grid/index.tsx rename to packages/core/src/Grid/index.tsx index f367fc927..75c696d4c 100644 --- a/components/Grid/index.tsx +++ b/packages/core/src/Grid/index.tsx @@ -1,4 +1,4 @@ -import React, {Component, Fragment} from 'react'; +import React, { Component, Fragment } from 'react'; import { View, ViewProps, @@ -19,14 +19,8 @@ interface MaybeTextOrViewProps { children?: React.ReactNode; } -function MaybeTextOrView({ - children, - ...otherProps -}: MaybeTextOrViewProps & TextProps & ViewProps) { - if ( - typeof children === 'string' || - (children && (children as any).type.displayName === 'Text') - ) { +function MaybeTextOrView({ children, ...otherProps }: MaybeTextOrViewProps & TextProps & ViewProps) { + if (typeof children === 'string' || (children && (children as any).type.displayName === 'Text')) { return {children}; } return {children}; @@ -57,12 +51,7 @@ export interface GridProps extends ViewProps { textStyle?: StyleProp; iconStyle?: StyleProp; renderItem?: (data: ItemData, index: number, row: number) => React.ReactNode; - onPress?: ( - data: ItemData, - index: number, - row: number, - event: GestureResponderEvent, - ) => void; + onPress?: (data: ItemData, index: number, row: number, event: GestureResponderEvent) => void; } export default class Grid extends Component { @@ -99,28 +88,18 @@ export default class Grid extends Component { } else if (item.icon) { icon = ( ); } if (renderItem && typeof renderItem === 'function') { - childItem!.push( - renderItem(item, idx, parseInt((idx / columns).toString(), 10) + 1), - ); + childItem!.push(renderItem(item, idx, parseInt((idx / columns).toString(), 10) + 1)); } else { const itemContent = ( - {icon && ( - {icon} - )} - - {item.text} - + {icon && {icon}} + {item.text} ); childItem!.push( @@ -128,20 +107,13 @@ export default class Grid extends Component { direction="column" align="center" justify="center" - style={[ - {height: 120}, - StyleSheet.flatten(itemStyle), - {width: `${100 / columns}%`}, - ]}> + style={[{ height: 120 }, StyleSheet.flatten(itemStyle), { width: `${100 / columns}%` }]} + > {onPress ? ( + onPress={onPress.bind(this, item, idx, parseInt((idx / columns).toString(), 10) + 1)} + > {itemContent} ) : ( @@ -165,12 +137,9 @@ export default class Grid extends Component { const itemBorderStyle: ViewProps['style'] = {}; if (hasLine) { const hairLineWidth = StyleSheet.hairlineWidth; - itemBorderStyle.borderBottomWidth = - childs.length - 1 === rowidx ? 0 : hairLineWidth; + itemBorderStyle.borderBottomWidth = childs.length - 1 === rowidx ? 0 : hairLineWidth; itemBorderStyle.borderRightWidth = - rowitem.length - 1 === idx && rowitem.length === columns - ? 0 - : hairLineWidth; + rowitem.length - 1 === idx && rowitem.length === columns ? 0 : hairLineWidth; itemBorderStyle.borderBottomColor = '#ddd'; itemBorderStyle.borderRightColor = '#ddd'; } diff --git a/components/Icon/README.md b/packages/core/src/Icon/README.md similarity index 100% rename from components/Icon/README.md rename to packages/core/src/Icon/README.md diff --git a/components/Icon/index.tsx b/packages/core/src/Icon/index.tsx similarity index 71% rename from components/Icon/index.tsx rename to packages/core/src/Icon/index.tsx index b73f135e4..98f00cd48 100644 --- a/components/Icon/index.tsx +++ b/packages/core/src/Icon/index.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import Svg, {SvgXml, SvgProps, Path} from 'react-native-svg'; +import Svg, { SvgXml, SvgProps, Path } from 'react-native-svg'; import svgPaths from '@uiw/icons/fonts/w-icon.json'; export type IconsName = keyof typeof svgPaths; @@ -25,16 +25,7 @@ export default class Icons extends React.Component { size: 26, }; render() { - const { - name, - size, - fill = '#000000', - stroke, - xml, - paths, - color, - ...otherProps - } = this.props; + const { name, size, fill = '#000000', stroke, xml, paths, color, ...otherProps } = this.props; if (xml) { return ; } @@ -46,13 +37,7 @@ export default class Icons extends React.Component { pathData = svgPaths[name] as string[]; } return ( - + {pathData.map((d: string, i: number) => ( ))} diff --git a/components/Input/PropsType.tsx b/packages/core/src/Input/PropsType.tsx similarity index 73% rename from components/Input/PropsType.tsx rename to packages/core/src/Input/PropsType.tsx index 5e89192d9..38899cef5 100644 --- a/components/Input/PropsType.tsx +++ b/packages/core/src/Input/PropsType.tsx @@ -1,16 +1,9 @@ import React from 'react'; -import {KeyboardTypeOptions} from 'react-native'; +import { KeyboardTypeOptions } from 'react-native'; export type InputEventHandler = (value?: string) => void; export interface InputItemPropsType { - type?: - | 'text' - | 'bankCard' - | 'phone' - | 'password' - | 'number' - | 'digit' - | KeyboardTypeOptions; + type?: 'text' | 'bankCard' | 'phone' | 'password' | 'number' | 'digit' | KeyboardTypeOptions; editable?: boolean; disabled?: boolean; name?: string; diff --git a/components/Input/README.md b/packages/core/src/Input/README.md similarity index 100% rename from components/Input/README.md rename to packages/core/src/Input/README.md diff --git a/components/Input/index.tsx b/packages/core/src/Input/index.tsx similarity index 89% rename from components/Input/index.tsx rename to packages/core/src/Input/index.tsx index 158771436..e409eb2f7 100644 --- a/components/Input/index.tsx +++ b/packages/core/src/Input/index.tsx @@ -11,7 +11,7 @@ import { TouchableOpacity, } from 'react-native'; import Icon from '../Icon'; -import {InputItemPropsType} from './PropsType'; +import { InputItemPropsType } from './PropsType'; const noop = () => {}; @@ -22,9 +22,7 @@ function normalizeValue(value?: string) { return value; } -export interface InputProps - extends Omit, - InputItemPropsType { +export interface InputProps extends Omit, InputItemPropsType { last?: boolean; onExtraClick?: (event: GestureResponderEvent) => void; onErrorClick?: (event: GestureResponderEvent) => void; @@ -50,7 +48,7 @@ export default class Input extends React.Component { inputRef: TextInput | null | undefined; onChange = (text: string) => { - const {onChange, type} = this.props; + const { onChange, type } = this.props; const maxLength = this.props.maxLength as number; switch (type) { case 'bankCard': @@ -101,7 +99,7 @@ export default class Input extends React.Component { disabled, ...restProps } = this.props; - const {value, defaultValue, style} = restProps; + const { value, defaultValue, style } = restProps; let valueProps: any; if ('value' in this.props) { valueProps = { @@ -140,10 +138,7 @@ export default class Input extends React.Component { } const disabledStyle = disabled ? inputStyles.disabledStyle : {}; const extraStyle = { - width: - typeof extra === 'string' && (extra as string).length > 0 - ? (extra as string).length * 17 - : 0, + width: typeof extra === 'string' && (extra as string).length > 0 ? (extra as string).length * 17 : 0, }; return ( @@ -169,18 +164,15 @@ export default class Input extends React.Component { + hitSlop={{ top: 5, left: 5, bottom: 5, right: 5 }} + > ) : null} {extra ? ( - {typeof extra === 'string' ? ( - {extra} - ) : ( - extra - )} + {typeof extra === 'string' ? {extra} : extra} ) : null} diff --git a/components/List/Item.tsx b/packages/core/src/List/Item.tsx similarity index 75% rename from components/List/Item.tsx rename to packages/core/src/List/Item.tsx index b804a26c7..b78f80708 100644 --- a/components/List/Item.tsx +++ b/packages/core/src/List/Item.tsx @@ -1,4 +1,4 @@ -import React, {Component} from 'react'; +import React, { Component } from 'react'; import { View, ViewProps, @@ -11,9 +11,7 @@ import { Text, } from 'react-native'; -export interface ListItemProps - extends ViewProps, - TouchableWithoutFeedbackProps { +export interface ListItemProps extends ViewProps, TouchableWithoutFeedbackProps { underlayColor?: string; paddingLeft?: number; extra?: React.ReactNode; @@ -49,7 +47,7 @@ export default class ListItem extends Component { } const cell = ( - + {React.Children.toArray(children).map((child, idx) => { if (typeof children === 'string') { return {children}; @@ -57,21 +55,15 @@ export default class ListItem extends Component { if (!React.isValidElement(child)) { return null; } - return React.cloneElement(child, {key: idx}); + return React.cloneElement(child, { key: idx }); })} {extra && ( - + {typeof extra === 'string' ? ( {extra} ) : ( - - {extra} - + {extra} )} )} @@ -82,14 +74,15 @@ export default class ListItem extends Component { return ( + {...otherProps} + > {cell} ); } - return {cell}; + return {cell}; } } diff --git a/components/List/README.md b/packages/core/src/List/README.md similarity index 100% rename from components/List/README.md rename to packages/core/src/List/README.md diff --git a/components/List/index.tsx b/packages/core/src/List/index.tsx similarity index 76% rename from components/List/index.tsx rename to packages/core/src/List/index.tsx index 0029aee24..a80057082 100644 --- a/components/List/index.tsx +++ b/packages/core/src/List/index.tsx @@ -1,13 +1,6 @@ -import React, {Component} from 'react'; -import { - FlatList, - FlatListProps, - Text, - StyleProp, - ViewStyle, - View, -} from 'react-native'; -import Item, {ListItemProps} from './Item'; +import React, { Component } from 'react'; +import { FlatList, FlatListProps, Text, StyleProp, ViewStyle, View } from 'react-native'; +import Item, { ListItemProps } from './Item'; const noop = () => null; @@ -26,9 +19,7 @@ export interface ListRenderItemInfoCustom { export interface ListProps extends Omit, 'renderItem'> { children?: React.ReactNode; - renderItem?: ( - info: ListRenderItemInfoCustom<{}>, - ) => React.ReactElement | null; + renderItem?: (info: ListRenderItemInfoCustom<{}>) => React.ReactElement | null; /** * flat default: `true` * - flat = `true` => `FlatList` @@ -67,19 +58,17 @@ export default class List extends Component { }; } getData(nextProps?: ListProps) { - const {size, extra, paddingLeft, children} = nextProps || this.props; + const { size, extra, paddingLeft, children } = nextProps || this.props; const dataSource = React.Children.toArray(children) .map((child: React.ReactNode) => { if (!React.isValidElement(child)) { return null; } - const props = {size, ...child.props}; - return React.cloneElement( - , - ); + const props = { size, ...child.props }; + return React.cloneElement(); }) .filter(Boolean); - this.setState({data: dataSource as ListProps['data']}); + this.setState({ data: dataSource as ListProps['data'] }); } componentDidMount() { if (!this.props.renderItem) { @@ -116,17 +105,16 @@ export default class List extends Component { props.renderItem = this.renderItemChild.bind(this); } else if (typeof renderItem === 'function') { props.data = data; - props.renderItem = (itemProps: ListRenderItemInfoCustom<{}>) => - renderItem({...itemProps}); + props.renderItem = (itemProps: ListRenderItemInfoCustom<{}>) => renderItem({ ...itemProps }); } let header = ListHeaderComponent; if (title) { header = ( // eslint-disable-next-line react-native/no-inline-styles - + {typeof title === 'string' ? ( // eslint-disable-next-line react-native/no-inline-styles - {title} + {title} ) : ( {title} )} @@ -141,16 +129,10 @@ export default class List extends Component { {header} {((renderItem && (!data || data.length === 0)) || - (!renderItem && - (!children || React.Children.toArray(children).length === 0))) && + (!renderItem && (!children || React.Children.toArray(children).length === 0))) && otherProps.ListEmptyComponent} {(props.data || []).map((item, idx) => - React.cloneElement( - (props.renderItem && props.renderItem({item, index: idx})) || ( - - ), - {key: idx}, - ), + React.cloneElement((props.renderItem && props.renderItem({ item, index: idx })) || , { key: idx }), )} ); diff --git a/components/Loader/README.md b/packages/core/src/Loader/README.md similarity index 100% rename from components/Loader/README.md rename to packages/core/src/Loader/README.md diff --git a/components/Loader/index.tsx b/packages/core/src/Loader/index.tsx similarity index 73% rename from components/Loader/index.tsx rename to packages/core/src/Loader/index.tsx index 4c0f7a17f..9234fac38 100644 --- a/components/Loader/index.tsx +++ b/packages/core/src/Loader/index.tsx @@ -1,12 +1,5 @@ -import React, {Component} from 'react'; -import { - View, - ViewProps, - Text, - StyleSheet, - ActivityIndicator, - ActivityIndicatorProps, -} from 'react-native'; +import React, { Component } from 'react'; +import { View, ViewProps, Text, StyleSheet, ActivityIndicator, ActivityIndicatorProps } from 'react-native'; const styles = StyleSheet.create({ defalut: { @@ -87,29 +80,13 @@ export default class Loader extends Component { styleProps.flexDirection = 'column'; } if (!children && !tip) { - return ( - - ); + return ; } const tips = tip || loading ? ( - - - {tip && - (typeof tip === 'string' ? ( - {tip} - ) : ( - {tip} - ))} + + + {tip && (typeof tip === 'string' ? {tip} : {tip})} ) : null; if (!children && tip) { diff --git a/components/MaskLayer/README.md b/packages/core/src/MaskLayer/README.md similarity index 100% rename from components/MaskLayer/README.md rename to packages/core/src/MaskLayer/README.md diff --git a/components/MaskLayer/index.tsx b/packages/core/src/MaskLayer/index.tsx similarity index 80% rename from components/MaskLayer/index.tsx rename to packages/core/src/MaskLayer/index.tsx index 45d946e9a..7cb5e3632 100644 --- a/components/MaskLayer/index.tsx +++ b/packages/core/src/MaskLayer/index.tsx @@ -1,12 +1,6 @@ -import React, {useState, useMemo} from 'react'; -import { - Modal, - ModalProps as RNModalProps, - Animated, - TouchableOpacity, - StyleSheet, -} from 'react-native'; -import {usePrevious} from '../utils'; +import React, { useState, useMemo } from 'react'; +import { Modal, ModalProps as RNModalProps, Animated, TouchableOpacity, StyleSheet } from 'react-native'; +import { usePrevious } from '../utils'; const styles = StyleSheet.create({ position: { @@ -94,16 +88,9 @@ export default (props: MaskLayerProps = {}) => { } // eslint-disable-next-line react-hooks/exhaustive-deps }, [props.visible]); - const backdropContent = ( - - ); + const backdropContent = ; let backdrop = ( - onDismiss && onDismiss()}> + onDismiss && onDismiss()}> {backdropContent} ); @@ -112,11 +99,7 @@ export default (props: MaskLayerProps = {}) => { isTrue = false; } return ( - + {maskClosable ? backdrop : backdropContent} {children && React.Children.toArray(children).map((child) => { @@ -125,7 +108,7 @@ export default (props: MaskLayerProps = {}) => { } return React.cloneElement(child, { ...child.props, - ...{style: [{zIndex: 9999}, child.props.style]}, + ...{ style: [{ zIndex: 9999 }, child.props.style] }, }); })} diff --git a/components/MenuDropdown/README.md b/packages/core/src/MenuDropdown/README.md similarity index 100% rename from components/MenuDropdown/README.md rename to packages/core/src/MenuDropdown/README.md diff --git a/components/MenuDropdown/index.tsx b/packages/core/src/MenuDropdown/index.tsx similarity index 88% rename from components/MenuDropdown/index.tsx rename to packages/core/src/MenuDropdown/index.tsx index d8646b790..052deaa32 100644 --- a/components/MenuDropdown/index.tsx +++ b/packages/core/src/MenuDropdown/index.tsx @@ -1,12 +1,5 @@ import React from 'react'; -import { - View, - StyleSheet, - Text, - Animated, - LayoutChangeEvent, - Easing, -} from 'react-native'; +import { View, StyleSheet, Text, Animated, LayoutChangeEvent, Easing } from 'react-native'; import Item from './item'; import Button, { ButtonProps } from '../Button'; import Icon, { IconsName } from '../Icon'; @@ -53,7 +46,7 @@ export default class MenuDropdown extends React.Component { Animated.timing(this.state.listHeightValue, { toValue: 1, duration: 500, - useNativeDriver: false,// 动画值在不同的驱动方式之间是不能兼容的。因此如果你在某个动画中启用了原生驱动,那么所有和此动画依赖相同动画值的其他动画也必须启用原生驱动。 + useNativeDriver: false, // 动画值在不同的驱动方式之间是不能兼容的。因此如果你在某个动画中启用了原生驱动,那么所有和此动画依赖相同动画值的其他动画也必须启用原生驱动。 }).start(); }; @@ -94,7 +87,8 @@ export default class MenuDropdown extends React.Component { }), top: size === 'large' ? 35 : size === 'small' ? 21 : 30, }, - ]}> + ]} + > {children} {/* } */} diff --git a/components/MenuDropdown/item.tsx b/packages/core/src/MenuDropdown/item.tsx similarity index 90% rename from components/MenuDropdown/item.tsx rename to packages/core/src/MenuDropdown/item.tsx index 5429a7853..5cebad586 100644 --- a/components/MenuDropdown/item.tsx +++ b/packages/core/src/MenuDropdown/item.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import {View, StyleSheet} from 'react-native'; +import { View, StyleSheet } from 'react-native'; export interface ItemProps { children?: React.ReactNode; diff --git a/components/Modal/README.md b/packages/core/src/Modal/README.md similarity index 100% rename from components/Modal/README.md rename to packages/core/src/Modal/README.md diff --git a/components/Modal/index.tsx b/packages/core/src/Modal/index.tsx similarity index 84% rename from components/Modal/index.tsx rename to packages/core/src/Modal/index.tsx index 47b5533b9..be3c21641 100644 --- a/components/Modal/index.tsx +++ b/packages/core/src/Modal/index.tsx @@ -1,6 +1,6 @@ -import React, {useState, useMemo} from 'react'; -import {Animated, StyleSheet, LayoutChangeEvent} from 'react-native'; -import MaskLayer, {MaskLayerProps} from '../MaskLayer'; +import React, { useState, useMemo } from 'react'; +import { Animated, StyleSheet, LayoutChangeEvent } from 'react-native'; +import MaskLayer, { MaskLayerProps } from '../MaskLayer'; export interface ModalProps extends MaskLayerProps { placement?: 'top' | 'right' | 'bottom' | 'left'; @@ -8,13 +8,7 @@ export interface ModalProps extends MaskLayerProps { } export default (props: ModalProps = {}) => { - const { - onClosed, - visible, - children, - placement = 'bottom', - ...otherProps - } = props; + const { onClosed, visible, children, placement = 'bottom', ...otherProps } = props; const [display] = useState<'none' | 'flex'>('none'); let [layoutHeight, setLayoutHeight] = useState(0); let [layoutWidth, setLayoutWidth] = useState(0); @@ -25,7 +19,7 @@ export default (props: ModalProps = {}) => { onClosed && onClosed(); } function measureContainer(event: LayoutChangeEvent) { - const {height, width} = event.nativeEvent.layout; + const { height, width } = event.nativeEvent.layout; if (!layoutHeight && isVertical) { setLayoutHeight(height); } @@ -85,11 +79,12 @@ export default (props: ModalProps = {}) => { style={[ styles.content, placement && styles[placement], - !layoutHeight && isVertical ? {display: display} : {}, - !layoutWidth && isHorizontal ? {display: display} : {}, + !layoutHeight && isVertical ? { display: display } : {}, + !layoutWidth && isHorizontal ? { display: display } : {}, // // getTransformStyle(), - {transform: [translateStyle]}, - ]}> + { transform: [translateStyle] }, + ]} + > {children} ); diff --git a/components/Radio/README.md b/packages/core/src/Radio/README.md similarity index 100% rename from components/Radio/README.md rename to packages/core/src/Radio/README.md diff --git a/components/Radio/index.tsx b/packages/core/src/Radio/index.tsx similarity index 72% rename from components/Radio/index.tsx rename to packages/core/src/Radio/index.tsx index 2d6db837e..c25e8c9b8 100644 --- a/components/Radio/index.tsx +++ b/packages/core/src/Radio/index.tsx @@ -1,4 +1,4 @@ -import React, {Component} from 'react'; +import React, { Component } from 'react'; import { View, ViewProps, @@ -14,14 +14,8 @@ interface MaybeTextOrViewProps { children?: React.ReactNode; } -function MaybeTextOrView({ - children, - ...otherProps -}: MaybeTextOrViewProps & TextProps & ViewProps) { - if ( - typeof children === 'string' || - (children && (children as any).type.displayName === 'Text') - ) { +function MaybeTextOrView({ children, ...otherProps }: MaybeTextOrViewProps & TextProps & ViewProps) { + if (typeof children === 'string' || (children && (children as any).type.displayName === 'Text')) { return {children}; } return {children}; @@ -85,7 +79,7 @@ export default class Radio extends Component { } UNSAFE_componentWillReceiveProps(nextProps: RadioProps) { if (nextProps.checked !== this.props.checked) { - this.setState({checked: nextProps.checked}, () => { + this.setState({ checked: nextProps.checked }, () => { this.animatedStart(nextProps.checked); }); } @@ -106,21 +100,14 @@ export default class Radio extends Component { } } handlePress = (event: GestureResponderEvent) => { - const {onPress} = this.props; - this.setState({checked: true}, () => { + const { onPress } = this.props; + this.setState({ checked: true }, () => { this.animatedStart(true); onPress && onPress(event); }); }; render() { - const { - style, - color, - circleSize, - thumbSize, - disabled, - ...otherProps - } = this.props; + const { style, color, circleSize, thumbSize, disabled, ...otherProps } = this.props; const sizeValue = this.state.sizeValue.interpolate({ inputRange: [0, thumbSize!], outputRange: [0, thumbSize!], @@ -130,26 +117,15 @@ export default class Radio extends Component { const borderColor = disabled ? color : '#bdc1cc'; return ( - - - + + + {this.props.children && ( + style={[styles.label, { opacity: disabled ? 0.3 : 1 }]} + > {this.props.children} )} diff --git a/components/Result/README.md b/packages/core/src/Result/README.md similarity index 100% rename from components/Result/README.md rename to packages/core/src/Result/README.md diff --git a/components/Result/index.tsx b/packages/core/src/Result/index.tsx similarity index 63% rename from components/Result/index.tsx rename to packages/core/src/Result/index.tsx index b356f16f9..f7b8d80ae 100644 --- a/components/Result/index.tsx +++ b/packages/core/src/Result/index.tsx @@ -1,18 +1,12 @@ -import React, {Component} from 'react'; -import {View, ViewProps, Text, TextProps, StyleSheet} from 'react-native'; +import React, { Component } from 'react'; +import { View, ViewProps, Text, TextProps, StyleSheet } from 'react-native'; interface MaybeTextOrViewProps { children?: React.ReactNode; } -function MaybeTextOrView({ - children, - ...otherProps -}: MaybeTextOrViewProps & TextProps & ViewProps) { - if ( - typeof children === 'string' || - (children && (children as any).type.displayName === 'Text') - ) { +function MaybeTextOrView({ children, ...otherProps }: MaybeTextOrViewProps & TextProps & ViewProps) { + if (typeof children === 'string' || (children && (children as any).type.displayName === 'Text')) { return {children}; } return {children}; @@ -58,16 +52,12 @@ export interface ResultProps extends ViewProps { export default class Result extends Component { static defaultProps: ResultProps = {}; render() { - const {style, title, message, img, ...otherProps} = this.props; + const { style, title, message, img, ...otherProps } = this.props; return ( {img} - {title && ( - {title} - )} - {message && ( - {message} - )} + {title && {title}} + {message && {message}} ); } diff --git a/components/SearchBar/README.md b/packages/core/src/SearchBar/README.md similarity index 100% rename from components/SearchBar/README.md rename to packages/core/src/SearchBar/README.md diff --git a/components/SearchBar/index.tsx b/packages/core/src/SearchBar/index.tsx similarity index 86% rename from components/SearchBar/index.tsx rename to packages/core/src/SearchBar/index.tsx index 635152cef..25d896b66 100644 --- a/components/SearchBar/index.tsx +++ b/packages/core/src/SearchBar/index.tsx @@ -10,7 +10,7 @@ import { Pressable, } from 'react-native'; import MaskLayer from '../MaskLayer'; -import List from '../List' +import List from '../List'; import { down } from './svg'; import Icon from '../Icon'; @@ -47,7 +47,7 @@ export default function SearchBar({ }: SearchBarProps) { const onHandleChangeText = (val: string) => { onChangeText && onChangeText(val); - } + }; const [curValue, setCurValue] = useState(value); const [visible, setVisivble] = useState(false); useEffect(() => { @@ -68,9 +68,7 @@ export default function SearchBar({ return !visible ? ( - - {textValue ? textValue : placeholder} - + {textValue ? textValue : placeholder} {React.isValidElement(extra) ? extra : } @@ -94,34 +92,32 @@ export default function SearchBar({ { setVisivble(false); - }}> + }} + > 取消 {loading ? ( - + ) : ( - {options.map(itm => ( + {options.map((itm) => ( { - const selectValue: any | { - key: string; - label: string; - } = labelInValue - ? { key: itm.value, label: itm.label } - : itm.value; + const selectValue: + | any + | { + key: string; + label: string; + } = labelInValue ? { key: itm.value, label: itm.label } : itm.value; onChange && onChange(selectValue); setCurValue(selectValue); setVisivble(false); - }}> + }} + > {itm.label} ))} @@ -192,8 +188,8 @@ const styles = StyleSheet.create({ alignItems: 'center', justifyContent: 'space-between', paddingRight: 5, - backgroundColor:"#fff", - paddingHorizontal:16 + backgroundColor: '#fff', + paddingHorizontal: 16, }, disabled: { backgroundColor: '#f5f5f5', diff --git a/components/SearchBar/svg.js b/packages/core/src/SearchBar/svg.js similarity index 96% rename from components/SearchBar/svg.js rename to packages/core/src/SearchBar/svg.js index 27799a0e1..f1c9ed82a 100644 --- a/components/SearchBar/svg.js +++ b/packages/core/src/SearchBar/svg.js @@ -1,3 +1,3 @@ export const down = ` -`; \ No newline at end of file +`; diff --git a/components/SearchBar/svg.tsx b/packages/core/src/SearchBar/svg.tsx similarity index 96% rename from components/SearchBar/svg.tsx rename to packages/core/src/SearchBar/svg.tsx index 27799a0e1..f1c9ed82a 100644 --- a/components/SearchBar/svg.tsx +++ b/packages/core/src/SearchBar/svg.tsx @@ -1,3 +1,3 @@ export const down = ` -`; \ No newline at end of file +`; diff --git a/components/SegmentedControl/README.md b/packages/core/src/SegmentedControl/README.md similarity index 100% rename from components/SegmentedControl/README.md rename to packages/core/src/SegmentedControl/README.md diff --git a/components/SegmentedControl/index.tsx b/packages/core/src/SegmentedControl/index.tsx similarity index 71% rename from components/SegmentedControl/index.tsx rename to packages/core/src/SegmentedControl/index.tsx index 96c10d398..da7ad2819 100644 --- a/components/SegmentedControl/index.tsx +++ b/packages/core/src/SegmentedControl/index.tsx @@ -1,16 +1,12 @@ -import React, {Component} from 'react'; -import {ViewStyle, TextStyle} from 'react-native'; -import ButtonGroup, {ButtonGroupProps} from '../ButtonGroup'; +import React, { Component } from 'react'; +import { ViewStyle, TextStyle } from 'react-native'; +import ButtonGroup, { ButtonGroupProps } from '../ButtonGroup'; import Button from '../Button'; export interface SegmentedControlProps extends ButtonGroupProps { value?: string[] | T[]; selectedIndex?: number; - renderItem?: ( - label: string | T, - selectedIndex: number, - props: ButtonGroupProps, - ) => JSX.Element; + renderItem?: (label: string | T, selectedIndex: number, props: ButtonGroupProps) => JSX.Element; onValueChange?: (label: string | T, selectedIndex: number) => void; } @@ -18,10 +14,7 @@ export interface SegmentedControlState { selectedIndex: number; } -export default class SegmentedControl extends Component< - SegmentedControlProps, - SegmentedControlState -> { +export default class SegmentedControl extends Component, SegmentedControlState> { constructor(props: SegmentedControlProps) { super(props); this.state = { @@ -35,14 +28,14 @@ export default class SegmentedControl extends Component< color: '#108ee9', }; handlePress = (label: string | T, selectedIndex: number) => { - const {onValueChange} = this.props; - this.setState({selectedIndex}, () => { + const { onValueChange } = this.props; + this.setState({ selectedIndex }, () => { onValueChange && onValueChange(label, selectedIndex); }); }; render() { // eslint-disable-next-line @typescript-eslint/no-unused-vars - const {value, selectedIndex, renderItem, ...otherProps} = this.props; + const { value, selectedIndex, renderItem, ...otherProps } = this.props; return ( {value && @@ -62,7 +55,7 @@ export default class SegmentedControl extends Component< if (renderItem) { return renderItem(label, key + 1, props); } - return React.cloneElement(