├── .babelrc ├── .eslintrc ├── .flowconfig ├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── example ├── .buckconfig ├── .eslintrc.js ├── .flowconfig ├── .gitattributes ├── .gitignore ├── .prettierrc.js ├── .watchmanconfig ├── App.js ├── __tests__ │ └── App-test.js ├── android │ ├── app │ │ ├── BUCK │ │ ├── build.gradle │ │ ├── build_defs.bzl │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── app.json ├── babel.config.js ├── form.js ├── index.js ├── ios │ ├── Podfile │ ├── example-tvOS │ │ └── Info.plist │ ├── example-tvOSTests │ │ └── Info.plist │ ├── example.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── example-tvOS.xcscheme │ │ │ └── example.xcscheme │ ├── example │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ └── exampleTests │ │ ├── Info.plist │ │ └── exampleTests.m ├── metro.config.js ├── package-lock.json └── package.json ├── flow-typed └── npm │ ├── @babel │ ├── cli_vx.x.x.js │ ├── core_vx.x.x.js │ ├── node_vx.x.x.js │ ├── preset-env_vx.x.x.js │ ├── preset-flow_vx.x.x.js │ └── register_v7.x.x.js │ ├── babel-eslint_vx.x.x.js │ ├── eslint-plugin-flowtype_vx.x.x.js │ ├── eslint-plugin-react_vx.x.x.js │ ├── eslint_vx.x.x.js │ ├── flow-bin_v0.x.x.js │ ├── flow-typed_vx.x.x.js │ ├── flow_vx.x.x.js │ ├── metro-react-native-babel-preset_vx.x.x.js │ ├── prettier-eslint-cli_vx.x.x.js │ ├── prettier-eslint_vx.x.x.js │ ├── react-native-modal-selector_vx.x.x.js │ ├── react-native-svg-icon_vx.x.x.js │ ├── react-native-svg_vx.x.x.js │ └── uuid_v3.x.x.js ├── index.js ├── package.json ├── src ├── components │ ├── Form.js │ ├── FormAnswerSwitch.js │ ├── FormAnswers.js │ ├── FormComponents │ │ ├── ButtonComponent.js │ │ ├── Component.js │ │ ├── Connected │ │ │ ├── ConnectedSelect.js │ │ │ ├── ConnectedSetSwitch.js │ │ │ ├── ConnectedSliderSet.js │ │ │ ├── ConnectedSliderSetContainer.js │ │ │ ├── ConnectedText.js │ │ │ ├── Select.js │ │ │ └── TextInput.js │ │ ├── ConnectedComponent.js │ │ ├── ConnectedComponentContainer.js │ │ ├── DummyComponent.js │ │ ├── FormElementHeader.js │ │ ├── FormElementsComponent.js │ │ ├── FormPicker.js │ │ ├── Label.js │ │ ├── ListComponent.js │ │ ├── MultipleSelectComponent.js │ │ ├── SelectComponent.js │ │ ├── SetComponent.js │ │ ├── Sets │ │ │ ├── SetSwitch.js │ │ │ └── SliderSet.js │ │ ├── SingleSlider.js │ │ ├── SliderComponent.js │ │ ├── SwitchComponent.js │ │ ├── TextInput.js │ │ └── common │ │ │ └── ListTextElement.js │ ├── components │ │ ├── FormButton.js │ │ ├── SvgIcon.js │ │ └── TextFormButton.js │ └── debug │ │ └── DisplayComponent.js ├── forms │ ├── constants.js │ ├── index.js │ └── types.js ├── resources │ └── images │ │ └── svgicons.js ├── styles │ └── index.js ├── types │ └── formTypes.js ├── utils │ ├── colorTransform.js │ ├── formHelpers.js │ ├── stripKeys.js │ ├── utils.js │ └── viewportCalculation.js └── validation │ └── Form.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "module:metro-react-native-babel-preset", 4 | "@babel/preset-flow" 5 | ] 6 | } -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "es6": true, 4 | "node": true 5 | }, 6 | "plugins": ["react", "flowtype"], 7 | "extends": [ 8 | "eslint:recommended", 9 | "plugin:react/recommended", 10 | "plugin:flowtype/recommended" 11 | ], 12 | "parser": "babel-eslint", 13 | "rules": { 14 | "comma-dangle": ["error", "always-multiline"], 15 | "no-console": 0, 16 | "semi": ["error", "never"], 17 | "rules": { 18 | "quotes": ["error", "single"] 19 | }, 20 | "eqeqeq": ["error", "always"], 21 | "no-trailing-spaces": "error", 22 | "no-multi-spaces": [ 23 | "error", 24 | { "exceptions": { "ImportDeclaration": true } } 25 | ], 26 | "no-loop-func": "error", 27 | "no-case-declarations": "error", 28 | "template-curly-spacing": "off", 29 | "indent": "off" 30 | }, 31 | "globals": { 32 | "__DEV__": true 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | .*/node_modules/* 3 | 4 | [include] 5 | ./src/* 6 | 7 | [libs] 8 | node_modules/react-native/flow 9 | node_modules/react-native/flow-github/ 10 | flow/ 11 | flow-typed 12 | react-native 13 | 14 | [lints] 15 | 16 | [options] 17 | module.system=haste 18 | module.file_ext=.js 19 | module.file_ext=.jsx 20 | module.file_ext=.json 21 | module.file_ext=.native.js 22 | 23 | [strict] 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | *.log 3 | *.tgz 4 | npm-debug.log 5 | 6 | # Runtime data 7 | tmp 8 | build 9 | dist 10 | 11 | # Dependency directory 12 | node_modules -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | *.log 3 | npm-debug.log 4 | 5 | # Dependency directory 6 | node_modules 7 | 8 | # Example directory 9 | example 10 | 11 | # Types 12 | flow-typed -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Oscar Colmenares 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## React native typed forms 2 | 3 | An UI forms library to make it easy to build forms with custom development behavior in react native 4 | 5 | ### Installation 6 | 7 | First you need to install 8 | 9 | - [react-native-svg](https://github.com/react-native-community/react-native-svg) 10 | - [react-native-svg-icon](https://github.com/stowball/react-native-svg-icon) 11 | - [react-native-vector-icons](https://github.com/oblador/react-native-vector-icons) 12 | 13 | Then 14 | 15 | `npm install --save react-native-typed-forms` 16 | 17 | Or if using yarn 18 | 19 | `yarn add react-native-typed-forms` 20 | 21 | ### Usage 22 | 23 | The main component of the library is the Form component, this component handles everything from displaying the form to handling the inner data of the form. 24 | 25 | ``` 26 | import { Form } from 'react-native-typed-form` 27 | 28 | . 29 | . 30 | . 31 |
37 | . 38 | . 39 | . 40 | ``` 41 | 42 | #### Properties 43 | 44 | | Property | Required | default | type | 45 | | :------------- | :------- | :------ | :--------------- | 46 | | model | yes | - | Object | 47 | | value | no | null | Object - null\* | 48 | | onFinish | yes | - | Function(Object) | 49 | | disableAnswers | no | false | Boolean\*\* | 50 | 51 | On finish will provide a data value that can be provided AS IS to the value prop of the form, and the form itself will handle the data to preload the components. 52 | 53 | \*If you do not provide a value (that is, the value produced by the onFinish method after completing a form) it will always create a new blank form. Providing a value preloads with data from previous iterations. 54 | 55 | \*\*Extremely recommended to set as true always, this was an old mechanic that needs to be changed 56 | 57 | #### Model 58 | 59 | The model is the spec the lib will use to build the form, see the example for a more convoluted use, but basically it's the following: 60 | 61 | ``` 62 | { 63 | type: formTypes.form, // always 64 | answer: answerTypes.single, // answer types, multiple not docummented 65 | fields: { 66 | 0: { // for now, indexes are required 67 | type: formTypes.string, // any of the form component types 68 | key: 'text_identifier', // key is required, has to be unique inside the form 69 | content: { 70 | text: 'This is a text field you can fill', 71 | }, 72 | options: { 73 | placeHolder: 'Filler text', 74 | multiline: true, 75 | default: '', 76 | }, 77 | }, 78 | }, 79 | } 80 | ``` 81 | 82 | Each component has it's own unique content/options spec, which are due for documentation. 83 | 84 | # Example app 85 | 86 | To run the example app 87 | ``` 88 | - git clone this repo 89 | - cd example 90 | - npm install 91 | - react-native run-android 92 | ``` 93 | 94 | Windows users may need to run npx react-native run-android or similar commands to use the inner react-native cli instead of the proxy cli. Due to new issues with react-native 0.60.x unexpected behavior unrelated to the lib may happen, please inform me of those issues 95 | 96 | # Contributing 97 | No particular rules enforced for now, open issues and make PRs to be reviewed 98 | 99 | 100 | # Special thanks 101 | - @EdoAPP 102 | - Dan Kurfirst -------------------------------------------------------------------------------- /example/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /example/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: '@react-native-community', 4 | }; 5 | -------------------------------------------------------------------------------- /example/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore unexpected extra "@providesModule" 9 | .*/node_modules/.*/node_modules/fbjs/.* 10 | 11 | ; Ignore duplicate module providers 12 | ; For RN Apps installed via npm, "Libraries" folder is inside 13 | ; "node_modules/react-native" but in the source repo it is in the root 14 | node_modules/react-native/Libraries/react-native/React.js 15 | 16 | ; Ignore polyfills 17 | node_modules/react-native/Libraries/polyfills/.* 18 | 19 | ; These should not be required directly 20 | ; require from fbjs/lib instead: require('fbjs/lib/warning') 21 | node_modules/warning/.* 22 | 23 | ; Flow doesn't support platforms 24 | .*/Libraries/Utilities/HMRLoadingView.js 25 | 26 | [untyped] 27 | .*/node_modules/@react-native-community/cli/.*/.* 28 | 29 | [include] 30 | 31 | [libs] 32 | node_modules/react-native/Libraries/react-native/react-native-interface.js 33 | node_modules/react-native/flow/ 34 | 35 | [options] 36 | emoji=true 37 | 38 | esproposal.optional_chaining=enable 39 | esproposal.nullish_coalescing=enable 40 | 41 | module.file_ext=.js 42 | module.file_ext=.json 43 | module.file_ext=.ios.js 44 | 45 | module.system=haste 46 | module.system.haste.use_name_reducers=true 47 | # get basename 48 | module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' 49 | # strip .js or .js.flow suffix 50 | module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' 51 | # strip .ios suffix 52 | module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' 53 | module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' 54 | module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' 55 | module.system.haste.paths.blacklist=.*/__tests__/.* 56 | module.system.haste.paths.blacklist=.*/__mocks__/.* 57 | module.system.haste.paths.whitelist=/node_modules/react-native/Libraries/.* 58 | module.system.haste.paths.whitelist=/node_modules/react-native/RNTester/.* 59 | module.system.haste.paths.whitelist=/node_modules/react-native/IntegrationTests/.* 60 | module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/react-native/react-native-implementation.js 61 | module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/Animated/src/polyfills/.* 62 | 63 | munge_underscores=true 64 | 65 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' 66 | 67 | suppress_type=$FlowIssue 68 | suppress_type=$FlowFixMe 69 | suppress_type=$FlowFixMeProps 70 | suppress_type=$FlowFixMeState 71 | 72 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\) 73 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+ 74 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 75 | 76 | [lints] 77 | sketchy-null-number=warn 78 | sketchy-null-mixed=warn 79 | sketchy-number=warn 80 | untyped-type-import=warn 81 | nonstrict-import=warn 82 | deprecated-type=warn 83 | unsafe-getters-setters=warn 84 | inexact-spread=warn 85 | unnecessary-invariant=warn 86 | signature-verification-failure=warn 87 | deprecated-utility=error 88 | 89 | [strict] 90 | deprecated-type 91 | nonstrict-import 92 | sketchy-null 93 | unclear-type 94 | unsafe-getters-setters 95 | untyped-import 96 | untyped-type-import 97 | 98 | [version] 99 | ^0.98.0 100 | -------------------------------------------------------------------------------- /example/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://docs.fastlane.tools/best-practices/source-control/ 50 | 51 | */fastlane/report.xml 52 | */fastlane/Preview.html 53 | */fastlane/screenshots 54 | 55 | # Bundle artifact 56 | *.jsbundle 57 | 58 | # CocoaPods 59 | /ios/Pods/ 60 | -------------------------------------------------------------------------------- /example/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | bracketSpacing: false, 3 | jsxBracketSameLine: true, 4 | singleQuote: true, 5 | trailingComma: 'all', 6 | }; 7 | -------------------------------------------------------------------------------- /example/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /example/App.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | * @flow 7 | */ 8 | 9 | import React, {Fragment, useState, useCallback} from 'react'; 10 | import { 11 | SafeAreaView, 12 | StyleSheet, 13 | ScrollView, 14 | View, 15 | Text, 16 | StatusBar, 17 | TouchableOpacity, 18 | } from 'react-native'; 19 | import {Form} from 'react-native-typed-forms'; 20 | import model from './form'; 21 | 22 | const Header = () => ( 23 | 24 | Example form 25 | 26 | ); 27 | 28 | const InitialComponent = props => { 29 | const {onPress} = props; 30 | 31 | return ( 32 | 33 | 34 | 35 | Fill the form 36 | 37 | 38 | 39 | 40 | Press the button and complete the form once, the form answers will be 41 | pre-populated from that point on. There are several other components 42 | and features the lib showcases, but they will be documented later on 43 | 44 | 45 | 46 | ); 47 | }; 48 | 49 | const App = () => { 50 | const [formData, setFormData] = useState(null); 51 | const [viewForm, setViewForm] = useState(false); 52 | 53 | const formFinished = useCallback( 54 | data => { 55 | setViewForm(false); 56 | setFormData(data); 57 | }, 58 | [setFormData], 59 | ); 60 | 61 | const onInitPress = useCallback(() => { 62 | setViewForm(true); 63 | }, [setViewForm]); 64 | 65 | return ( 66 | 67 | 68 | 69 | 73 |
74 | 75 | {viewForm ? ( 76 | 83 | ) : ( 84 | 85 | )} 86 | 87 | 88 | 89 | 90 | ); 91 | }; 92 | 93 | const styles = StyleSheet.create({ 94 | scrollView: { 95 | backgroundColor: '#FAFAFA', 96 | }, 97 | engine: { 98 | position: 'absolute', 99 | right: 0, 100 | }, 101 | body: { 102 | backgroundColor: '#FAFAFA', 103 | flex: 1, 104 | padding: 20, 105 | }, 106 | sectionContainer: { 107 | marginTop: 32, 108 | paddingHorizontal: 24, 109 | }, 110 | sectionTitle: { 111 | fontSize: 24, 112 | fontWeight: '600', 113 | color: '#212121', 114 | }, 115 | sectionDescription: { 116 | marginTop: 8, 117 | fontSize: 18, 118 | fontWeight: '400', 119 | color: '#212121', 120 | }, 121 | highlight: { 122 | fontWeight: '700', 123 | }, 124 | footer: { 125 | color: '#212121', 126 | fontSize: 12, 127 | fontWeight: '600', 128 | padding: 4, 129 | paddingRight: 12, 130 | textAlign: 'right', 131 | }, 132 | header: { 133 | width: '100%', 134 | height: 64, 135 | backgroundColor: '#2196f3', 136 | justifyContent: 'center', 137 | paddingHorizontal: 12, 138 | }, 139 | headerText: { 140 | fontSize: 22, 141 | fontWeight: '700', 142 | color: '#FAFAFA', 143 | }, 144 | fullContainer: { 145 | flexGrow: 1, 146 | }, 147 | container: { 148 | flex: 1, 149 | }, 150 | initItemContainer: { 151 | alignItems: 'center', 152 | justifyContent: 'center', 153 | }, 154 | button: { 155 | backgroundColor: '#2196f3', 156 | borderRadius: 6, 157 | width: '75%', 158 | alignItems: 'center', 159 | justifyContent: 'center', 160 | padding: 12, 161 | }, 162 | buttonText: { 163 | color: '#FAFAFA', 164 | fontSize: 18, 165 | }, 166 | explanation: { 167 | color: '#212121', 168 | fontSize: 16, 169 | textAlign: 'center' 170 | }, 171 | }); 172 | 173 | export default App; 174 | -------------------------------------------------------------------------------- /example/__tests__/App-test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import 'react-native'; 6 | import React from 'react'; 7 | import App from '../App'; 8 | 9 | // Note: test renderer must be required after react-native. 10 | import renderer from 'react-test-renderer'; 11 | 12 | it('renders correctly', () => { 13 | renderer.create(); 14 | }); 15 | -------------------------------------------------------------------------------- /example/android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") 12 | 13 | lib_deps = [] 14 | 15 | create_aar_targets(glob(["libs/*.aar"])) 16 | 17 | create_jar_targets(glob(["libs/*.jar"])) 18 | 19 | android_library( 20 | name = "all-libs", 21 | exported_deps = lib_deps, 22 | ) 23 | 24 | android_library( 25 | name = "app-code", 26 | srcs = glob([ 27 | "src/main/java/**/*.java", 28 | ]), 29 | deps = [ 30 | ":all-libs", 31 | ":build_config", 32 | ":res", 33 | ], 34 | ) 35 | 36 | android_build_config( 37 | name = "build_config", 38 | package = "com.example", 39 | ) 40 | 41 | android_resource( 42 | name = "res", 43 | package = "com.example", 44 | res = "src/main/res", 45 | ) 46 | 47 | android_binary( 48 | name = "app", 49 | keystore = "//android/keystores:debug", 50 | manifest = "src/main/AndroidManifest.xml", 51 | package_type = "debug", 52 | deps = [ 53 | ":app-code", 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /example/android/app/build_defs.bzl: -------------------------------------------------------------------------------- 1 | """Helper definitions to glob .aar and .jar targets""" 2 | 3 | def create_aar_targets(aarfiles): 4 | for aarfile in aarfiles: 5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] 6 | lib_deps.append(":" + name) 7 | android_prebuilt_aar( 8 | name = name, 9 | aar = aarfile, 10 | ) 11 | 12 | def create_jar_targets(jarfiles): 13 | for jarfile in jarfiles: 14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] 15 | lib_deps.append(":" + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | -------------------------------------------------------------------------------- /example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 13 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/example/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. 9 | * This is used to schedule rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "example"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/example/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import android.app.Application; 4 | import android.util.Log; 5 | 6 | import com.facebook.react.PackageList; 7 | import com.facebook.hermes.reactexecutor.HermesExecutorFactory; 8 | import com.facebook.react.bridge.JavaScriptExecutorFactory; 9 | import com.facebook.react.ReactApplication; 10 | import com.facebook.react.ReactNativeHost; 11 | import com.facebook.react.ReactPackage; 12 | import com.facebook.soloader.SoLoader; 13 | 14 | import java.util.List; 15 | 16 | public class MainApplication extends Application implements ReactApplication { 17 | 18 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 19 | @Override 20 | public boolean getUseDeveloperSupport() { 21 | return BuildConfig.DEBUG; 22 | } 23 | 24 | @Override 25 | protected List getPackages() { 26 | @SuppressWarnings("UnnecessaryLocalVariable") 27 | List packages = new PackageList(this).getPackages(); 28 | // Packages that cannot be autolinked yet can be added manually here, for example: 29 | // packages.add(new MyReactNativePackage()); 30 | return packages; 31 | } 32 | 33 | @Override 34 | protected String getJSMainModuleName() { 35 | return "index"; 36 | } 37 | }; 38 | 39 | @Override 40 | public ReactNativeHost getReactNativeHost() { 41 | return mReactNativeHost; 42 | } 43 | 44 | @Override 45 | public void onCreate() { 46 | super.onCreate(); 47 | SoLoader.init(this, /* native exopackage */ false); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graren/react-native-typed-forms/85c950bce5cc3d88d5ae8383f4b22dbcfab844cf/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graren/react-native-typed-forms/85c950bce5cc3d88d5ae8383f4b22dbcfab844cf/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graren/react-native-typed-forms/85c950bce5cc3d88d5ae8383f4b22dbcfab844cf/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graren/react-native-typed-forms/85c950bce5cc3d88d5ae8383f4b22dbcfab844cf/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graren/react-native-typed-forms/85c950bce5cc3d88d5ae8383f4b22dbcfab844cf/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graren/react-native-typed-forms/85c950bce5cc3d88d5ae8383f4b22dbcfab844cf/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graren/react-native-typed-forms/85c950bce5cc3d88d5ae8383f4b22dbcfab844cf/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graren/react-native-typed-forms/85c950bce5cc3d88d5ae8383f4b22dbcfab844cf/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graren/react-native-typed-forms/85c950bce5cc3d88d5ae8383f4b22dbcfab844cf/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graren/react-native-typed-forms/85c950bce5cc3d88d5ae8383f4b22dbcfab844cf/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | example 3 | 4 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "28.0.3" 6 | minSdkVersion = 16 7 | compileSdkVersion = 28 8 | targetSdkVersion = 28 9 | supportLibVersion = "28.0.0" 10 | } 11 | repositories { 12 | google() 13 | jcenter() 14 | } 15 | dependencies { 16 | classpath("com.android.tools.build:gradle:3.4.1") 17 | 18 | // NOTE: Do not place your application dependencies here; they belong 19 | // in the individual module build.gradle files 20 | } 21 | } 22 | 23 | allprojects { 24 | repositories { 25 | mavenLocal() 26 | maven { 27 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 28 | url("$rootDir/../node_modules/react-native/android") 29 | } 30 | maven { 31 | // Android JSC is installed from npm 32 | url("$rootDir/../node_modules/jsc-android/dist") 33 | } 34 | 35 | google() 36 | jcenter() 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | android.useAndroidX=true 21 | android.enableJetifier=true 22 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Graren/react-native-typed-forms/85c950bce5cc3d88d5ae8383f4b22dbcfab844cf/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /example/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin, switch paths to Windows format before running java 129 | if $cygwin ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=$((i+1)) 158 | done 159 | case $i in 160 | (0) set -- ;; 161 | (1) set -- "$args0" ;; 162 | (2) set -- "$args0" "$args1" ;; 163 | (3) set -- "$args0" "$args1" "$args2" ;; 164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=$(save "$@") 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 185 | cd "$(dirname "$0")" 186 | fi 187 | 188 | exec "$JAVACMD" "$@" 189 | -------------------------------------------------------------------------------- /example/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem http://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'example' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | include ':app' 4 | -------------------------------------------------------------------------------- /example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "displayName": "example" 4 | } -------------------------------------------------------------------------------- /example/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /example/form.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import {formTypes, answerTypes} from 'react-native-typed-forms'; 3 | 4 | const multipleSelectOptions = [ 5 | 'Option 1', 6 | 'Option 2', 7 | 'Option 3', 8 | 'Option 4', 9 | 'Option 5', 10 | ]; 11 | 12 | const selectFieldOptions = [ 13 | 'Option 1', 14 | 'Option 2', 15 | 'Option 3', 16 | 'Option 4', 17 | 'Option 5', 18 | ]; 19 | 20 | const form = { 21 | type: formTypes.form, 22 | answer: answerTypes.single, 23 | fields: { 24 | 0: { 25 | type: formTypes.string, 26 | key: 'text_identifier', 27 | content: { 28 | text: 'This is a text field you can fill', 29 | }, 30 | options: { 31 | placeHolder: 'Filler text', 32 | multiline: true, 33 | default: '', 34 | }, 35 | }, 36 | 1: { 37 | type: formTypes.multipleSelect, 38 | key: 'multiple_select_identifier', 39 | content: { 40 | text: 'A multiple select field as well!', 41 | listText: 'Selection', 42 | items: multipleSelectOptions.map(opt => ({ 43 | value: opt, 44 | text: opt, 45 | id: `$multiple_select_identifier_${opt}`, 46 | })), 47 | }, 48 | options: { 49 | default: [], 50 | required: true, 51 | constraints: { 52 | min: 1, 53 | }, 54 | }, 55 | }, 56 | 2: { 57 | type: formTypes.select, 58 | key: 'select_field_identifier', 59 | content: { 60 | text: 'Have a standard select field with default value', 61 | items: selectFieldOptions.map(opt => ({ 62 | value: opt, 63 | text: opt, 64 | })), 65 | }, 66 | options: { 67 | default: selectFieldOptions[2], 68 | }, 69 | }, 70 | 3: { 71 | type: formTypes.list, 72 | key: 'list-identifier', 73 | content: { 74 | text: 'And a list component', 75 | listText: 'list', 76 | smallKey: 'list', 77 | }, 78 | options: { 79 | childTypes: { 80 | 0: { 81 | type: formTypes.string, 82 | key: 'list-identifier.string', 83 | options: { 84 | placeHolder: 'some text', 85 | }, 86 | }, 87 | }, 88 | default: [], 89 | required: true, 90 | }, 91 | }, 92 | }, 93 | }; 94 | 95 | export default form; 96 | -------------------------------------------------------------------------------- /example/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import {AppRegistry} from 'react-native'; 6 | import App from './App'; 7 | import {name as appName} from './app.json'; 8 | 9 | AppRegistry.registerComponent(appName, () => App); 10 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '9.0' 2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 3 | 4 | target 'example' do 5 | # Pods for example 6 | pod 'React', :path => '../node_modules/react-native/' 7 | pod 'React-Core', :path => '../node_modules/react-native/React' 8 | pod 'React-DevSupport', :path => '../node_modules/react-native/React' 9 | pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS' 10 | pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation' 11 | pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob' 12 | pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image' 13 | pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS' 14 | pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network' 15 | pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings' 16 | pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text' 17 | pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration' 18 | pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket' 19 | 20 | pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact' 21 | pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi' 22 | pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor' 23 | pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector' 24 | pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga' 25 | 26 | pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' 27 | pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec' 28 | pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' 29 | 30 | target 'exampleTests' do 31 | inherit! :search_paths 32 | # Pods for testing 33 | end 34 | 35 | use_native_modules! 36 | end 37 | 38 | target 'example-tvOS' do 39 | # Pods for example-tvOS 40 | 41 | target 'example-tvOSTests' do 42 | inherit! :search_paths 43 | # Pods for testing 44 | end 45 | 46 | end 47 | -------------------------------------------------------------------------------- /example/ios/example-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | NSAppTransportSecurity 26 | 27 | NSExceptionDomains 28 | 29 | localhost 30 | 31 | NSExceptionAllowsInsecureHTTPLoads 32 | 33 | 34 | 35 | 36 | NSLocationWhenInUseUsageDescription 37 | 38 | UILaunchStoryboardName 39 | LaunchScreen 40 | UIRequiredDeviceCapabilities 41 | 42 | armv7 43 | 44 | UISupportedInterfaceOrientations 45 | 46 | UIInterfaceOrientationPortrait 47 | UIInterfaceOrientationLandscapeLeft 48 | UIInterfaceOrientationLandscapeRight 49 | 50 | UIViewControllerBasedStatusBarAppearance 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /example/ios/example-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /example/ios/example.xcodeproj/xcshareddata/xcschemes/example-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /example/ios/example/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (nonatomic, strong) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /example/ios/example/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import "AppDelegate.h" 9 | 10 | #import 11 | #import 12 | #import 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 19 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 20 | moduleName:@"example" 21 | initialProperties:nil]; 22 | 23 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 24 | 25 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 26 | UIViewController *rootViewController = [UIViewController new]; 27 | rootViewController.view = rootView; 28 | self.window.rootViewController = rootViewController; 29 | [self.window makeKeyAndVisible]; 30 | return YES; 31 | } 32 | 33 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 34 | { 35 | #if DEBUG 36 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 37 | #else 38 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 39 | #endif 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /example/ios/example/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /example/ios/example/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | example 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | NSExceptionDomains 32 | 33 | localhost 34 | 35 | NSExceptionAllowsInsecureHTTPLoads 36 | 37 | 38 | 39 | 40 | NSLocationWhenInUseUsageDescription 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | UIViewControllerBasedStatusBarAppearance 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /example/ios/example/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /example/ios/exampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /example/ios/exampleTests/exampleTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | #import 12 | #import 13 | 14 | #define TIMEOUT_SECONDS 600 15 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 16 | 17 | @interface exampleTests : XCTestCase 18 | 19 | @end 20 | 21 | @implementation exampleTests 22 | 23 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 24 | { 25 | if (test(view)) { 26 | return YES; 27 | } 28 | for (UIView *subview in [view subviews]) { 29 | if ([self findSubviewInView:subview matching:test]) { 30 | return YES; 31 | } 32 | } 33 | return NO; 34 | } 35 | 36 | - (void)testRendersWelcomeScreen 37 | { 38 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 39 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 40 | BOOL foundElement = NO; 41 | 42 | __block NSString *redboxError = nil; 43 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 44 | if (level >= RCTLogLevelError) { 45 | redboxError = message; 46 | } 47 | }); 48 | 49 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 50 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 51 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 52 | 53 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 54 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 55 | return YES; 56 | } 57 | return NO; 58 | }]; 59 | } 60 | 61 | RCTSetLogFunction(RCTDefaultLogFunction); 62 | 63 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 64 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 65 | } 66 | 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /example/metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | 8 | module.exports = { 9 | transformer: { 10 | getTransformOptions: async () => ({ 11 | transform: { 12 | experimentalImportSupport: false, 13 | inlineRequires: false, 14 | }, 15 | }), 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "react-native start", 7 | "test": "jest", 8 | "lint": "eslint ." 9 | }, 10 | "dependencies": { 11 | "@react-native-community/cli": "^2.9.0", 12 | "react": "16.8.6", 13 | "react-native": "0.60.5", 14 | "react-native-svg": "^9.6.4", 15 | "react-native-svg-icon": "^0.8.1", 16 | "react-native-typed-forms": "0.0.1", 17 | "react-native-vector-icons": "^6.6.0" 18 | }, 19 | "devDependencies": { 20 | "@babel/core": "^7.5.5", 21 | "@babel/runtime": "^7.5.5", 22 | "@react-native-community/eslint-config": "^0.0.5", 23 | "babel-jest": "^24.9.0", 24 | "eslint": "^6.2.0", 25 | "jest": "^24.9.0", 26 | "metro": "^0.56.0", 27 | "metro-react-native-babel-preset": "^0.56.0", 28 | "react-test-renderer": "16.8.6" 29 | }, 30 | "jest": { 31 | "preset": "react-native" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /flow-typed/npm/@babel/cli_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 49b93df4311009360e48f4aac999c381 2 | // flow-typed version: <>/@babel/cli_v^7.5.5/flow_v0.105.2 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * '@babel/cli' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module '@babel/cli' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module '@babel/cli/bin/babel-external-helpers' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module '@babel/cli/bin/babel' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module '@babel/cli/lib/babel-external-helpers' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module '@babel/cli/lib/babel/dir' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module '@babel/cli/lib/babel/file' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module '@babel/cli/lib/babel' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module '@babel/cli/lib/babel/options' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module '@babel/cli/lib/babel/util' { 54 | declare module.exports: any; 55 | } 56 | 57 | // Filename aliases 58 | declare module '@babel/cli/bin/babel-external-helpers.js' { 59 | declare module.exports: $Exports<'@babel/cli/bin/babel-external-helpers'>; 60 | } 61 | declare module '@babel/cli/bin/babel.js' { 62 | declare module.exports: $Exports<'@babel/cli/bin/babel'>; 63 | } 64 | declare module '@babel/cli/index' { 65 | declare module.exports: $Exports<'@babel/cli'>; 66 | } 67 | declare module '@babel/cli/index.js' { 68 | declare module.exports: $Exports<'@babel/cli'>; 69 | } 70 | declare module '@babel/cli/lib/babel-external-helpers.js' { 71 | declare module.exports: $Exports<'@babel/cli/lib/babel-external-helpers'>; 72 | } 73 | declare module '@babel/cli/lib/babel/dir.js' { 74 | declare module.exports: $Exports<'@babel/cli/lib/babel/dir'>; 75 | } 76 | declare module '@babel/cli/lib/babel/file.js' { 77 | declare module.exports: $Exports<'@babel/cli/lib/babel/file'>; 78 | } 79 | declare module '@babel/cli/lib/babel/index' { 80 | declare module.exports: $Exports<'@babel/cli/lib/babel'>; 81 | } 82 | declare module '@babel/cli/lib/babel/index.js' { 83 | declare module.exports: $Exports<'@babel/cli/lib/babel'>; 84 | } 85 | declare module '@babel/cli/lib/babel/options.js' { 86 | declare module.exports: $Exports<'@babel/cli/lib/babel/options'>; 87 | } 88 | declare module '@babel/cli/lib/babel/util.js' { 89 | declare module.exports: $Exports<'@babel/cli/lib/babel/util'>; 90 | } 91 | -------------------------------------------------------------------------------- /flow-typed/npm/@babel/node_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 293020597a3cc236914015d7bab5c8d4 2 | // flow-typed version: <>/@babel/node_v^7.5.5/flow_v0.105.2 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * '@babel/node' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module '@babel/node' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module '@babel/node/bin/babel-node' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module '@babel/node/lib/_babel-node' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module '@babel/node/lib/babel-node' { 34 | declare module.exports: any; 35 | } 36 | 37 | // Filename aliases 38 | declare module '@babel/node/bin/babel-node.js' { 39 | declare module.exports: $Exports<'@babel/node/bin/babel-node'>; 40 | } 41 | declare module '@babel/node/lib/_babel-node.js' { 42 | declare module.exports: $Exports<'@babel/node/lib/_babel-node'>; 43 | } 44 | declare module '@babel/node/lib/babel-node.js' { 45 | declare module.exports: $Exports<'@babel/node/lib/babel-node'>; 46 | } 47 | -------------------------------------------------------------------------------- /flow-typed/npm/@babel/preset-env_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 557b87814a1446d3969ec5d038b1a8b1 2 | // flow-typed version: <>/@babel/preset-env_v^7.5.5/flow_v0.105.2 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * '@babel/preset-env' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module '@babel/preset-env' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module '@babel/preset-env/data/built-ins.json' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module '@babel/preset-env/data/corejs2-built-in-features' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module '@babel/preset-env/data/plugin-features' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module '@babel/preset-env/data/shipped-proposals' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module '@babel/preset-env/data/unreleased-labels' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module '@babel/preset-env/lib/available-plugins' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module '@babel/preset-env/lib/debug' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module '@babel/preset-env/lib/filter-items' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module '@babel/preset-env/lib/get-option-specific-excludes' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module '@babel/preset-env/lib' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module '@babel/preset-env/lib/module-transformations' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module '@babel/preset-env/lib/normalize-options' { 70 | declare module.exports: any; 71 | } 72 | 73 | declare module '@babel/preset-env/lib/options' { 74 | declare module.exports: any; 75 | } 76 | 77 | declare module '@babel/preset-env/lib/polyfills/corejs2/built-in-definitions' { 78 | declare module.exports: any; 79 | } 80 | 81 | declare module '@babel/preset-env/lib/polyfills/corejs2/entry-plugin' { 82 | declare module.exports: any; 83 | } 84 | 85 | declare module '@babel/preset-env/lib/polyfills/corejs2/get-platform-specific-default' { 86 | declare module.exports: any; 87 | } 88 | 89 | declare module '@babel/preset-env/lib/polyfills/corejs2/usage-plugin' { 90 | declare module.exports: any; 91 | } 92 | 93 | declare module '@babel/preset-env/lib/polyfills/corejs3/built-in-definitions' { 94 | declare module.exports: any; 95 | } 96 | 97 | declare module '@babel/preset-env/lib/polyfills/corejs3/entry-plugin' { 98 | declare module.exports: any; 99 | } 100 | 101 | declare module '@babel/preset-env/lib/polyfills/corejs3/shipped-proposals' { 102 | declare module.exports: any; 103 | } 104 | 105 | declare module '@babel/preset-env/lib/polyfills/corejs3/usage-plugin' { 106 | declare module.exports: any; 107 | } 108 | 109 | declare module '@babel/preset-env/lib/polyfills/regenerator/entry-plugin' { 110 | declare module.exports: any; 111 | } 112 | 113 | declare module '@babel/preset-env/lib/polyfills/regenerator/usage-plugin' { 114 | declare module.exports: any; 115 | } 116 | 117 | declare module '@babel/preset-env/lib/targets-parser' { 118 | declare module.exports: any; 119 | } 120 | 121 | declare module '@babel/preset-env/lib/utils' { 122 | declare module.exports: any; 123 | } 124 | 125 | // Filename aliases 126 | declare module '@babel/preset-env/data/built-ins.json.js' { 127 | declare module.exports: $Exports<'@babel/preset-env/data/built-ins.json'>; 128 | } 129 | declare module '@babel/preset-env/data/corejs2-built-in-features.js' { 130 | declare module.exports: $Exports<'@babel/preset-env/data/corejs2-built-in-features'>; 131 | } 132 | declare module '@babel/preset-env/data/plugin-features.js' { 133 | declare module.exports: $Exports<'@babel/preset-env/data/plugin-features'>; 134 | } 135 | declare module '@babel/preset-env/data/shipped-proposals.js' { 136 | declare module.exports: $Exports<'@babel/preset-env/data/shipped-proposals'>; 137 | } 138 | declare module '@babel/preset-env/data/unreleased-labels.js' { 139 | declare module.exports: $Exports<'@babel/preset-env/data/unreleased-labels'>; 140 | } 141 | declare module '@babel/preset-env/lib/available-plugins.js' { 142 | declare module.exports: $Exports<'@babel/preset-env/lib/available-plugins'>; 143 | } 144 | declare module '@babel/preset-env/lib/debug.js' { 145 | declare module.exports: $Exports<'@babel/preset-env/lib/debug'>; 146 | } 147 | declare module '@babel/preset-env/lib/filter-items.js' { 148 | declare module.exports: $Exports<'@babel/preset-env/lib/filter-items'>; 149 | } 150 | declare module '@babel/preset-env/lib/get-option-specific-excludes.js' { 151 | declare module.exports: $Exports<'@babel/preset-env/lib/get-option-specific-excludes'>; 152 | } 153 | declare module '@babel/preset-env/lib/index' { 154 | declare module.exports: $Exports<'@babel/preset-env/lib'>; 155 | } 156 | declare module '@babel/preset-env/lib/index.js' { 157 | declare module.exports: $Exports<'@babel/preset-env/lib'>; 158 | } 159 | declare module '@babel/preset-env/lib/module-transformations.js' { 160 | declare module.exports: $Exports<'@babel/preset-env/lib/module-transformations'>; 161 | } 162 | declare module '@babel/preset-env/lib/normalize-options.js' { 163 | declare module.exports: $Exports<'@babel/preset-env/lib/normalize-options'>; 164 | } 165 | declare module '@babel/preset-env/lib/options.js' { 166 | declare module.exports: $Exports<'@babel/preset-env/lib/options'>; 167 | } 168 | declare module '@babel/preset-env/lib/polyfills/corejs2/built-in-definitions.js' { 169 | declare module.exports: $Exports<'@babel/preset-env/lib/polyfills/corejs2/built-in-definitions'>; 170 | } 171 | declare module '@babel/preset-env/lib/polyfills/corejs2/entry-plugin.js' { 172 | declare module.exports: $Exports<'@babel/preset-env/lib/polyfills/corejs2/entry-plugin'>; 173 | } 174 | declare module '@babel/preset-env/lib/polyfills/corejs2/get-platform-specific-default.js' { 175 | declare module.exports: $Exports<'@babel/preset-env/lib/polyfills/corejs2/get-platform-specific-default'>; 176 | } 177 | declare module '@babel/preset-env/lib/polyfills/corejs2/usage-plugin.js' { 178 | declare module.exports: $Exports<'@babel/preset-env/lib/polyfills/corejs2/usage-plugin'>; 179 | } 180 | declare module '@babel/preset-env/lib/polyfills/corejs3/built-in-definitions.js' { 181 | declare module.exports: $Exports<'@babel/preset-env/lib/polyfills/corejs3/built-in-definitions'>; 182 | } 183 | declare module '@babel/preset-env/lib/polyfills/corejs3/entry-plugin.js' { 184 | declare module.exports: $Exports<'@babel/preset-env/lib/polyfills/corejs3/entry-plugin'>; 185 | } 186 | declare module '@babel/preset-env/lib/polyfills/corejs3/shipped-proposals.js' { 187 | declare module.exports: $Exports<'@babel/preset-env/lib/polyfills/corejs3/shipped-proposals'>; 188 | } 189 | declare module '@babel/preset-env/lib/polyfills/corejs3/usage-plugin.js' { 190 | declare module.exports: $Exports<'@babel/preset-env/lib/polyfills/corejs3/usage-plugin'>; 191 | } 192 | declare module '@babel/preset-env/lib/polyfills/regenerator/entry-plugin.js' { 193 | declare module.exports: $Exports<'@babel/preset-env/lib/polyfills/regenerator/entry-plugin'>; 194 | } 195 | declare module '@babel/preset-env/lib/polyfills/regenerator/usage-plugin.js' { 196 | declare module.exports: $Exports<'@babel/preset-env/lib/polyfills/regenerator/usage-plugin'>; 197 | } 198 | declare module '@babel/preset-env/lib/targets-parser.js' { 199 | declare module.exports: $Exports<'@babel/preset-env/lib/targets-parser'>; 200 | } 201 | declare module '@babel/preset-env/lib/utils.js' { 202 | declare module.exports: $Exports<'@babel/preset-env/lib/utils'>; 203 | } 204 | -------------------------------------------------------------------------------- /flow-typed/npm/@babel/preset-flow_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 606c8dab5340aad8801fa5d968ad1dc7 2 | // flow-typed version: <>/@babel/preset-flow_v^7.0.0/flow_v0.105.2 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * '@babel/preset-flow' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module '@babel/preset-flow' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module '@babel/preset-flow/lib' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module '@babel/preset-flow/lib/index' { 31 | declare module.exports: $Exports<'@babel/preset-flow/lib'>; 32 | } 33 | declare module '@babel/preset-flow/lib/index.js' { 34 | declare module.exports: $Exports<'@babel/preset-flow/lib'>; 35 | } 36 | -------------------------------------------------------------------------------- /flow-typed/npm/@babel/register_v7.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 6081de9360ebced3466a039a11a4d6cf 2 | // flow-typed version: c6154227d1/@babel/register_v7.x.x/flow_>=v0.104.x 3 | 4 | declare module '@babel/register' { 5 | declare type Ignore = boolean | string | RegExp | (filename: string) => boolean; 6 | declare type Options = {| 7 | ast?: boolean, 8 | auxiliaryCommentAfter?: ?string, 9 | auxiliaryCommentBefore?: ?string, 10 | babelrc?: boolean, 11 | code?: boolean, 12 | comments?: boolean, 13 | compact?: 'auto' | boolean, 14 | configFile?: string | boolean, 15 | env?: Object, 16 | extends?: ?string, 17 | extensions?: Array, 18 | filename?: string, 19 | filenameRelative?: string, 20 | generatorOpts?: Object, 21 | getModuleId?: void | null | (moduleName: string) => string, 22 | highlightCode?: boolean, 23 | ignore?: Ignore | Array, 24 | inputSourceMap?: Object, 25 | minified?: boolean, 26 | moduleId?: string, 27 | moduleIds?: boolean, 28 | moduleRoot?: string, 29 | only?: RegExp, 30 | parserOpts?: Object, 31 | plugins?: Array<[string, Object] | string>, 32 | presets?: Array, 33 | retainLines?: boolean, 34 | resolveModuleSource?: null | (source: string, filename: string) => boolean, 35 | shouldPrintComment?: null | (commentContents: string) => string, 36 | sourceFileName?: string, 37 | sourceMaps?: boolean | 'inline' | 'both', 38 | sourceMapTarget?: string, 39 | sourceRoot?: string, 40 | sourceType?: 'script' | 'module', 41 | wrapPluginVisitorMethod?: null | (pluginAlias: string, visitorType: string, callback: Function) => boolean, 42 | extensions?: Array, 43 | cache?: boolean, 44 | |}; 45 | 46 | declare module.exports: (options?: Options) => void; 47 | } 48 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-eslint_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: dc2064eff3f8465e9c50ade6f91f2047 2 | // flow-typed version: <>/babel-eslint_v^10.0.2/flow_v0.105.2 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-eslint' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-eslint' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-eslint/lib/analyze-scope' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-eslint/lib/babylon-to-espree/attachComments' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'babel-eslint/lib/babylon-to-espree/convertComments' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'babel-eslint/lib/babylon-to-espree/convertTemplateType' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'babel-eslint/lib/babylon-to-espree' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'babel-eslint/lib/babylon-to-espree/toAST' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'babel-eslint/lib/babylon-to-espree/toToken' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'babel-eslint/lib/babylon-to-espree/toTokens' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'babel-eslint/lib' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'babel-eslint/lib/parse-with-scope' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'babel-eslint/lib/parse' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module 'babel-eslint/lib/visitor-keys' { 70 | declare module.exports: any; 71 | } 72 | 73 | // Filename aliases 74 | declare module 'babel-eslint/lib/analyze-scope.js' { 75 | declare module.exports: $Exports<'babel-eslint/lib/analyze-scope'>; 76 | } 77 | declare module 'babel-eslint/lib/babylon-to-espree/attachComments.js' { 78 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/attachComments'>; 79 | } 80 | declare module 'babel-eslint/lib/babylon-to-espree/convertComments.js' { 81 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/convertComments'>; 82 | } 83 | declare module 'babel-eslint/lib/babylon-to-espree/convertTemplateType.js' { 84 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/convertTemplateType'>; 85 | } 86 | declare module 'babel-eslint/lib/babylon-to-espree/index' { 87 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree'>; 88 | } 89 | declare module 'babel-eslint/lib/babylon-to-espree/index.js' { 90 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree'>; 91 | } 92 | declare module 'babel-eslint/lib/babylon-to-espree/toAST.js' { 93 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/toAST'>; 94 | } 95 | declare module 'babel-eslint/lib/babylon-to-espree/toToken.js' { 96 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/toToken'>; 97 | } 98 | declare module 'babel-eslint/lib/babylon-to-espree/toTokens.js' { 99 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/toTokens'>; 100 | } 101 | declare module 'babel-eslint/lib/index' { 102 | declare module.exports: $Exports<'babel-eslint/lib'>; 103 | } 104 | declare module 'babel-eslint/lib/index.js' { 105 | declare module.exports: $Exports<'babel-eslint/lib'>; 106 | } 107 | declare module 'babel-eslint/lib/parse-with-scope.js' { 108 | declare module.exports: $Exports<'babel-eslint/lib/parse-with-scope'>; 109 | } 110 | declare module 'babel-eslint/lib/parse.js' { 111 | declare module.exports: $Exports<'babel-eslint/lib/parse'>; 112 | } 113 | declare module 'babel-eslint/lib/visitor-keys.js' { 114 | declare module.exports: $Exports<'babel-eslint/lib/visitor-keys'>; 115 | } 116 | -------------------------------------------------------------------------------- /flow-typed/npm/flow-bin_v0.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: defcb6d3fbb0946084b6113e14859c31 2 | // flow-typed version: c6154227d1/flow-bin_v0.x.x/flow_>=v0.104.x 3 | 4 | declare module "flow-bin" { 5 | declare module.exports: string; 6 | } 7 | -------------------------------------------------------------------------------- /flow-typed/npm/flow-typed_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 2306ed819893605543dba224568bc36c 2 | // flow-typed version: <>/flow-typed_v^2.6.1/flow_v0.105.2 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'flow-typed' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'flow-typed' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'flow-typed/dist/cli' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'flow-typed/dist/commands/create-stub' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'flow-typed/dist/commands/install' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'flow-typed/dist/commands/runTests' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'flow-typed/dist/commands/search' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'flow-typed/dist/commands/update-cache' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'flow-typed/dist/commands/update' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'flow-typed/dist/commands/validateDefs' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'flow-typed/dist/lib/cacheRepoUtils' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'flow-typed/dist/lib/codeSign' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'flow-typed/dist/lib/fileUtils' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module 'flow-typed/dist/lib/flowProjectUtils' { 70 | declare module.exports: any; 71 | } 72 | 73 | declare module 'flow-typed/dist/lib/flowVersion' { 74 | declare module.exports: any; 75 | } 76 | 77 | declare module 'flow-typed/dist/lib/git' { 78 | declare module.exports: any; 79 | } 80 | 81 | declare module 'flow-typed/dist/lib/github' { 82 | declare module.exports: any; 83 | } 84 | 85 | declare module 'flow-typed/dist/lib/isInFlowTypedRepo' { 86 | declare module.exports: any; 87 | } 88 | 89 | declare module 'flow-typed/dist/lib/libDefs' { 90 | declare module.exports: any; 91 | } 92 | 93 | declare module 'flow-typed/dist/lib/node' { 94 | declare module.exports: any; 95 | } 96 | 97 | declare module 'flow-typed/dist/lib/npm/npmLibDefs' { 98 | declare module.exports: any; 99 | } 100 | 101 | declare module 'flow-typed/dist/lib/npm/npmProjectUtils' { 102 | declare module.exports: any; 103 | } 104 | 105 | declare module 'flow-typed/dist/lib/semver' { 106 | declare module.exports: any; 107 | } 108 | 109 | declare module 'flow-typed/dist/lib/stubUtils' { 110 | declare module.exports: any; 111 | } 112 | 113 | declare module 'flow-typed/dist/lib/ValidationError' { 114 | declare module.exports: any; 115 | } 116 | 117 | // Filename aliases 118 | declare module 'flow-typed/dist/cli.js' { 119 | declare module.exports: $Exports<'flow-typed/dist/cli'>; 120 | } 121 | declare module 'flow-typed/dist/commands/create-stub.js' { 122 | declare module.exports: $Exports<'flow-typed/dist/commands/create-stub'>; 123 | } 124 | declare module 'flow-typed/dist/commands/install.js' { 125 | declare module.exports: $Exports<'flow-typed/dist/commands/install'>; 126 | } 127 | declare module 'flow-typed/dist/commands/runTests.js' { 128 | declare module.exports: $Exports<'flow-typed/dist/commands/runTests'>; 129 | } 130 | declare module 'flow-typed/dist/commands/search.js' { 131 | declare module.exports: $Exports<'flow-typed/dist/commands/search'>; 132 | } 133 | declare module 'flow-typed/dist/commands/update-cache.js' { 134 | declare module.exports: $Exports<'flow-typed/dist/commands/update-cache'>; 135 | } 136 | declare module 'flow-typed/dist/commands/update.js' { 137 | declare module.exports: $Exports<'flow-typed/dist/commands/update'>; 138 | } 139 | declare module 'flow-typed/dist/commands/validateDefs.js' { 140 | declare module.exports: $Exports<'flow-typed/dist/commands/validateDefs'>; 141 | } 142 | declare module 'flow-typed/dist/lib/cacheRepoUtils.js' { 143 | declare module.exports: $Exports<'flow-typed/dist/lib/cacheRepoUtils'>; 144 | } 145 | declare module 'flow-typed/dist/lib/codeSign.js' { 146 | declare module.exports: $Exports<'flow-typed/dist/lib/codeSign'>; 147 | } 148 | declare module 'flow-typed/dist/lib/fileUtils.js' { 149 | declare module.exports: $Exports<'flow-typed/dist/lib/fileUtils'>; 150 | } 151 | declare module 'flow-typed/dist/lib/flowProjectUtils.js' { 152 | declare module.exports: $Exports<'flow-typed/dist/lib/flowProjectUtils'>; 153 | } 154 | declare module 'flow-typed/dist/lib/flowVersion.js' { 155 | declare module.exports: $Exports<'flow-typed/dist/lib/flowVersion'>; 156 | } 157 | declare module 'flow-typed/dist/lib/git.js' { 158 | declare module.exports: $Exports<'flow-typed/dist/lib/git'>; 159 | } 160 | declare module 'flow-typed/dist/lib/github.js' { 161 | declare module.exports: $Exports<'flow-typed/dist/lib/github'>; 162 | } 163 | declare module 'flow-typed/dist/lib/isInFlowTypedRepo.js' { 164 | declare module.exports: $Exports<'flow-typed/dist/lib/isInFlowTypedRepo'>; 165 | } 166 | declare module 'flow-typed/dist/lib/libDefs.js' { 167 | declare module.exports: $Exports<'flow-typed/dist/lib/libDefs'>; 168 | } 169 | declare module 'flow-typed/dist/lib/node.js' { 170 | declare module.exports: $Exports<'flow-typed/dist/lib/node'>; 171 | } 172 | declare module 'flow-typed/dist/lib/npm/npmLibDefs.js' { 173 | declare module.exports: $Exports<'flow-typed/dist/lib/npm/npmLibDefs'>; 174 | } 175 | declare module 'flow-typed/dist/lib/npm/npmProjectUtils.js' { 176 | declare module.exports: $Exports<'flow-typed/dist/lib/npm/npmProjectUtils'>; 177 | } 178 | declare module 'flow-typed/dist/lib/semver.js' { 179 | declare module.exports: $Exports<'flow-typed/dist/lib/semver'>; 180 | } 181 | declare module 'flow-typed/dist/lib/stubUtils.js' { 182 | declare module.exports: $Exports<'flow-typed/dist/lib/stubUtils'>; 183 | } 184 | declare module 'flow-typed/dist/lib/ValidationError.js' { 185 | declare module.exports: $Exports<'flow-typed/dist/lib/ValidationError'>; 186 | } 187 | -------------------------------------------------------------------------------- /flow-typed/npm/flow_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 1c704b2d3d2ee44c36c1f3fbd9107c91 2 | // flow-typed version: <>/flow_v^0.2.3/flow_v0.105.2 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'flow' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'flow' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'flow/examples/keystore' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'flow/examples/multi' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'flow/examples/serialForEach' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'flow/examples/simple' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'flow/flow' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'flow/tests' { 46 | declare module.exports: any; 47 | } 48 | 49 | // Filename aliases 50 | declare module 'flow/examples/keystore.js' { 51 | declare module.exports: $Exports<'flow/examples/keystore'>; 52 | } 53 | declare module 'flow/examples/multi.js' { 54 | declare module.exports: $Exports<'flow/examples/multi'>; 55 | } 56 | declare module 'flow/examples/serialForEach.js' { 57 | declare module.exports: $Exports<'flow/examples/serialForEach'>; 58 | } 59 | declare module 'flow/examples/simple.js' { 60 | declare module.exports: $Exports<'flow/examples/simple'>; 61 | } 62 | declare module 'flow/flow.js' { 63 | declare module.exports: $Exports<'flow/flow'>; 64 | } 65 | declare module 'flow/tests.js' { 66 | declare module.exports: $Exports<'flow/tests'>; 67 | } 68 | -------------------------------------------------------------------------------- /flow-typed/npm/metro-react-native-babel-preset_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: afc3d48372a733c2b44f470bfef42056 2 | // flow-typed version: <>/metro-react-native-babel-preset_v^0.56.0/flow_v0.105.2 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'metro-react-native-babel-preset' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'metro-react-native-babel-preset' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'metro-react-native-babel-preset/src/configs/hmr' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'metro-react-native-babel-preset/src/configs/lazy-imports' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'metro-react-native-babel-preset/src/configs/main' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'metro-react-native-babel-preset/src' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'metro-react-native-babel-preset/src/transforms/transform-symbol-member' { 42 | declare module.exports: any; 43 | } 44 | 45 | // Filename aliases 46 | declare module 'metro-react-native-babel-preset/src/configs/hmr.js' { 47 | declare module.exports: $Exports<'metro-react-native-babel-preset/src/configs/hmr'>; 48 | } 49 | declare module 'metro-react-native-babel-preset/src/configs/lazy-imports.js' { 50 | declare module.exports: $Exports<'metro-react-native-babel-preset/src/configs/lazy-imports'>; 51 | } 52 | declare module 'metro-react-native-babel-preset/src/configs/main.js' { 53 | declare module.exports: $Exports<'metro-react-native-babel-preset/src/configs/main'>; 54 | } 55 | declare module 'metro-react-native-babel-preset/src/index' { 56 | declare module.exports: $Exports<'metro-react-native-babel-preset/src'>; 57 | } 58 | declare module 'metro-react-native-babel-preset/src/index.js' { 59 | declare module.exports: $Exports<'metro-react-native-babel-preset/src'>; 60 | } 61 | declare module 'metro-react-native-babel-preset/src/transforms/transform-symbol-member.js' { 62 | declare module.exports: $Exports<'metro-react-native-babel-preset/src/transforms/transform-symbol-member'>; 63 | } 64 | -------------------------------------------------------------------------------- /flow-typed/npm/prettier-eslint-cli_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 0a697078f6c195bfd74e4e9c2c92b924 2 | // flow-typed version: <>/prettier-eslint-cli_v^5.0.0/flow_v0.105.2 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'prettier-eslint-cli' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'prettier-eslint-cli' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'prettier-eslint-cli/dist/add-exception-handler' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'prettier-eslint-cli/dist/argv' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'prettier-eslint-cli/dist/format-files' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'prettier-eslint-cli/dist/format-files.test' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'prettier-eslint-cli/dist' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'prettier-eslint-cli/dist/message.test' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'prettier-eslint-cli/dist/messages' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'prettier-eslint-cli/dist/no-main' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'prettier-eslint-cli/dist/parser' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'prettier-eslint-cli/dist/uncaught-exception-handler' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'prettier-eslint-cli/dist/uncaught-exception-handler.test' { 66 | declare module.exports: any; 67 | } 68 | 69 | // Filename aliases 70 | declare module 'prettier-eslint-cli/dist/add-exception-handler.js' { 71 | declare module.exports: $Exports<'prettier-eslint-cli/dist/add-exception-handler'>; 72 | } 73 | declare module 'prettier-eslint-cli/dist/argv.js' { 74 | declare module.exports: $Exports<'prettier-eslint-cli/dist/argv'>; 75 | } 76 | declare module 'prettier-eslint-cli/dist/format-files.js' { 77 | declare module.exports: $Exports<'prettier-eslint-cli/dist/format-files'>; 78 | } 79 | declare module 'prettier-eslint-cli/dist/format-files.test.js' { 80 | declare module.exports: $Exports<'prettier-eslint-cli/dist/format-files.test'>; 81 | } 82 | declare module 'prettier-eslint-cli/dist/index' { 83 | declare module.exports: $Exports<'prettier-eslint-cli/dist'>; 84 | } 85 | declare module 'prettier-eslint-cli/dist/index.js' { 86 | declare module.exports: $Exports<'prettier-eslint-cli/dist'>; 87 | } 88 | declare module 'prettier-eslint-cli/dist/message.test.js' { 89 | declare module.exports: $Exports<'prettier-eslint-cli/dist/message.test'>; 90 | } 91 | declare module 'prettier-eslint-cli/dist/messages.js' { 92 | declare module.exports: $Exports<'prettier-eslint-cli/dist/messages'>; 93 | } 94 | declare module 'prettier-eslint-cli/dist/no-main.js' { 95 | declare module.exports: $Exports<'prettier-eslint-cli/dist/no-main'>; 96 | } 97 | declare module 'prettier-eslint-cli/dist/parser.js' { 98 | declare module.exports: $Exports<'prettier-eslint-cli/dist/parser'>; 99 | } 100 | declare module 'prettier-eslint-cli/dist/uncaught-exception-handler.js' { 101 | declare module.exports: $Exports<'prettier-eslint-cli/dist/uncaught-exception-handler'>; 102 | } 103 | declare module 'prettier-eslint-cli/dist/uncaught-exception-handler.test.js' { 104 | declare module.exports: $Exports<'prettier-eslint-cli/dist/uncaught-exception-handler.test'>; 105 | } 106 | -------------------------------------------------------------------------------- /flow-typed/npm/prettier-eslint_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: ccccb8cbc63fbe4d84018f7c9871bc7b 2 | // flow-typed version: <>/prettier-eslint_v^9.0.0/flow_v0.105.2 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'prettier-eslint' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'prettier-eslint' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'prettier-eslint/dist' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'prettier-eslint/dist/utils' { 30 | declare module.exports: any; 31 | } 32 | 33 | // Filename aliases 34 | declare module 'prettier-eslint/dist/index' { 35 | declare module.exports: $Exports<'prettier-eslint/dist'>; 36 | } 37 | declare module 'prettier-eslint/dist/index.js' { 38 | declare module.exports: $Exports<'prettier-eslint/dist'>; 39 | } 40 | declare module 'prettier-eslint/dist/utils.js' { 41 | declare module.exports: $Exports<'prettier-eslint/dist/utils'>; 42 | } 43 | -------------------------------------------------------------------------------- /flow-typed/npm/react-native-modal-selector_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: fe69f93363c61435434ce79cd646ad96 2 | // flow-typed version: <>/react-native-modal-selector_v^1.1.1/flow_v0.105.2 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'react-native-modal-selector' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'react-native-modal-selector' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'react-native-modal-selector/style' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'react-native-modal-selector/index' { 31 | declare module.exports: $Exports<'react-native-modal-selector'>; 32 | } 33 | declare module 'react-native-modal-selector/index.js' { 34 | declare module.exports: $Exports<'react-native-modal-selector'>; 35 | } 36 | declare module 'react-native-modal-selector/style.js' { 37 | declare module.exports: $Exports<'react-native-modal-selector/style'>; 38 | } 39 | -------------------------------------------------------------------------------- /flow-typed/npm/react-native-svg-icon_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: baf79935fcb90224e41af90e08ebfef5 2 | // flow-typed version: <>/react-native-svg-icon_v>=0.8.1/flow_v0.105.2 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'react-native-svg-icon' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'react-native-svg-icon' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'react-native-svg-icon/lib/components/SvgIcon' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'react-native-svg-icon/lib' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'react-native-svg-icon/src/components/SvgIcon' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'react-native-svg-icon/src' { 38 | declare module.exports: any; 39 | } 40 | 41 | // Filename aliases 42 | declare module 'react-native-svg-icon/lib/components/SvgIcon.js' { 43 | declare module.exports: $Exports<'react-native-svg-icon/lib/components/SvgIcon'>; 44 | } 45 | declare module 'react-native-svg-icon/lib/index' { 46 | declare module.exports: $Exports<'react-native-svg-icon/lib'>; 47 | } 48 | declare module 'react-native-svg-icon/lib/index.js' { 49 | declare module.exports: $Exports<'react-native-svg-icon/lib'>; 50 | } 51 | declare module 'react-native-svg-icon/src/components/SvgIcon.js' { 52 | declare module.exports: $Exports<'react-native-svg-icon/src/components/SvgIcon'>; 53 | } 54 | declare module 'react-native-svg-icon/src/index' { 55 | declare module.exports: $Exports<'react-native-svg-icon/src'>; 56 | } 57 | declare module 'react-native-svg-icon/src/index.js' { 58 | declare module.exports: $Exports<'react-native-svg-icon/src'>; 59 | } 60 | -------------------------------------------------------------------------------- /flow-typed/npm/uuid_v3.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 2af209d140e3c533e62e2a7b5f729cbb 2 | // flow-typed version: c6154227d1/uuid_v3.x.x/flow_>=v0.104.x 3 | 4 | declare module "uuid" { 5 | declare class uuid { 6 | static ( 7 | options?: {| 8 | random?: number[], 9 | rng?: () => number[] | Buffer 10 | |}, 11 | buffer?: number[] | Buffer, 12 | offset?: number 13 | ): string, 14 | 15 | static v1( 16 | options?: {| 17 | node?: number[], 18 | clockseq?: number, 19 | msecs?: number | Date, 20 | nsecs?: number 21 | |}, 22 | buffer?: number[] | Buffer, 23 | offset?: number 24 | ): string, 25 | 26 | static v4( 27 | options?: {| 28 | random?: number[], 29 | rng?: () => number[] | Buffer 30 | |}, 31 | buffer?: number[] | Buffer, 32 | offset?: number 33 | ): string 34 | } 35 | declare module.exports: Class; 36 | } 37 | 38 | declare module "uuid/v1" { 39 | declare class v1 { 40 | static ( 41 | options?: {| 42 | node?: number[], 43 | clockseq?: number, 44 | msecs?: number | Date, 45 | nsecs?: number 46 | |}, 47 | buffer?: number[] | Buffer, 48 | offset?: number 49 | ): string 50 | } 51 | 52 | declare module.exports: Class; 53 | } 54 | 55 | declare module "uuid/v3" { 56 | declare class v3 { 57 | static ( 58 | name?: string | number[], 59 | namespace?: string | number[], 60 | buffer?: number[] | Buffer, 61 | offset?: number 62 | ): string, 63 | 64 | static name: string, 65 | static DNS: string, 66 | static URL: string 67 | } 68 | 69 | declare module.exports: Class; 70 | } 71 | 72 | declare module "uuid/v4" { 73 | declare class v4 { 74 | static ( 75 | options?: {| 76 | random?: number[], 77 | rng?: () => number[] | Buffer 78 | |}, 79 | buffer?: number[] | Buffer, 80 | offset?: number 81 | ): string 82 | } 83 | 84 | declare module.exports: Class; 85 | } 86 | 87 | declare module "uuid/v5" { 88 | declare class v5 { 89 | static ( 90 | name?: string | number[], 91 | namespace?: string | number[], 92 | buffer?: number[] | Buffer, 93 | offset?: number 94 | ): string, 95 | 96 | static name: string, 97 | static DNS: string, 98 | static URL: string 99 | } 100 | 101 | declare module.exports: Class; 102 | } 103 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import Form from "./src/components/Form"; 2 | import formTypes, { answerTypes, actionTypes } from "./src/forms/types" 3 | 4 | export { Form, formTypes, answerTypes, actionTypes }; 5 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-typed-forms", 3 | "version": "0.0.2", 4 | "description": "An easily customizable solution to make typed forms in react-native!", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [ 10 | "react", 11 | "react-native", 12 | "react-component", 13 | "react-native-component", 14 | "form", 15 | "forms", 16 | "react-native-forms", 17 | "typed-form", 18 | "custom-form", 19 | "styled-form", 20 | "android", 21 | "ios", 22 | "ui" 23 | ], 24 | "repository": { 25 | "url": "https://github.com/Graren/react-native-typed-forms" 26 | }, 27 | "author": "Oscar Colmenares", 28 | "license": "MIT", 29 | "devDependencies": { 30 | "@babel/cli": "^7.5.5", 31 | "@babel/core": "^7.5.5", 32 | "@babel/node": "^7.5.5", 33 | "@babel/preset-env": "^7.5.5", 34 | "@babel/preset-flow": "^7.0.0", 35 | "@babel/register": "^7.5.5", 36 | "babel-eslint": "^10.0.2", 37 | "eslint": "^6.2.0", 38 | "eslint-plugin-flowtype": "^4.2.0", 39 | "eslint-plugin-react": "^7.14.3", 40 | "flow": "^0.2.3", 41 | "flow-bin": "^0.105.2", 42 | "flow-typed": "^2.6.1", 43 | "metro-react-native-babel-preset": "^0.56.0", 44 | "prettier-eslint": "^9.0.0", 45 | "prettier-eslint-cli": "^5.0.0" 46 | }, 47 | "dependencies": { 48 | "moment": "^2.20.1", 49 | "ramda": "^0.26.1", 50 | "react-native-elements": "^1.1.0", 51 | "react-native-modal-selector": "^1.1.1", 52 | "react-native-progress": "^3.6.0", 53 | "react-native-slider": "^0.11.0", 54 | "react-native-typography": "^1.4.1", 55 | "recompose": "^0.30.0", 56 | "uuid": "^3.3.3" 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/components/FormAnswerSwitch.js: -------------------------------------------------------------------------------- 1 | /** 2 | * TODO: Fix wrong switch render pattern 3 | */ 4 | // @flow 5 | import React from 'react' 6 | import { View, Text } from 'react-native' 7 | import types from '../forms/types' 8 | import styles from '../styles' 9 | 10 | const TextComponent = ({ 11 | hint, 12 | value, 13 | translation, 14 | }: { 15 | hint: string, 16 | value: string, 17 | translation?: string => string, 18 | }) => { 19 | return ( 20 | 21 | {`${hint}: ${ 22 | translation ? translation(value) : value 23 | }`} 24 | 25 | ) 26 | } 27 | 28 | const ListComponent = ({ 29 | hint, 30 | value, 31 | }: { 32 | hint: string, 33 | value: Array, 34 | }) => { 35 | const formElements = value.reduce((allElements, val) => { 36 | return [ 37 | ...allElements, 38 | ...Object.keys(val).reduce((array, key) => { 39 | if (key === '_id') return array 40 | return [...array, val[key]] 41 | }, []), 42 | ] 43 | }, []) 44 | return ( 45 | 46 | {hint}: 47 | {formElements.map((element, index) => { 48 | const { value, _id } = element 49 | return ( 50 | 51 | {`${index + 1}) ${value}`} 52 | 53 | ) 54 | })} 55 | 56 | ) 57 | } 58 | 59 | const MultiSelectComponent = ({ 60 | hint, 61 | value, 62 | }: { 63 | hint: string, 64 | value: Array, 65 | }) => { 66 | return ( 67 | 68 | {hint}: 69 | {value.map((element, index) => { 70 | return ( 71 | 72 | {`${index + 1}) ${element}`} 73 | 74 | ) 75 | })} 76 | 77 | ) 78 | } 79 | 80 | const switchComponents = (model: { type: string }) => { 81 | const { type } = model 82 | switch (type) { 83 | case types.string: 84 | return TextComponent 85 | case types.select: 86 | return TextComponent 87 | case types.list: 88 | return ListComponent 89 | case types.multipleSelect: 90 | return MultiSelectComponent 91 | default: 92 | return null 93 | } 94 | } 95 | 96 | const FormAnswerSwitch = (props: { model: string, value: any }) => { 97 | const Component = switchComponents(props.model) 98 | return Component ? ( 99 | 105 | ) : null 106 | } 107 | 108 | export default FormAnswerSwitch 109 | -------------------------------------------------------------------------------- /src/components/FormAnswers.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import React from 'react' 3 | import { View } from 'react-native' 4 | import styles from '../styles' 5 | import FormSwitch from './FormAnswerSwitch' 6 | import { passiveTypes } from '../forms/types' 7 | 8 | type Props = { 9 | value: any, 10 | model: { 11 | fields: any, 12 | }, 13 | } 14 | 15 | class FormAnswers extends React.PureComponent { 16 | _mapKeysToIndexes = (model: any) => { 17 | const { fields } = model 18 | const map = Object.keys(fields).reduce((m, k) => { 19 | const field = fields[k] 20 | if (passiveTypes.find(el => el === field.type)) return m 21 | const { key } = field 22 | return { 23 | ...m, 24 | [key]: k, 25 | } 26 | }, {}) 27 | return map 28 | } 29 | 30 | _stripKeys = value => { 31 | const _strippable = ['_id'] 32 | return Object.keys(value).reduce((object, key) => { 33 | if (_strippable.find(k => k === key)) return object 34 | return { 35 | ...object, 36 | [key]: value[key], 37 | } 38 | }, {}) 39 | } 40 | 41 | render() { 42 | const { value, model } = this.props 43 | const indexesMap = this._mapKeysToIndexes(model) 44 | const actualValue = value ? this._stripKeys(value) : {} 45 | return ( 46 | 47 | {value && 48 | Object.keys(actualValue).map(key => { 49 | const currentValue = value[key] 50 | const currentModel = model.fields[indexesMap[key]] 51 | return ( 52 | 57 | ) 58 | })} 59 | 60 | ) 61 | } 62 | } 63 | 64 | export default FormAnswers 65 | -------------------------------------------------------------------------------- /src/components/FormComponents/ButtonComponent.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import React from 'react' 3 | import { View } from 'react-native' 4 | import { Button } from 'react-native-elements' 5 | import styles from '../../styles' 6 | import FormElementHeader from './FormElementHeader' 7 | import type { ButtonStyle } from '../types/formTypes' 8 | 9 | const ButtonComponent = ({ 10 | buttonHandler, 11 | field: { 12 | content = { 13 | text: '', 14 | }, 15 | options = {}, 16 | actions, 17 | }, 18 | formStyles = {}, 19 | }: { 20 | buttonHandler: any => any, 21 | field: { 22 | content?: any, 23 | options?: { 24 | style?: ButtonStyle 25 | }, 26 | actions: Array<{ 27 | type: string, 28 | payload: any, 29 | }>, 30 | }, 31 | formStyles: any, 32 | }) => ( 33 | 34 | 35 | 41 | {actions.map(action => ( 42 |