├── .babelrc ├── .editorconfig ├── .eslintrc.js ├── .flowconfig ├── .gitattributes ├── .github └── issue_template.md ├── .gitignore ├── .npmignore ├── .watchmanconfig ├── CHANGELOG.md ├── Examples ├── Basic │ ├── .babelrc │ ├── .buckconfig │ ├── .flowconfig │ ├── .gitattributes │ ├── .gitignore │ ├── .watchmanconfig │ ├── App.js │ ├── README.md │ ├── TodayWidget.js │ ├── android │ │ ├── app │ │ │ ├── BUCK │ │ │ ├── build.gradle │ │ │ ├── proguard-rules.pro │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── basic │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ └── MainApplication.java │ │ │ │ └── res │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ └── values │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ ├── keystores │ │ │ ├── BUCK │ │ │ └── debug.keystore.properties │ │ └── settings.gradle │ ├── app.json │ ├── index.js │ ├── index.widget.js │ ├── ios │ │ ├── Basic-tvOS │ │ │ └── Info.plist │ │ ├── Basic-tvOSTests │ │ │ └── Info.plist │ │ ├── Basic.xcodeproj │ │ │ ├── project.pbxproj │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ ├── Basic-tvOS.xcscheme │ │ │ │ └── Basic.xcscheme │ │ ├── Basic │ │ │ ├── AppDelegate.h │ │ │ ├── AppDelegate.m │ │ │ ├── Base.lproj │ │ │ │ └── LaunchScreen.xib │ │ │ ├── Images.xcassets │ │ │ │ ├── AppIcon.appiconset │ │ │ │ │ └── Contents.json │ │ │ │ └── Contents.json │ │ │ ├── Info.plist │ │ │ └── main.m │ │ └── BasicTests │ │ │ ├── BasicTests.m │ │ │ └── Info.plist │ ├── package.json │ ├── screenshot.png │ └── yarn.lock ├── Complex │ ├── .babelrc │ ├── .buckconfig │ ├── .eslintrc │ ├── .flowconfig │ ├── .gitattributes │ ├── .gitignore │ ├── .watchmanconfig │ ├── App.js │ ├── README.md │ ├── TodayWidget.js │ ├── android │ │ ├── app │ │ │ ├── BUCK │ │ │ ├── build.gradle │ │ │ ├── proguard-rules.pro │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── hoppygowidget │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ └── MainApplication.java │ │ │ │ └── res │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ └── values │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ ├── keystores │ │ │ ├── BUCK │ │ │ └── debug.keystore.properties │ │ └── settings.gradle │ ├── app.json │ ├── assets │ │ ├── linking-fetch_blob-library.png │ │ ├── linking-fetch_blob-search_path.png │ │ ├── screenshot1.png │ │ ├── screenshot2.png │ │ └── screenshot3.png │ ├── components │ │ ├── Car.js │ │ ├── CarsNearby.js │ │ ├── LinkToMainApp.js │ │ ├── __tests__ │ │ │ ├── Car.spec.js │ │ │ ├── CarsNearby.spec.js │ │ │ └── __snapshots__ │ │ │ │ ├── Car.spec.js.snap │ │ │ │ └── CarsNearby.spec.js.snap │ │ ├── withDate.js │ │ └── withLocation.js │ ├── config │ │ ├── api.js │ │ ├── geolocation.js │ │ └── index.js │ ├── index.js │ ├── ios │ │ ├── HoppyGoWidget-tvOS │ │ │ └── Info.plist │ │ ├── HoppyGoWidget-tvOSTests │ │ │ └── Info.plist │ │ ├── HoppyGoWidget.xcodeproj │ │ │ ├── project.pbxproj │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ ├── HoppyGoWidget-tvOS.xcscheme │ │ │ │ └── HoppyGoWidget.xcscheme │ │ ├── HoppyGoWidget │ │ │ ├── AppDelegate.h │ │ │ ├── AppDelegate.m │ │ │ ├── Base.lproj │ │ │ │ └── LaunchScreen.xib │ │ │ ├── Images-2.xcassets │ │ │ │ └── LaunchImage.launchimage │ │ │ │ │ └── Contents.json │ │ │ ├── Images.xcassets │ │ │ │ ├── AppIcon-1.appiconset │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ │ ├── Icon-App-57x57@1x.png │ │ │ │ │ ├── Icon-App-57x57@2x.png │ │ │ │ │ ├── Icon-App-60x60@1x.png │ │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ │ ├── Icon-App-72x72@1x.png │ │ │ │ │ ├── Icon-App-72x72@2x.png │ │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ │ ├── Icon-App-76x76@3x.png │ │ │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ │ │ ├── Icon-Small-50x50@1x.png │ │ │ │ │ ├── Icon-Small-50x50@2x.png │ │ │ │ │ └── ItunesArtwork@2x.png │ │ │ │ └── Contents.json │ │ │ ├── Info.plist │ │ │ └── main.m │ │ └── HoppyGoWidgetTests │ │ │ ├── HoppyGoWidgetTests.m │ │ │ └── Info.plist │ ├── lib │ │ ├── date.js │ │ ├── date.spec.js │ │ ├── fetchBlob.js │ │ ├── openInApp.js │ │ ├── price.js │ │ └── price.spec.js │ ├── package.json │ └── yarn.lock └── Expandable │ ├── .babelrc │ ├── .buckconfig │ ├── .flowconfig │ ├── .gitattributes │ ├── .gitignore │ ├── .watchmanconfig │ ├── README.md │ ├── __tests__ │ ├── index.android.js │ └── index.ios.js │ ├── android │ ├── app │ │ ├── BUCK │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── expandable │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── keystores │ │ ├── BUCK │ │ └── debug.keystore.properties │ └── settings.gradle │ ├── app.json │ ├── index.js │ ├── index.widget.js │ ├── ios │ ├── Expandable-tvOS │ │ └── Info.plist │ ├── Expandable-tvOSTests │ │ └── Info.plist │ ├── Expandable.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── Expandable-tvOS.xcscheme │ │ │ └── Expandable.xcscheme │ ├── Expandable │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ └── ExpandableTests │ │ ├── ExpandableTests.m │ │ └── Info.plist │ ├── package.json │ ├── screenshots │ ├── collapsed.png │ └── expanded.png │ └── yarn.lock ├── README.md ├── UNLICENSE ├── __tests__ ├── index.android.js └── index.ios.js ├── app.json ├── bin ├── embedExtension.rb └── setBundleId.rb ├── flow-typed └── npm │ ├── babel-eslint_vx.x.x.js │ ├── babel-jest_vx.x.x.js │ ├── babel-preset-react-native_vx.x.x.js │ ├── eslint-config-airbnb_vx.x.x.js │ ├── eslint-plugin-import_vx.x.x.js │ ├── eslint-plugin-jsx-a11y_vx.x.x.js │ ├── eslint-plugin-react-native_vx.x.x.js │ ├── eslint-plugin-react_vx.x.x.js │ ├── eslint_vx.x.x.js │ ├── flow-bin_v0.x.x.js │ ├── jest_v20.x.x.js │ ├── prettier_vx.x.x.js │ └── react-test-renderer_vx.x.x.js ├── ios ├── RNTodayWidgetExtension.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── TodayWidgetExtension.xcscheme └── TodayWidgetExtension │ ├── DisplayMode.h │ ├── DisplayMode.m │ ├── Info.plist │ ├── Linking.h │ ├── Linking.m │ ├── TodayViewController.h │ └── TodayViewController.m ├── lib ├── DevMenu │ ├── TextButton.js │ └── index.js └── index.js ├── package.json ├── screenshots ├── complex_example.png └── developer_menu.png └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["react-native"] 3 | } 4 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs. 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | 9 | # We recommend you to keep these unchanged. 10 | charset = utf-8 11 | end_of_line = lf 12 | indent_size = 2 13 | indent_style = space 14 | insert_final_newline = true 15 | trim_trailing_whitespace = true 16 | 17 | [package.json] 18 | indent_style = space 19 | indent_size = 2 20 | 21 | [*.md] 22 | trim_trailing_whitespace = false 23 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['airbnb'], 3 | parser: 'babel-eslint', 4 | plugins: [ 5 | 'react', 6 | 'react-native' 7 | ], 8 | rules: { 9 | 'import/no-unresolved': [2, { ignore: ['^react(-native)?$'] }], 10 | 'import/extensions': [2, { js: 'never', json: 'always' }], 11 | 'react/jsx-filename-extension': 0, 12 | }, 13 | }; 14 | -------------------------------------------------------------------------------- /.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 | .*/Libraries/react-native/React.js 15 | .*/Libraries/react-native/ReactNative.js 16 | 17 | ; Ignore "Examples", check them separately 18 | /Examples/ 19 | 20 | [include] 21 | 22 | [libs] 23 | node_modules/react-native/Libraries/react-native/react-native-interface.js 24 | node_modules/react-native/flow 25 | flow/ 26 | 27 | [options] 28 | emoji=true 29 | 30 | module.system=haste 31 | 32 | experimental.strict_type_args=true 33 | 34 | munge_underscores=true 35 | 36 | 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' 37 | 38 | suppress_type=$FlowIssue 39 | suppress_type=$FlowFixMe 40 | suppress_type=$FixMe 41 | 42 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-2]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 43 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-2]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 44 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 45 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 46 | 47 | unsafe.enable_getters_and_setters=true 48 | 49 | [version] 50 | ^0.42.0 51 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | ### Description 2 | Please describe expected and actual behavior. 3 | 4 | ### Steps to reproduce 5 | 6 | ### System configuration 7 | Please add result of `react-native info` command and `react-native-today-widget` version used 8 | -------------------------------------------------------------------------------- /.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://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 50 | 51 | fastlane/report.xml 52 | fastlane/Preview.html 53 | fastlane/screenshots 54 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | Examples 2 | node_modules 3 | .babelrc 4 | .editorconfig 5 | .flowconfig 6 | .gitignore 7 | **/__mocks__/** 8 | **/__tests__/** 9 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [1.0.0] - 2018-06-03 4 | ### Breaking changes 5 | - Widget has to be registred from `index.widget.js` file instead of `index.js`. [#19](https://github.com/matejkriz/react-native-today-widget/pull/19/files) [MaxToyberman](https://github.com/MaxToyberman) 6 | 7 | 8 | 9 | ## [0.10.1] - 2017-12-28 -------------------------------------------------------------------------------- /Examples/Basic/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["react-native"] 3 | } 4 | -------------------------------------------------------------------------------- /Examples/Basic/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /Examples/Basic/.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 | .*/Libraries/react-native/React.js 15 | 16 | ; Ignore polyfills 17 | .*/Libraries/polyfills/.* 18 | 19 | ; Ignore metro 20 | .*/node_modules/metro/.* 21 | 22 | [include] 23 | 24 | [libs] 25 | node_modules/react-native/Libraries/react-native/react-native-interface.js 26 | node_modules/react-native/flow/ 27 | node_modules/react-native/flow-github/ 28 | 29 | [options] 30 | emoji=true 31 | 32 | module.system=haste 33 | 34 | munge_underscores=true 35 | 36 | 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' 37 | 38 | module.file_ext=.js 39 | module.file_ext=.jsx 40 | module.file_ext=.json 41 | module.file_ext=.native.js 42 | 43 | suppress_type=$FlowIssue 44 | suppress_type=$FlowFixMe 45 | suppress_type=$FlowFixMeProps 46 | suppress_type=$FlowFixMeState 47 | 48 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 49 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 50 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 51 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 52 | 53 | [version] 54 | ^0.67.0 55 | -------------------------------------------------------------------------------- /Examples/Basic/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /Examples/Basic/.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 | -------------------------------------------------------------------------------- /Examples/Basic/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Examples/Basic/App.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import React, { Component } from 'react'; 8 | import { 9 | Platform, 10 | StyleSheet, 11 | Text, 12 | View 13 | } from 'react-native'; 14 | 15 | const instructions = Platform.select({ 16 | ios: 'Press Cmd+R to reload,\n' + 17 | 'Cmd+D or shake for dev menu', 18 | android: 'Double tap R on your keyboard to reload,\n' + 19 | 'Shake or press menu button for dev menu', 20 | }); 21 | 22 | type Props = {}; 23 | export default class App extends Component { 24 | render() { 25 | return ( 26 | 27 | 28 | Welcome to React Native! 29 | 30 | 31 | To get started, edit App.js 32 | 33 | 34 | {instructions} 35 | 36 | 37 | ); 38 | } 39 | } 40 | 41 | const styles = StyleSheet.create({ 42 | container: { 43 | flex: 1, 44 | justifyContent: 'center', 45 | alignItems: 'center', 46 | backgroundColor: '#F5FCFF', 47 | }, 48 | welcome: { 49 | fontSize: 20, 50 | textAlign: 'center', 51 | margin: 10, 52 | }, 53 | instructions: { 54 | textAlign: 'center', 55 | color: '#333333', 56 | marginBottom: 5, 57 | }, 58 | }); 59 | -------------------------------------------------------------------------------- /Examples/Basic/README.md: -------------------------------------------------------------------------------- 1 | # Basic example of Today widget using RN 2 | 3 | Created by `react-native init Basic` command followed by `yarn add react-native-today-widget` and `react-native link`. 4 | 5 | React Native version: `0.55.4` 6 | 7 | No changes in generated files, only added [index.widget.js](./index.widget.js) and [TodayWidget.js](./TodayWidget.js). 8 | 9 | ![screenshot](./screenshot.png) 10 | -------------------------------------------------------------------------------- /Examples/Basic/TodayWidget.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet, Text, View } from 'react-native'; 3 | import { DevMenu } from 'react-native-today-widget'; 4 | 5 | const styles = StyleSheet.create({ 6 | container: { 7 | flex: 1, 8 | justifyContent: 'center', 9 | alignItems: 'center', 10 | }, 11 | welcome: { 12 | fontSize: 20, 13 | textAlign: 'center', 14 | margin: 10, 15 | }, 16 | widget: { 17 | flex: 1, 18 | justifyContent: 'center', 19 | alignItems: 'center', 20 | }, 21 | }); 22 | 23 | const TodayWidget = () => ( 24 | 25 | 28 | 29 | Hello basic world! 30 | 31 | 32 | {__DEV__ && } 33 | 34 | ); 35 | 36 | export default TodayWidget; 37 | -------------------------------------------------------------------------------- /Examples/Basic/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 | lib_deps = [] 12 | 13 | for jarfile in glob(['libs/*.jar']): 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 | 21 | for aarfile in glob(['libs/*.aar']): 22 | name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')] 23 | lib_deps.append(':' + name) 24 | android_prebuilt_aar( 25 | name = name, 26 | aar = aarfile, 27 | ) 28 | 29 | android_library( 30 | name = "all-libs", 31 | exported_deps = lib_deps, 32 | ) 33 | 34 | android_library( 35 | name = "app-code", 36 | srcs = glob([ 37 | "src/main/java/**/*.java", 38 | ]), 39 | deps = [ 40 | ":all-libs", 41 | ":build_config", 42 | ":res", 43 | ], 44 | ) 45 | 46 | android_build_config( 47 | name = "build_config", 48 | package = "com.basic", 49 | ) 50 | 51 | android_resource( 52 | name = "res", 53 | package = "com.basic", 54 | res = "src/main/res", 55 | ) 56 | 57 | android_binary( 58 | name = "app", 59 | keystore = "//android/keystores:debug", 60 | manifest = "src/main/AndroidManifest.xml", 61 | package_type = "debug", 62 | deps = [ 63 | ":app-code", 64 | ], 65 | ) 66 | -------------------------------------------------------------------------------- /Examples/Basic/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 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Disabling obfuscation is useful if you collect stack traces from production crashes 20 | # (unless you are using a system that supports de-obfuscate the stack traces). 21 | -dontobfuscate 22 | 23 | # React Native 24 | 25 | # Keep our interfaces so they can be used by other ProGuard rules. 26 | # See http://sourceforge.net/p/proguard/bugs/466/ 27 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip 28 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters 29 | -keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip 30 | 31 | # Do not strip any method/class that is annotated with @DoNotStrip 32 | -keep @com.facebook.proguard.annotations.DoNotStrip class * 33 | -keep @com.facebook.common.internal.DoNotStrip class * 34 | -keepclassmembers class * { 35 | @com.facebook.proguard.annotations.DoNotStrip *; 36 | @com.facebook.common.internal.DoNotStrip *; 37 | } 38 | 39 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { 40 | void set*(***); 41 | *** get*(); 42 | } 43 | 44 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } 45 | -keep class * extends com.facebook.react.bridge.NativeModule { *; } 46 | -keepclassmembers,includedescriptorclasses class * { native ; } 47 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } 48 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } 49 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } 50 | 51 | -dontwarn com.facebook.react.** 52 | 53 | # TextLayoutBuilder uses a non-public Android constructor within StaticLayout. 54 | # See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details. 55 | -dontwarn android.text.StaticLayout 56 | 57 | # okhttp 58 | 59 | -keepattributes Signature 60 | -keepattributes *Annotation* 61 | -keep class okhttp3.** { *; } 62 | -keep interface okhttp3.** { *; } 63 | -dontwarn okhttp3.** 64 | 65 | # okio 66 | 67 | -keep class sun.misc.Unsafe { *; } 68 | -dontwarn java.nio.file.* 69 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 70 | -dontwarn okio.** 71 | -------------------------------------------------------------------------------- /Examples/Basic/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 13 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Examples/Basic/android/app/src/main/java/com/basic/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.basic; 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 "Basic"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Examples/Basic/android/app/src/main/java/com/basic/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.basic; 2 | 3 | import android.app.Application; 4 | 5 | import com.facebook.react.ReactApplication; 6 | import com.facebook.react.ReactNativeHost; 7 | import com.facebook.react.ReactPackage; 8 | import com.facebook.react.shell.MainReactPackage; 9 | import com.facebook.soloader.SoLoader; 10 | 11 | import java.util.Arrays; 12 | import java.util.List; 13 | 14 | public class MainApplication extends Application implements ReactApplication { 15 | 16 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 17 | @Override 18 | public boolean getUseDeveloperSupport() { 19 | return BuildConfig.DEBUG; 20 | } 21 | 22 | @Override 23 | protected List getPackages() { 24 | return Arrays.asList( 25 | new MainReactPackage() 26 | ); 27 | } 28 | 29 | @Override 30 | protected String getJSMainModuleName() { 31 | return "index"; 32 | } 33 | }; 34 | 35 | @Override 36 | public ReactNativeHost getReactNativeHost() { 37 | return mReactNativeHost; 38 | } 39 | 40 | @Override 41 | public void onCreate() { 42 | super.onCreate(); 43 | SoLoader.init(this, /* native exopackage */ false); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Examples/Basic/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Basic/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /Examples/Basic/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Basic/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /Examples/Basic/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Basic/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Examples/Basic/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Basic/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Examples/Basic/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Basic 3 | 4 | -------------------------------------------------------------------------------- /Examples/Basic/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Examples/Basic/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.2.3' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | mavenLocal() 18 | jcenter() 19 | maven { 20 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 21 | url "$rootDir/../node_modules/react-native/android" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Examples/Basic/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.useDeprecatedNdk=true 21 | -------------------------------------------------------------------------------- /Examples/Basic/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Basic/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Examples/Basic/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 6 | -------------------------------------------------------------------------------- /Examples/Basic/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /Examples/Basic/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /Examples/Basic/android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /Examples/Basic/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'Basic' 2 | 3 | include ':app' 4 | -------------------------------------------------------------------------------- /Examples/Basic/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Basic", 3 | "displayName": "Basic" 4 | } -------------------------------------------------------------------------------- /Examples/Basic/index.js: -------------------------------------------------------------------------------- 1 | import { AppRegistry } from 'react-native'; 2 | import App from './App'; 3 | 4 | AppRegistry.registerComponent('Basic', () => App); 5 | -------------------------------------------------------------------------------- /Examples/Basic/index.widget.js: -------------------------------------------------------------------------------- 1 | import { AppRegistry } from "react-native"; 2 | import TodayWidget from "./TodayWidget"; 3 | 4 | AppRegistry.registerComponent("TodayWidgetExtension", () => TodayWidget); 5 | -------------------------------------------------------------------------------- /Examples/Basic/ios/Basic-tvOS/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 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Examples/Basic/ios/Basic-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 | -------------------------------------------------------------------------------- /Examples/Basic/ios/Basic.xcodeproj/xcshareddata/xcschemes/Basic.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 | -------------------------------------------------------------------------------- /Examples/Basic/ios/Basic/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 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 | @interface AppDelegate : UIResponder 11 | 12 | @property (nonatomic, strong) UIWindow *window; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Examples/Basic/ios/Basic/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 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 | 13 | @implementation AppDelegate 14 | 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 16 | { 17 | NSURL *jsCodeLocation; 18 | 19 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 20 | 21 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 22 | moduleName:@"Basic" 23 | initialProperties:nil 24 | launchOptions:launchOptions]; 25 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 26 | 27 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 28 | UIViewController *rootViewController = [UIViewController new]; 29 | rootViewController.view = rootView; 30 | self.window.rootViewController = rootViewController; 31 | [self.window makeKeyAndVisible]; 32 | return YES; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Examples/Basic/ios/Basic/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 | -------------------------------------------------------------------------------- /Examples/Basic/ios/Basic/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 | } -------------------------------------------------------------------------------- /Examples/Basic/ios/Basic/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Examples/Basic/ios/Basic/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | Basic 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 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 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UIViewControllerBasedStatusBarAppearance 40 | 41 | NSLocationWhenInUseUsageDescription 42 | 43 | NSAppTransportSecurity 44 | 45 | 46 | NSExceptionDomains 47 | 48 | localhost 49 | 50 | NSExceptionAllowsInsecureHTTPLoads 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /Examples/Basic/ios/Basic/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 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 | -------------------------------------------------------------------------------- /Examples/Basic/ios/BasicTests/BasicTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 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 BasicTests : XCTestCase 18 | 19 | @end 20 | 21 | @implementation BasicTests 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 | -------------------------------------------------------------------------------- /Examples/Basic/ios/BasicTests/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 | -------------------------------------------------------------------------------- /Examples/Basic/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Basic", 3 | "version": "1.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-native/local-cli/cli.js start", 7 | "test": "jest" 8 | }, 9 | "dependencies": { 10 | "react": "16.3.1", 11 | "react-native": "0.55.4", 12 | "react-native-today-widget": "^1.0.0" 13 | }, 14 | "devDependencies": { 15 | "babel-jest": "23.0.1", 16 | "babel-preset-react-native": "4.0.0", 17 | "jest": "23.1.0", 18 | "react-test-renderer": "16.3.1" 19 | }, 20 | "jest": { 21 | "preset": "react-native" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Examples/Basic/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Basic/screenshot.png -------------------------------------------------------------------------------- /Examples/Complex/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["flow", "react-native"], 3 | "plugins": ["transform-flow-strip-types"] 4 | } 5 | -------------------------------------------------------------------------------- /Examples/Complex/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /Examples/Complex/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "plugins": [ 4 | "flowtype", 5 | "fp", 6 | "prettier" 7 | ], 8 | "extends": [ 9 | "airbnb", 10 | "plugin:flowtype/recommended", 11 | "prettier", 12 | "prettier/react" 13 | ], 14 | "env": { 15 | "browser": true, 16 | "jest": true, 17 | "mocha": true 18 | }, 19 | "globals": { 20 | "__DEV__": true 21 | }, 22 | "rules": { 23 | // Soft some rules. 24 | "arrow-parens": 0, // Does not work with Flow generic types. 25 | "global-require": 0, // Used by webpack-isomorphic-tools and React Native. 26 | "import/first": 0, // Este sorts by atom/sort-lines natural order. 27 | "import/no-duplicates": 2, 28 | "import/prefer-default-export": 0, // No. Actions can have just one action. 29 | "jsx-a11y/html-has-lang": 0, // Can't recognize the Helmet. 30 | "jsx-a11y/href-no-hash": "off", 31 | "no-class-assign": 0, // Class assign is used for higher order components. 32 | "no-confusing-arrow": 0, // This rule is super confusing. 33 | "no-duplicate-imports": 0, // github.com/babel/eslint-plugin-babel/issues/59#issuecomment-230118848 34 | "no-nested-ternary": 0, // It's nice for JSX. 35 | "no-param-reassign": 0, // We love param reassignment. Naming is hard. 36 | "no-shadow": 0, // Shadowing is a nice language feature. Naming is hard. 37 | "no-use-before-define": 0, // styles on the bottom of the file 38 | "react/require-default-props": 0, // Checked by flowtype. 39 | "react/forbid-prop-types": 0, // Este is going to use Flow types. 40 | "react/jsx-filename-extension": 0, // No, JSX belongs to .js files 41 | "react/jsx-indent": 0, // Damn. We need Yarn asap. 42 | "react/no-unused-prop-types": 0, // Este is going to use Flow types. 43 | "react/prop-types": 0, // Can't detect flowtype correctly. 44 | "sort-keys": 2, 45 | // Rules for functional programming. We do not need Object.freeze. 46 | "fp/no-mutating-assign": 2, 47 | "array-callback-return": 0, 48 | "prettier/prettier": [ 49 | "error", 50 | { 51 | "bracketSpacing": true, 52 | "printWidth": 80, 53 | "singleQuote": true, 54 | "tabWidth": 2, 55 | "trailingComma": "all" 56 | } 57 | ] 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Examples/Complex/.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 | .*/Libraries/react-native/React.js 15 | 16 | ; Ignore polyfills 17 | .*/Libraries/polyfills/.* 18 | 19 | [include] 20 | 21 | [libs] 22 | node_modules/react-native/Libraries/react-native/react-native-interface.js 23 | node_modules/react-native/flow/ 24 | 25 | [options] 26 | emoji=true 27 | 28 | module.system=haste 29 | 30 | munge_underscores=true 31 | 32 | 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' 33 | 34 | suppress_type=$FlowIssue 35 | suppress_type=$FlowFixMe 36 | suppress_type=$FlowFixMeProps 37 | suppress_type=$FlowFixMeState 38 | suppress_type=$FixMe 39 | 40 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 41 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 42 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 43 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 44 | 45 | unsafe.enable_getters_and_setters=true 46 | 47 | [version] 48 | ^0.56.0 49 | -------------------------------------------------------------------------------- /Examples/Complex/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /Examples/Complex/.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 | -------------------------------------------------------------------------------- /Examples/Complex/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Examples/Complex/App.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import React from 'react'; 8 | import { Platform, StyleSheet, Text, View } from 'react-native'; 9 | 10 | const instructions = Platform.select({ 11 | android: 12 | 'Double tap R on your keyboard to reload,\n' + 13 | 'Shake or press menu button for dev menu', 14 | ios: `Press Cmd+R to reload,\nCmd+D or shake for dev menu`, 15 | }); 16 | 17 | const App = () => ( 18 | 19 | Welcome to React Native! 20 | To get started, edit App.js 21 | {instructions} 22 | 23 | ); 24 | 25 | const styles = StyleSheet.create({ 26 | container: { 27 | alignItems: 'center', 28 | backgroundColor: '#F5FCFF', 29 | flex: 1, 30 | justifyContent: 'center', 31 | }, 32 | instructions: { 33 | color: '#333333', 34 | marginBottom: 5, 35 | textAlign: 'center', 36 | }, 37 | welcome: { 38 | fontSize: 20, 39 | margin: 10, 40 | textAlign: 'center', 41 | }, 42 | }); 43 | 44 | export default App; 45 | -------------------------------------------------------------------------------- /Examples/Complex/README.md: -------------------------------------------------------------------------------- 1 | ## Steps to run: 2 | 3 | 1. `git clone https://github.com/matejkriz/react-native-today-widget.git` 4 | 5 | 2. `cd react-native-today-widget/Examples/Complex/` 6 | 7 | 3. `yarn` 8 | 9 | 4. `open ios/HoppyGoWidget.xcodeproj/` 10 | 11 | Manually link `native-fetch-blob` to 12 | `./node_modules/react-native-today-widget/ios/RNTodayWidgetExtension.xcodeproj`: 13 | 14 | 1. Add `libRNFetchBlob.a` to Linked Frameworks and Libraries: 15 | ![link_library](./assets/linking-fetch_blob-library.png) 16 | 17 | 2. Add `$(SRCROOT)/../node_modules/react-native-fetch-blob/ios` to Header 18 | Search Paths as `recursive`: 19 | ![add-search_path](./assets/linking-fetch_blob-search_path.png) 20 | 21 | 5. `react-native run-ios` 22 | 23 | ## Screenshots: 24 | 25 | On lock screen, Debug mode, simulator iPhone 8, iOS 11.2: 26 | ![screenshot1](./assets/screenshot1.png) 27 | 28 | On force touch, Debug mode, simulatoriPhone 8, iOS 11.2: 29 | ![screenshot2](./assets/screenshot2.png) 30 | 31 | On lock screen, Release mode, real device - iPhone 5s, iOS 11.2 32 | ![screenshot3](./assets/screenshot3.png) 33 | -------------------------------------------------------------------------------- /Examples/Complex/TodayWidget.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import React from 'react'; 3 | import { StyleSheet, View } from 'react-native'; 4 | import { DevMenu, setExpandable } from 'react-native-today-widget'; 5 | import config from './config'; 6 | import CarsNearby from './components/CarsNearby'; 7 | 8 | const isExpandable = true; 9 | const maxHeight = config.rowHeight * (config.maxCountOfCars + 1); 10 | setExpandable(isExpandable, maxHeight); 11 | 12 | const TodayWidget = () => ( 13 | 14 | 15 | {__DEV__ && 16 | /* Has to be a last element to be clickable, 17 | because it has absolute position */ 18 | } 19 | 20 | ); 21 | 22 | const styles = StyleSheet.create({ 23 | container: { 24 | flex: 1, 25 | }, 26 | }); 27 | 28 | export default TodayWidget; 29 | -------------------------------------------------------------------------------- /Examples/Complex/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 | lib_deps = [] 12 | 13 | for jarfile in glob(['libs/*.jar']): 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 | 21 | for aarfile in glob(['libs/*.aar']): 22 | name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')] 23 | lib_deps.append(':' + name) 24 | android_prebuilt_aar( 25 | name = name, 26 | aar = aarfile, 27 | ) 28 | 29 | android_library( 30 | name = "all-libs", 31 | exported_deps = lib_deps, 32 | ) 33 | 34 | android_library( 35 | name = "app-code", 36 | srcs = glob([ 37 | "src/main/java/**/*.java", 38 | ]), 39 | deps = [ 40 | ":all-libs", 41 | ":build_config", 42 | ":res", 43 | ], 44 | ) 45 | 46 | android_build_config( 47 | name = "build_config", 48 | package = "com.hoppygowidget", 49 | ) 50 | 51 | android_resource( 52 | name = "res", 53 | package = "com.hoppygowidget", 54 | res = "src/main/res", 55 | ) 56 | 57 | android_binary( 58 | name = "app", 59 | keystore = "//android/keystores:debug", 60 | manifest = "src/main/AndroidManifest.xml", 61 | package_type = "debug", 62 | deps = [ 63 | ":app-code", 64 | ], 65 | ) 66 | -------------------------------------------------------------------------------- /Examples/Complex/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 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Disabling obfuscation is useful if you collect stack traces from production crashes 20 | # (unless you are using a system that supports de-obfuscate the stack traces). 21 | -dontobfuscate 22 | 23 | # React Native 24 | 25 | # Keep our interfaces so they can be used by other ProGuard rules. 26 | # See http://sourceforge.net/p/proguard/bugs/466/ 27 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip 28 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters 29 | -keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip 30 | 31 | # Do not strip any method/class that is annotated with @DoNotStrip 32 | -keep @com.facebook.proguard.annotations.DoNotStrip class * 33 | -keep @com.facebook.common.internal.DoNotStrip class * 34 | -keepclassmembers class * { 35 | @com.facebook.proguard.annotations.DoNotStrip *; 36 | @com.facebook.common.internal.DoNotStrip *; 37 | } 38 | 39 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { 40 | void set*(***); 41 | *** get*(); 42 | } 43 | 44 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } 45 | -keep class * extends com.facebook.react.bridge.NativeModule { *; } 46 | -keepclassmembers,includedescriptorclasses class * { native ; } 47 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } 48 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } 49 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } 50 | 51 | -dontwarn com.facebook.react.** 52 | 53 | # TextLayoutBuilder uses a non-public Android constructor within StaticLayout. 54 | # See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details. 55 | -dontwarn android.text.StaticLayout 56 | 57 | # okhttp 58 | 59 | -keepattributes Signature 60 | -keepattributes *Annotation* 61 | -keep class okhttp3.** { *; } 62 | -keep interface okhttp3.** { *; } 63 | -dontwarn okhttp3.** 64 | 65 | # okio 66 | 67 | -keep class sun.misc.Unsafe { *; } 68 | -dontwarn java.nio.file.* 69 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 70 | -dontwarn okio.** 71 | -------------------------------------------------------------------------------- /Examples/Complex/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 19 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Examples/Complex/android/app/src/main/java/com/hoppygowidget/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.hoppygowidget; 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 "HoppyGoWidget"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Examples/Complex/android/app/src/main/java/com/hoppygowidget/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.hoppygowidget; 2 | 3 | import android.app.Application; 4 | 5 | import com.facebook.react.ReactApplication; 6 | import com.RNFetchBlob.RNFetchBlobPackage; 7 | import com.facebook.react.ReactNativeHost; 8 | import com.facebook.react.ReactPackage; 9 | import com.facebook.react.shell.MainReactPackage; 10 | import com.facebook.soloader.SoLoader; 11 | 12 | import java.util.Arrays; 13 | import java.util.List; 14 | 15 | public class MainApplication extends Application implements ReactApplication { 16 | 17 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 18 | @Override 19 | public boolean getUseDeveloperSupport() { 20 | return BuildConfig.DEBUG; 21 | } 22 | 23 | @Override 24 | protected List getPackages() { 25 | return Arrays.asList( 26 | new MainReactPackage(), 27 | new RNFetchBlobPackage() 28 | ); 29 | } 30 | 31 | @Override 32 | protected String getJSMainModuleName() { 33 | return "index"; 34 | } 35 | }; 36 | 37 | @Override 38 | public ReactNativeHost getReactNativeHost() { 39 | return mReactNativeHost; 40 | } 41 | 42 | @Override 43 | public void onCreate() { 44 | super.onCreate(); 45 | SoLoader.init(this, /* native exopackage */ false); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Examples/Complex/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /Examples/Complex/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /Examples/Complex/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Examples/Complex/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Examples/Complex/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | HoppyGoWidget 3 | 4 | -------------------------------------------------------------------------------- /Examples/Complex/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Examples/Complex/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.2.3' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | mavenLocal() 18 | jcenter() 19 | maven { 20 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 21 | url "$rootDir/../node_modules/react-native/android" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Examples/Complex/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.useDeprecatedNdk=true 21 | -------------------------------------------------------------------------------- /Examples/Complex/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Examples/Complex/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 6 | -------------------------------------------------------------------------------- /Examples/Complex/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /Examples/Complex/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /Examples/Complex/android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /Examples/Complex/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'HoppyGoWidget' 2 | include ':react-native-fetch-blob' 3 | project(':react-native-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fetch-blob/android') 4 | 5 | include ':app' 6 | -------------------------------------------------------------------------------- /Examples/Complex/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HoppyGoWidget", 3 | "displayName": "HoppyGoWidget" 4 | } -------------------------------------------------------------------------------- /Examples/Complex/assets/linking-fetch_blob-library.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/assets/linking-fetch_blob-library.png -------------------------------------------------------------------------------- /Examples/Complex/assets/linking-fetch_blob-search_path.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/assets/linking-fetch_blob-search_path.png -------------------------------------------------------------------------------- /Examples/Complex/assets/screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/assets/screenshot1.png -------------------------------------------------------------------------------- /Examples/Complex/assets/screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/assets/screenshot2.png -------------------------------------------------------------------------------- /Examples/Complex/assets/screenshot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/assets/screenshot3.png -------------------------------------------------------------------------------- /Examples/Complex/components/Car.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import React from 'react'; 3 | import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'; 4 | import config from '../config'; 5 | import { openInApp } from '../lib/openInApp'; 6 | 7 | type CarProps = { 8 | id: number, 9 | manufacturer: string, 10 | model: string, 11 | price: string, 12 | }; 13 | 14 | const Car = ({ id, manufacturer, model, price }: CarProps) => ( 15 | 16 | openInApp({ id: `${config.inappLinks.car}${id}` })} 18 | > 19 | 20 | 21 | {`${manufacturer} ${model}`} 22 | 23 | {price} 24 | 25 | 26 | 27 | ); 28 | 29 | const styles = StyleSheet.create({ 30 | container: { 31 | borderBottomWidth: 1, 32 | borderColor: 'darkgray', 33 | flex: 1, 34 | minHeight: config.rowHeight, 35 | paddingHorizontal: config.paddingHorizontal, 36 | }, 37 | header: { 38 | color: '#2d2d2d', 39 | flex: 3, 40 | fontSize: 16, 41 | }, 42 | price: { 43 | flex: 1, 44 | textAlign: 'right', 45 | }, 46 | viewContainer: { 47 | alignItems: 'center', 48 | flex: 1, 49 | flexDirection: 'row', 50 | justifyContent: 'space-between', 51 | minHeight: config.rowHeight, 52 | }, 53 | }); 54 | 55 | export default Car; 56 | -------------------------------------------------------------------------------- /Examples/Complex/components/CarsNearby.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import React, { Component } from 'react'; 3 | import { ActivityIndicator, StyleSheet, View, Text } from 'react-native'; 4 | import withDate from './withDate'; 5 | import withLocation from './withLocation'; 6 | import api from '../config/api'; 7 | import config from '../config'; 8 | import Car from './Car'; 9 | import LinkToMainApp from './LinkToMainApp'; 10 | import { getTomorrowDateRange } from '../lib/date'; 11 | import { parsePrice } from '../lib/price'; 12 | import { dirs, fetchToFile, loadFromFile } from '../lib/fetchBlob'; 13 | 14 | const carsNearbyPath = `${dirs.CacheDir}${config.cachePath}${ 15 | config.carsNearbyFileName 16 | }`; 17 | 18 | type CarObject = { 19 | id: number, 20 | manufacturer: string, 21 | model: string, 22 | price: string, 23 | }; 24 | 25 | type CarsNearbyState = { 26 | carsNearby: Array, 27 | error: ?string, 28 | isFetching: boolean, 29 | }; 30 | 31 | type CarsNearbyProps = { 32 | date: Date, 33 | latitude: number, 34 | longitude: number, 35 | }; 36 | 37 | type loadNearbyCarsProps = { 38 | dateRange: string, 39 | latitude: number, 40 | longitude: number, 41 | pickUpDistance: number, 42 | }; 43 | 44 | class CarsNearby extends Component { 45 | constructor(props) { 46 | super(props); 47 | 48 | this.state = { 49 | carsNearby: [], 50 | error: null, 51 | isFetching: false, 52 | }; 53 | } 54 | 55 | componentDidMount() { 56 | this.loadNearbyCars(); 57 | } 58 | 59 | componentDidUpdate(prevProps, prevState) { 60 | const { date, latitude, longitude } = this.props; 61 | const { isFetching } = this.state; 62 | if ( 63 | !isFetching && 64 | (latitude !== prevProps.latitude || longitude !== prevProps.longitude) 65 | ) { 66 | this.fetchNearbyCars({ 67 | dateRange: getTomorrowDateRange(date), 68 | latitude, 69 | longitude, 70 | pickUpDistance: api.pickUpDistance, 71 | }); 72 | } else if (prevState.isFetching && !isFetching) { 73 | this.loadNearbyCars(); 74 | } 75 | } 76 | 77 | fetchNearbyCars = async ({ 78 | dateRange, 79 | latitude, 80 | longitude, 81 | pickUpDistance, 82 | }: loadNearbyCarsProps): Promise => { 83 | this.setState({ 84 | isFetching: true, 85 | }); 86 | try { 87 | await fetchToFile({ 88 | headers: api.headers, 89 | path: carsNearbyPath, 90 | requestPath: api.requestPath({ 91 | dateRange, 92 | latitude, 93 | longitude, 94 | pickUpDistance, 95 | }), 96 | }); 97 | this.setState({ 98 | error: null, 99 | isFetching: false, 100 | }); 101 | } catch (error) { 102 | this.setState({ error, isFetching: false }); 103 | } 104 | }; 105 | 106 | loadNearbyCars = async () => { 107 | try { 108 | const carsNearbyBlob = await loadFromFile({ path: carsNearbyPath }); 109 | const carsNearby = this.parseCarsNearbyBlob({ carsNearbyBlob }); 110 | this.setState({ 111 | carsNearby, 112 | error: null, 113 | }); 114 | } catch (error) { 115 | this.setState({ error }); 116 | } 117 | }; 118 | 119 | parseCarsNearbyBlob = ({ carsNearbyBlob }) => { 120 | const carsNearby = JSON.parse(carsNearbyBlob); 121 | const carsNearbyFormatted = carsNearby.reduce( 122 | (carsList, car) => [ 123 | ...carsList, 124 | { 125 | id: car.id, 126 | manufacturer: car.model.manufacturer.name, 127 | model: car.model.name, 128 | price: parsePrice({ price: car.local_total_price.verbose }), 129 | }, 130 | ], 131 | [], 132 | ); 133 | return carsNearbyFormatted; 134 | }; 135 | 136 | render() { 137 | const { carsNearby, error, isFetching } = this.state; 138 | if (error) { 139 | return {error}; 140 | } 141 | if (isFetching && carsNearby && !carsNearby.length) { 142 | return ; 143 | } 144 | return ( 145 | 146 | {carsNearby && 147 | carsNearby.map(({ id, manufacturer, model, price }) => ( 148 | 155 | ))} 156 | 157 | 158 | ); 159 | } 160 | } 161 | 162 | const styles = StyleSheet.create({ 163 | container: { 164 | flex: 1, 165 | }, 166 | }); 167 | 168 | export default withLocation(withDate(CarsNearby)); 169 | -------------------------------------------------------------------------------- /Examples/Complex/components/LinkToMainApp.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import React from 'react'; 3 | import { Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; 4 | import config from '../config'; 5 | import { openInApp } from '../lib/openInApp'; 6 | 7 | const LinkToMainApp = () => ( 8 | 9 | openInApp({})}> 10 | 11 | 17 | 18 | {config.linkToMainApp.title} 19 | 20 | 21 | 22 | 23 | ); 24 | 25 | const styles = StyleSheet.create({ 26 | container: { 27 | flex: 1, 28 | minHeight: config.rowHeight, 29 | paddingHorizontal: config.paddingHorizontal, 30 | }, 31 | image: { 32 | height: 24, 33 | width: 24, 34 | }, 35 | title: { 36 | color: '#505050', 37 | fontSize: 14, 38 | paddingHorizontal: config.paddingHorizontal, 39 | }, 40 | viewContainer: { 41 | alignItems: 'center', 42 | flexDirection: 'row', 43 | justifyContent: 'center', 44 | minHeight: config.rowHeight, 45 | }, 46 | }); 47 | 48 | export default LinkToMainApp; 49 | -------------------------------------------------------------------------------- /Examples/Complex/components/__tests__/Car.spec.js: -------------------------------------------------------------------------------- 1 | import 'react-native'; 2 | import React from 'react'; 3 | import Car from '../Car'; 4 | 5 | // Note: test renderer must be required after react-native. 6 | import renderer from 'react-test-renderer'; 7 | 8 | test('renders correctly', () => { 9 | const tree = renderer 10 | .create( 11 | , 12 | ) 13 | .toJSON(); 14 | expect(tree).toMatchSnapshot(); 15 | }); 16 | -------------------------------------------------------------------------------- /Examples/Complex/components/__tests__/CarsNearby.spec.js: -------------------------------------------------------------------------------- 1 | import 'react-native'; 2 | import React from 'react'; 3 | import CarsNearby from '../CarsNearby'; 4 | 5 | // Note: test renderer must be required after react-native. 6 | import renderer from 'react-test-renderer'; 7 | 8 | /* eslint-disable react/prefer-stateless-function */ 9 | jest.mock('../withDate', () => { 10 | const React = require('react'); 11 | return ComposedComponent => 12 | class extends React.Component { 13 | render() { 14 | return ; 15 | } 16 | }; 17 | }); 18 | /* eslint-disable react/no-multi-comp */ 19 | jest.mock('../withLocation', () => { 20 | const React = require('react'); 21 | return ComposedComponent => 22 | class extends React.Component { 23 | render() { 24 | return ; 25 | } 26 | }; 27 | }); 28 | 29 | jest.mock('../../lib/fetchBlob', () => ({ 30 | dirs: { cacheDir: 'cache/dir/' }, 31 | fetchToFile: () => Promise.resolve('resolved'), 32 | loadFromFile: () => mockCarsNearbyBlob, 33 | })); 34 | 35 | test('renders correctly', async () => { 36 | const component = await renderer.create( 37 | , 38 | ); 39 | const tree = component.toJSON(); 40 | expect(tree).toMatchSnapshot(); 41 | }); 42 | 43 | const mockCarsNearbyBlob = `[ 44 | { 45 | "id": 685, 46 | "model": { 47 | "name": "Octavia Combi 2.0 TDI", 48 | "manufacturer": { 49 | "name": "Škoda" 50 | } 51 | }, 52 | "local_total_price": { 53 | "amount": "993.00", 54 | "currency": "CZK", 55 | "verbose": "993.00 Kč" 56 | } 57 | }, 58 | { 59 | "id": 617, 60 | "model": { 61 | "name": "Cee'd 1.6 CRDi 90", 62 | "manufacturer": { 63 | "name": "Kia" 64 | } 65 | }, 66 | "local_total_price": { 67 | "amount": "993.00", 68 | "currency": "CZK", 69 | "verbose": "993.00 Kč" 70 | } 71 | }, 72 | { 73 | "id": 562, 74 | "model": { 75 | "name": "CLK Coupe 320 CDI", 76 | "manufacturer": { 77 | "name": "Mercedes" 78 | } 79 | }, 80 | "local_total_price": { 81 | "amount": "999.00", 82 | "currency": "CZK", 83 | "verbose": "999.00 Kč" 84 | } 85 | }, 86 | { 87 | "id": 544, 88 | "model": { 89 | "name": "330d Cabrio", 90 | "manufacturer": { 91 | "name": "BMW" 92 | } 93 | }, 94 | "local_total_price": { 95 | "amount": "1536.00", 96 | "currency": "CZK", 97 | "verbose": "1,536.00 Kč" 98 | } 99 | } 100 | ]`; 101 | -------------------------------------------------------------------------------- /Examples/Complex/components/__tests__/__snapshots__/Car.spec.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`renders correctly 1`] = ` 4 | 15 | 39 | 50 | 63 | manufacturer model 64 | 65 | 83 | 1 042 Kč 84 | 85 | 86 | 87 | 88 | `; 89 | -------------------------------------------------------------------------------- /Examples/Complex/components/withDate.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | /* eslint-disable react/prefer-stateless-function */ 3 | import React, { Component } from 'react'; 4 | import type { ComponentType } from 'react'; 5 | 6 | type CurrentDateState = {}; 7 | 8 | type CurrentDateProps = any; 9 | 10 | const CurrentDate = (ComposedComponent: ComponentType) => 11 | class extends Component { 12 | render() { 13 | return ; 14 | } 15 | }; 16 | 17 | export default CurrentDate; 18 | -------------------------------------------------------------------------------- /Examples/Complex/components/withLocation.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import React, { Component } from 'react'; 3 | import type { ComponentType } from 'react'; 4 | import watchPositionOptions from '../config/geolocation'; 5 | 6 | type GeolocationState = { 7 | error: ?string, 8 | latitude: ?number, 9 | longitude: ?number, 10 | }; 11 | 12 | type GeolocationProps = any; 13 | 14 | const Geolocation = (ComposedComponent: ComponentType) => 15 | class extends Component { 16 | constructor(props: GeolocationProps) { 17 | super(props); 18 | 19 | this.state = { 20 | error: null, 21 | latitude: null, 22 | longitude: null, 23 | }; 24 | } 25 | 26 | componentDidMount() { 27 | if ('geolocation' in navigator) { 28 | this.geolocation = navigator.geolocation.watchPosition( 29 | position => { 30 | this.setState({ 31 | error: null, 32 | latitude: position.coords.latitude, 33 | longitude: position.coords.longitude, 34 | }); 35 | }, 36 | error => this.setState({ error: error.message }), 37 | watchPositionOptions, 38 | ); 39 | } 40 | } 41 | 42 | componentWillUnmount() { 43 | if ('geolocation' in navigator) { 44 | navigator.geolocation.clearWatch(this.geolocation); 45 | } 46 | } 47 | 48 | geolocation: any; 49 | 50 | render() { 51 | const { error, latitude, longitude } = this.state; 52 | 53 | if (error) { 54 | return null; 55 | } 56 | 57 | return ( 58 | 63 | ); 64 | } 65 | }; 66 | 67 | export default Geolocation; 68 | -------------------------------------------------------------------------------- /Examples/Complex/config/api.js: -------------------------------------------------------------------------------- 1 | import config from '../config'; 2 | 3 | const api = { 4 | headers: { 5 | 'Content-Type': 'application/json', 6 | 'X-Base': config.maxCountOfCars.toString(), 7 | 'X-Fields': 'id, model__name, model__manufacturer__name, local_total_price', 8 | }, 9 | path: 'https://client.hoppycar.com/api/car/browser/', 10 | pickUpDistance: 5000, 11 | requestPath: ({ dateRange, latitude, longitude, pickUpDistance }) => 12 | `${api.path}?available__between=${dateRange}&pick_up_distance=${latitude},${ 13 | longitude 14 | },${pickUpDistance}`, 15 | }; 16 | 17 | export default api; 18 | -------------------------------------------------------------------------------- /Examples/Complex/config/geolocation.js: -------------------------------------------------------------------------------- 1 | const watchPositionOptions = { 2 | distanceFilter: 100, // meters 3 | enableHighAccuracy: false, 4 | maximumAge: 3600000, // 1 hour 5 | timeout: 30000, // 30 seconds 6 | }; 7 | 8 | export default watchPositionOptions; 9 | -------------------------------------------------------------------------------- /Examples/Complex/config/index.js: -------------------------------------------------------------------------------- 1 | const config = { 2 | cachePath: '/cz.matejkriz.HoppyGoWidget.TodayWidgetExtension/', 3 | carsNearbyFileName: 'carsNearby.json', 4 | inappLinks: { 5 | base: 'hoppygo://', 6 | car: 'car/', 7 | }, 8 | linkToMainApp: { 9 | icon: 10 | 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyNpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQwIDc5LjE2MDQ1MSwgMjAxNy8wNS8wNi0wMTowODoyMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChNYWNpbnRvc2gpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkEwMDU0NTkyRUJDRjExRTdBOEZBQzAxMzAwRUFGNEQ2IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkEwMDU0NTkzRUJDRjExRTdBOEZBQzAxMzAwRUFGNEQ2Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6QTAwNTQ1OTBFQkNGMTFFN0E4RkFDMDEzMDBFQUY0RDYiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6QTAwNTQ1OTFFQkNGMTFFN0E4RkFDMDEzMDBFQUY0RDYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz7n4MG4AAAAM1BMVEUFBQVBQUEeHh48PDxLS0tGRkYoKCgUFBQ3NzcZGRkyMjIKCgotLS0PDw8jIyNQUFAAAAANB11HAAAAEXRSTlP/////////////////////ACWtmWIAAAJ0SURBVHja7NnbboQgEADQEeSuwv9/bdttq3gBZgA3TSPJPunmCAwwAIQ3FHiQB3mQB3k7Mhsppf38MXUP4hbt48IX1xsx3J/LwHoiRvjrIlgvxHGfLkJ1QZbRZ8vUjoD1pTJAIwKDLxcxNyEow/txbkCOhl7U6y3F7L6jBNQjdh+ukB45QzWyxC1yHhFK0GPshLioSfRle0yRouqQqD2WxH/YSOyW40tmM9KTx7wpsgYRxXq86rL1GtCRrSI6+zdJqgokeqT0hetYEmTEITrkJ5LXNw0VWfDftw5ZS0U0tiJRVQQVWdsAETNrHDoaMuNC6zDwDQ0xmDFyai9JQyRlSgJ8z18jqBlpzcUqEdTcyuuQ6R2I/HvI2IgoSsdrGsLws0r9OFGESW+bTFnl3DUikHVFmYkIx89HjvBBifWkHDH164lDJ1SufmXEL92a0n2QynXyGSgjZarpvCsXmVF25yoQhtl+RAYq5Ybk0n2V0p+MsSoXjhKq1IQR5dset9mG7M5gOEeyi48odKhEwm43Z/eMszX7uas94/4kQkzq5yW1HHeTDbvf+XxQwDm/Oj0YONdQh4RZeHxBnBokTiTKO3mh8QqUktBE+WylAa0kn6tck73GKUe3WPoxyORB0QSHfXJByT0FeVWbcXKH2b6oFCpq7N4ZrbmOjqxSjj9npOVfRUs2p2MwpzSdC2OVtsNnpNJ4wo1TWo/RUUrzWT1Gab8QQCgdbh3KSo+rjaLS5f6kpPS5pCkonW6C8kqv66as0u1Oa6eYm5BYYeEuZFNYuA/5VVi4E/lWWLgX+VJYuBsJYML9yE3ryYM8yIM8yH9FPgQYAOIqW7lXlZxKAAAAAElFTkSuQmCC', 11 | title: 'ZOBRAZIT AUTA V MÉM OKOLÍ', 12 | }, 13 | maxCountOfCars: 3, 14 | paddingHorizontal: 16, 15 | rowHeight: 55, 16 | storageKey: 'HoppyGo_carsBlob', 17 | }; 18 | 19 | export default config; 20 | -------------------------------------------------------------------------------- /Examples/Complex/index.js: -------------------------------------------------------------------------------- 1 | import { Platform, AppRegistry } from 'react-native'; 2 | import App from './App'; 3 | import TodayWidget from './TodayWidget'; 4 | 5 | if ('geolocation' in navigator) { 6 | navigator.geolocation.requestAuthorization(); 7 | } 8 | 9 | AppRegistry.registerComponent('HoppyGoWidget', () => App); 10 | if (Platform.OS === 'ios') { 11 | AppRegistry.registerComponent('TodayWidgetExtension', () => TodayWidget); 12 | } 13 | -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget-tvOS/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 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget-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 | -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | 12 | #import 13 | #import 14 | 15 | @implementation AppDelegate 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 18 | { 19 | NSURL *jsCodeLocation; 20 | 21 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 22 | 23 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 24 | moduleName:@"HoppyGoWidget" 25 | initialProperties:nil 26 | launchOptions:launchOptions]; 27 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 28 | 29 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 30 | UIViewController *rootViewController = [UIViewController new]; 31 | rootViewController.view = rootView; 32 | self.window.rootViewController = rootViewController; 33 | [self.window makeKeyAndVisible]; 34 | return YES; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/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 | -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images-2.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "minimum-system-version" : "7.0", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "orientation" : "portrait", 11 | "idiom" : "iphone", 12 | "minimum-system-version" : "7.0", 13 | "subtype" : "retina4", 14 | "scale" : "2x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "57x57", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-57x57@1x.png", 49 | "scale" : "1x" 50 | }, 51 | { 52 | "size" : "57x57", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-57x57@2x.png", 55 | "scale" : "2x" 56 | }, 57 | { 58 | "size" : "60x60", 59 | "idiom" : "iphone", 60 | "filename" : "Icon-App-60x60@2x.png", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "size" : "60x60", 65 | "idiom" : "iphone", 66 | "filename" : "Icon-App-60x60@3x.png", 67 | "scale" : "3x" 68 | }, 69 | { 70 | "size" : "20x20", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-20x20@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "20x20", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-20x20@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "29x29", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-29x29@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "29x29", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-29x29@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "40x40", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-40x40@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "40x40", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-40x40@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "50x50", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-Small-50x50@1x.png", 109 | "scale" : "1x" 110 | }, 111 | { 112 | "size" : "50x50", 113 | "idiom" : "ipad", 114 | "filename" : "Icon-Small-50x50@2x.png", 115 | "scale" : "2x" 116 | }, 117 | { 118 | "size" : "72x72", 119 | "idiom" : "ipad", 120 | "filename" : "Icon-App-72x72@1x.png", 121 | "scale" : "1x" 122 | }, 123 | { 124 | "size" : "72x72", 125 | "idiom" : "ipad", 126 | "filename" : "Icon-App-72x72@2x.png", 127 | "scale" : "2x" 128 | }, 129 | { 130 | "size" : "76x76", 131 | "idiom" : "ipad", 132 | "filename" : "Icon-App-76x76@1x.png", 133 | "scale" : "1x" 134 | }, 135 | { 136 | "size" : "76x76", 137 | "idiom" : "ipad", 138 | "filename" : "Icon-App-76x76@2x.png", 139 | "scale" : "2x" 140 | }, 141 | { 142 | "size" : "83.5x83.5", 143 | "idiom" : "ipad", 144 | "filename" : "Icon-App-83.5x83.5@2x.png", 145 | "scale" : "2x" 146 | }, 147 | { 148 | "size" : "1024x1024", 149 | "idiom" : "ios-marketing", 150 | "filename" : "ItunesArtwork@2x.png", 151 | "scale" : "1x" 152 | }, 153 | { 154 | "size" : "40x40", 155 | "idiom" : "iphone", 156 | "filename" : "Icon-App-40x40@1x.png", 157 | "scale" : "1x" 158 | }, 159 | { 160 | "size" : "60x60", 161 | "idiom" : "iphone", 162 | "filename" : "Icon-App-60x60@1x.png", 163 | "scale" : "1x" 164 | }, 165 | { 166 | "size" : "76x76", 167 | "idiom" : "iphone", 168 | "filename" : "Icon-App-76x76@1x.png", 169 | "scale" : "1x" 170 | }, 171 | { 172 | "size" : "76x76", 173 | "idiom" : "ipad", 174 | "filename" : "Icon-App-76x76@3x.png", 175 | "scale" : "3x" 176 | } 177 | ], 178 | "info" : { 179 | "version" : 1, 180 | "author" : "xcode" 181 | } 182 | } -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-57x57@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-57x57@1x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-57x57@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-57x57@2x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-60x60@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-60x60@1x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-72x72@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-72x72@1x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-72x72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-72x72@2x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-76x76@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-76x76@3x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-Small-50x50@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-Small-50x50@1x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-Small-50x50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/Icon-Small-50x50@2x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/ItunesArtwork@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Complex/ios/HoppyGoWidget/Images.xcassets/AppIcon-1.appiconset/ItunesArtwork@2x.png -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | HoppyGoWidget 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 | NSExceptionDomains 30 | 31 | localhost 32 | 33 | NSExceptionAllowsInsecureHTTPLoads 34 | 35 | 36 | 37 | 38 | NSLocationAlwaysAndWhenInUseUsageDescription 39 | Pro zobrazení aut ve Vašem okolí. 40 | NSLocationAlwaysUsageDescription 41 | Pro zobrazení aut ve Vašem okolí. 42 | NSLocationWhenInUseUsageDescription 43 | Pro zobrazení aut ve Vašem okolí. 44 | UIBackgroundModes 45 | 46 | location 47 | 48 | UILaunchStoryboardName 49 | LaunchScreen 50 | UIRequiredDeviceCapabilities 51 | 52 | armv7 53 | 54 | UISupportedInterfaceOrientations 55 | 56 | UIInterfaceOrientationPortrait 57 | UIInterfaceOrientationLandscapeLeft 58 | UIInterfaceOrientationLandscapeRight 59 | 60 | UIViewControllerBasedStatusBarAppearance 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidget/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidgetTests/HoppyGoWidgetTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | #import 14 | #import 15 | 16 | #define TIMEOUT_SECONDS 600 17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 18 | 19 | @interface HoppyGoWidgetTests : XCTestCase 20 | 21 | @end 22 | 23 | @implementation HoppyGoWidgetTests 24 | 25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 26 | { 27 | if (test(view)) { 28 | return YES; 29 | } 30 | for (UIView *subview in [view subviews]) { 31 | if ([self findSubviewInView:subview matching:test]) { 32 | return YES; 33 | } 34 | } 35 | return NO; 36 | } 37 | 38 | - (void)testRendersWelcomeScreen 39 | { 40 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 42 | BOOL foundElement = NO; 43 | 44 | __block NSString *redboxError = nil; 45 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 46 | if (level >= RCTLogLevelError) { 47 | redboxError = message; 48 | } 49 | }); 50 | 51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 54 | 55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 57 | return YES; 58 | } 59 | return NO; 60 | }]; 61 | } 62 | 63 | RCTSetLogFunction(RCTDefaultLogFunction); 64 | 65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 67 | } 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /Examples/Complex/ios/HoppyGoWidgetTests/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 | -------------------------------------------------------------------------------- /Examples/Complex/lib/date.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | export const getTomorrowDate = (date: Date): Date => 3 | new Date(date.getTime() + 24 * 60 * 60 * 1000); 4 | 5 | export const formateDate = (date: Date): string => 6 | date.toISOString().slice(0, 16); 7 | 8 | export const getTomorrowDateRange = (date: Date): string => { 9 | const tomorrow = getTomorrowDate(date); 10 | const startDate = new Date(tomorrow.setUTCHours(9)); 11 | const endDate = getTomorrowDate(startDate); 12 | return `${formateDate(startDate)},${formateDate(endDate)}`; 13 | }; 14 | -------------------------------------------------------------------------------- /Examples/Complex/lib/date.spec.js: -------------------------------------------------------------------------------- 1 | import { formateDate, getTomorrowDate, getTomorrowDateRange } from './date'; 2 | 3 | it('get the day after', () => { 4 | expect(getTomorrowDate(new Date(1510909200000))).toEqual( 5 | new Date(1510995600000), 6 | ); 7 | }); 8 | 9 | it('convert date to YYYY-MM-DDTHH:MM formate', () => { 10 | expect(formateDate(new Date(1510909200000))).toBe('2017-11-17T09:00'); 11 | }); 12 | 13 | it('get date range', () => { 14 | expect(getTomorrowDateRange(new Date(1510909200000))).toBe( 15 | '2017-11-18T09:00,2017-11-19T09:00', 16 | ); 17 | }); 18 | -------------------------------------------------------------------------------- /Examples/Complex/lib/fetchBlob.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import RNFetchBlob from 'react-native-fetch-blob'; 3 | 4 | type FetchToFileProps = { 5 | headers: mixed, 6 | path: string, 7 | requestPath: string, 8 | }; 9 | 10 | type LoadFromFileProps = { 11 | path: string, 12 | }; 13 | 14 | export const { dirs } = RNFetchBlob.fs; 15 | 16 | export const fetchToFile = ({ 17 | headers, 18 | path, 19 | requestPath, 20 | }: FetchToFileProps): Promise => 21 | new Promise((resolve, reject) => { 22 | RNFetchBlob.config({ 23 | path, 24 | }) 25 | .fetch('GET', requestPath, { 26 | ...headers, 27 | }) 28 | .then(response => resolve(response)) 29 | .catch(error => reject(error)); 30 | }); 31 | 32 | export const loadFromFile = ({ path }: LoadFromFileProps): Promise => 33 | new Promise((resolve, reject) => { 34 | RNFetchBlob.fs 35 | .readStream(path) 36 | .then(stream => { 37 | let data = ''; 38 | stream.open(); 39 | stream.onData(chunk => { 40 | data += chunk; 41 | }); 42 | stream.onEnd(() => resolve(data)); 43 | }) 44 | .catch(error => reject(error)); 45 | }); 46 | -------------------------------------------------------------------------------- /Examples/Complex/lib/openInApp.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import config from '../config'; 3 | import { openURL } from 'react-native-today-widget'; 4 | 5 | type openInAppProps = { 6 | url?: string, 7 | }; 8 | 9 | export const openInApp = ({ url }: openInAppProps) => { 10 | const link = `${config.inappLinks.base}${url || ''}`; 11 | openURL(link); 12 | }; 13 | -------------------------------------------------------------------------------- /Examples/Complex/lib/price.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | type priceProp = { 3 | price: string, 4 | }; 5 | 6 | export const parsePrice = ({ price }: priceProp) => 7 | price.replace(/\.0+/, '').replace(/,/g, ' '); 8 | -------------------------------------------------------------------------------- /Examples/Complex/lib/price.spec.js: -------------------------------------------------------------------------------- 1 | import { parsePrice } from './price'; 2 | 3 | it('removes zero pennies', () => { 4 | expect(parsePrice({ price: '42.00 Kč' })).toEqual('42 Kč'); 5 | expect(parsePrice({ price: '1.00 Kč' })).toEqual('1 Kč'); 6 | expect(parsePrice({ price: '1.0000' })).toEqual('1'); 7 | expect(parsePrice({ price: '1.0' })).toEqual('1'); 8 | }); 9 | 10 | it('keep non-zero pennies', () => { 11 | expect(parsePrice({ price: '42.80 Kč' })).toEqual('42.80 Kč'); 12 | expect(parsePrice({ price: '1.8 Kč' })).toEqual('1.8 Kč'); 13 | expect(parsePrice({ price: '1.42' })).toEqual('1.42'); 14 | expect(parsePrice({ price: '1.4' })).toEqual('1.4'); 15 | }); 16 | 17 | it('replace comma with space', () => { 18 | expect(parsePrice({ price: '42,000,243,000 Kč' })).toEqual( 19 | '42 000 243 000 Kč', 20 | ); 21 | }); 22 | 23 | it('remove pennies and replace commas with space', () => { 24 | expect(parsePrice({ price: '42,123.00 Kč' })).toEqual('42 123 Kč'); 25 | }); 26 | -------------------------------------------------------------------------------- /Examples/Complex/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HoppyGoWidget", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-native/local-cli/cli.js start", 7 | "eslint": "eslint .", 8 | "flow": "flow", 9 | "jest": "jest", 10 | "test": "yarn run eslint && yarn run flow && jest", 11 | "prettier": "prettier --print-width 80 --tab-width 2 --single-quote --trailing-comma all --bracket-spacing --parser babylon --write '{components,__{tests,mocks}__}/**/*.js'" 12 | }, 13 | "dependencies": { 14 | "flow-bin": "0.56", 15 | "react": "16.0.0", 16 | "react-native": "0.50.3", 17 | "react-native-fetch-blob": "^0.10.8", 18 | "react-native-today-widget": "0.10.1" 19 | }, 20 | "devDependencies": { 21 | "babel-cli": "^6.26.0", 22 | "babel-eslint": "^8.0.2", 23 | "babel-jest": "21.2.0", 24 | "babel-preset-flow": "^6.23.0", 25 | "babel-preset-react-native": "4.0.0", 26 | "eslint": "^4.11.0", 27 | "eslint-config-airbnb": "^16.1.0", 28 | "eslint-config-prettier": "^2.8.0", 29 | "eslint-loader": "^1.9.0", 30 | "eslint-plugin-babel": "^4.1.2", 31 | "eslint-plugin-flowtype": "^2.39.1", 32 | "eslint-plugin-fp": "^2.3.0", 33 | "eslint-plugin-import": "^2.8.0", 34 | "eslint-plugin-jsx-a11y": "^6.0.2", 35 | "eslint-plugin-prettier": "^2.3.1", 36 | "eslint-plugin-react": "^7.5.0", 37 | "jest": "21.2.1", 38 | "prettier": "^1.8.2", 39 | "react-test-renderer": "16.0.0" 40 | }, 41 | "jest": { 42 | "preset": "react-native" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Examples/Expandable/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["react-native"] 3 | } 4 | -------------------------------------------------------------------------------- /Examples/Expandable/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /Examples/Expandable/.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 | .*/Libraries/react-native/React.js 15 | 16 | ; Ignore polyfills 17 | .*/Libraries/polyfills/.* 18 | 19 | ; Ignore metro 20 | .*/node_modules/metro/.* 21 | 22 | [include] 23 | 24 | [libs] 25 | node_modules/react-native/Libraries/react-native/react-native-interface.js 26 | node_modules/react-native/flow/ 27 | node_modules/react-native/flow-github/ 28 | 29 | [options] 30 | emoji=true 31 | 32 | module.system=haste 33 | 34 | munge_underscores=true 35 | 36 | 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' 37 | 38 | module.file_ext=.js 39 | module.file_ext=.jsx 40 | module.file_ext=.json 41 | module.file_ext=.native.js 42 | 43 | suppress_type=$FlowIssue 44 | suppress_type=$FlowFixMe 45 | suppress_type=$FlowFixMeProps 46 | suppress_type=$FlowFixMeState 47 | 48 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 49 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 50 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 51 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 52 | 53 | [version] 54 | ^0.67.0 55 | -------------------------------------------------------------------------------- /Examples/Expandable/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /Examples/Expandable/.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 | -------------------------------------------------------------------------------- /Examples/Expandable/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Examples/Expandable/README.md: -------------------------------------------------------------------------------- 1 | # Example of expandable Today widget using RN 2 | 3 | Created by `react-native init Basic` command followed by `yarn add react-native-today-widget` and `react-native link`. 4 | 5 | React Native version: `0.48.2` 6 | 7 | Changes only in [index.ios.js](./index.ios.js) 8 | 9 | ![Collapsed](screenshots/collapsed.png) ![Expanded](screenshots/expanded.png) 10 | -------------------------------------------------------------------------------- /Examples/Expandable/__tests__/index.android.js: -------------------------------------------------------------------------------- 1 | import 'react-native'; 2 | import React from 'react'; 3 | import Index from '../index.android.js'; 4 | 5 | // Note: test renderer must be required after react-native. 6 | import renderer from 'react-test-renderer'; 7 | 8 | it('renders correctly', () => { 9 | const tree = renderer.create( 10 | 11 | ); 12 | }); 13 | -------------------------------------------------------------------------------- /Examples/Expandable/__tests__/index.ios.js: -------------------------------------------------------------------------------- 1 | import 'react-native'; 2 | import React from 'react'; 3 | import Index from '../index.ios.js'; 4 | 5 | // Note: test renderer must be required after react-native. 6 | import renderer from 'react-test-renderer'; 7 | 8 | it('renders correctly', () => { 9 | const tree = renderer.create( 10 | 11 | ); 12 | }); 13 | -------------------------------------------------------------------------------- /Examples/Expandable/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 | lib_deps = [] 12 | 13 | for jarfile in glob(['libs/*.jar']): 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 | 21 | for aarfile in glob(['libs/*.aar']): 22 | name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')] 23 | lib_deps.append(':' + name) 24 | android_prebuilt_aar( 25 | name = name, 26 | aar = aarfile, 27 | ) 28 | 29 | android_library( 30 | name = "all-libs", 31 | exported_deps = lib_deps, 32 | ) 33 | 34 | android_library( 35 | name = "app-code", 36 | srcs = glob([ 37 | "src/main/java/**/*.java", 38 | ]), 39 | deps = [ 40 | ":all-libs", 41 | ":build_config", 42 | ":res", 43 | ], 44 | ) 45 | 46 | android_build_config( 47 | name = "build_config", 48 | package = "com.expandable", 49 | ) 50 | 51 | android_resource( 52 | name = "res", 53 | package = "com.expandable", 54 | res = "src/main/res", 55 | ) 56 | 57 | android_binary( 58 | name = "app", 59 | keystore = "//android/keystores:debug", 60 | manifest = "src/main/AndroidManifest.xml", 61 | package_type = "debug", 62 | deps = [ 63 | ":app-code", 64 | ], 65 | ) 66 | -------------------------------------------------------------------------------- /Examples/Expandable/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 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Disabling obfuscation is useful if you collect stack traces from production crashes 20 | # (unless you are using a system that supports de-obfuscate the stack traces). 21 | -dontobfuscate 22 | 23 | # React Native 24 | 25 | # Keep our interfaces so they can be used by other ProGuard rules. 26 | # See http://sourceforge.net/p/proguard/bugs/466/ 27 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip 28 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters 29 | -keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip 30 | 31 | # Do not strip any method/class that is annotated with @DoNotStrip 32 | -keep @com.facebook.proguard.annotations.DoNotStrip class * 33 | -keep @com.facebook.common.internal.DoNotStrip class * 34 | -keepclassmembers class * { 35 | @com.facebook.proguard.annotations.DoNotStrip *; 36 | @com.facebook.common.internal.DoNotStrip *; 37 | } 38 | 39 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { 40 | void set*(***); 41 | *** get*(); 42 | } 43 | 44 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } 45 | -keep class * extends com.facebook.react.bridge.NativeModule { *; } 46 | -keepclassmembers,includedescriptorclasses class * { native ; } 47 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } 48 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } 49 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } 50 | 51 | -dontwarn com.facebook.react.** 52 | 53 | # TextLayoutBuilder uses a non-public Android constructor within StaticLayout. 54 | # See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details. 55 | -dontwarn android.text.StaticLayout 56 | 57 | # okhttp 58 | 59 | -keepattributes Signature 60 | -keepattributes *Annotation* 61 | -keep class okhttp3.** { *; } 62 | -keep interface okhttp3.** { *; } 63 | -dontwarn okhttp3.** 64 | 65 | # okio 66 | 67 | -keep class sun.misc.Unsafe { *; } 68 | -dontwarn java.nio.file.* 69 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 70 | -dontwarn okio.** 71 | -------------------------------------------------------------------------------- /Examples/Expandable/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 13 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Examples/Expandable/android/app/src/main/java/com/expandable/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.expandable; 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 "Expandable"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Examples/Expandable/android/app/src/main/java/com/expandable/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.expandable; 2 | 3 | import android.app.Application; 4 | 5 | import com.facebook.react.ReactApplication; 6 | import com.facebook.react.ReactNativeHost; 7 | import com.facebook.react.ReactPackage; 8 | import com.facebook.react.shell.MainReactPackage; 9 | import com.facebook.soloader.SoLoader; 10 | 11 | import java.util.Arrays; 12 | import java.util.List; 13 | 14 | public class MainApplication extends Application implements ReactApplication { 15 | 16 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 17 | @Override 18 | public boolean getUseDeveloperSupport() { 19 | return BuildConfig.DEBUG; 20 | } 21 | 22 | @Override 23 | protected List getPackages() { 24 | return Arrays.asList( 25 | new MainReactPackage() 26 | ); 27 | } 28 | 29 | @Override 30 | protected String getJSMainModuleName() { 31 | return "index"; 32 | } 33 | }; 34 | 35 | @Override 36 | public ReactNativeHost getReactNativeHost() { 37 | return mReactNativeHost; 38 | } 39 | 40 | @Override 41 | public void onCreate() { 42 | super.onCreate(); 43 | SoLoader.init(this, /* native exopackage */ false); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Examples/Expandable/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Expandable/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /Examples/Expandable/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Expandable/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /Examples/Expandable/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Expandable/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Examples/Expandable/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Expandable/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Examples/Expandable/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Expandable 3 | 4 | -------------------------------------------------------------------------------- /Examples/Expandable/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Examples/Expandable/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.2.3' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | mavenLocal() 18 | jcenter() 19 | maven { 20 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 21 | url "$rootDir/../node_modules/react-native/android" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Examples/Expandable/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.useDeprecatedNdk=true 21 | -------------------------------------------------------------------------------- /Examples/Expandable/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Expandable/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Examples/Expandable/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 6 | -------------------------------------------------------------------------------- /Examples/Expandable/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /Examples/Expandable/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /Examples/Expandable/android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /Examples/Expandable/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'Expandable' 2 | 3 | include ':app' 4 | -------------------------------------------------------------------------------- /Examples/Expandable/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Expandable", 3 | "displayName": "Expandable" 4 | } -------------------------------------------------------------------------------- /Examples/Expandable/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import React, { Component } from "react"; 8 | import { AppRegistry, StyleSheet, Text, View } from "react-native"; 9 | 10 | export default class Expandable extends Component { 11 | render() { 12 | return ( 13 | 14 | 15 | Welcome to React Native! 16 | 17 | 18 | To get started, edit index.ios.js 19 | 20 | 21 | Press Cmd+R to reload,{"\n"} 22 | Cmd+D or shake for dev menu 23 | 24 | 25 | ); 26 | } 27 | } 28 | 29 | const styles = StyleSheet.create({ 30 | container: { 31 | flex: 1, 32 | justifyContent: "center", 33 | alignItems: "center", 34 | backgroundColor: "#F5FCFF" 35 | }, 36 | welcome: { 37 | fontSize: 20, 38 | textAlign: "center", 39 | margin: 10 40 | }, 41 | instructions: { 42 | textAlign: "center", 43 | color: "#333333", 44 | marginBottom: 5 45 | } 46 | }); 47 | 48 | AppRegistry.registerComponent("Expandable", () => Expandable); 49 | -------------------------------------------------------------------------------- /Examples/Expandable/index.widget.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import { AppRegistry, StyleSheet, Text, View } from "react-native"; 3 | 4 | import { setExpandable } from "react-native-today-widget"; 5 | 6 | class ExpandableTodayWidget extends Component { 7 | constructor() { 8 | super(); 9 | const isExpandable = true; 10 | const maxHeight = 500; 11 | setExpandable(isExpandable, maxHeight); 12 | this.onLayout = event => { 13 | const height = event.nativeEvent.layout.height; 14 | if (height <= 110) { 15 | console.log("widget is in compact mode"); 16 | } else if (height > 110) { 17 | console.log("widget is in expanded mode"); 18 | } 19 | }; 20 | } 21 | 22 | render() { 23 | return ( 24 | 25 | 26 | Hello expandable world! 27 | 28 | 29 | ); 30 | } 31 | } 32 | 33 | const styles = StyleSheet.create({ 34 | welcome: { 35 | fontSize: 20, 36 | textAlign: "center", 37 | margin: 10 38 | }, 39 | widget: { 40 | flex: 1, 41 | justifyContent: "center", 42 | alignItems: "center" 43 | } 44 | }); 45 | 46 | AppRegistry.registerComponent( 47 | "TodayWidgetExtension", 48 | () => ExpandableTodayWidget 49 | ); 50 | -------------------------------------------------------------------------------- /Examples/Expandable/ios/Expandable-tvOS/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 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Examples/Expandable/ios/Expandable-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 | -------------------------------------------------------------------------------- /Examples/Expandable/ios/Expandable/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 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 | @interface AppDelegate : UIResponder 11 | 12 | @property (nonatomic, strong) UIWindow *window; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Examples/Expandable/ios/Expandable/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 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 | 13 | @implementation AppDelegate 14 | 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 16 | { 17 | NSURL *jsCodeLocation; 18 | 19 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 20 | 21 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 22 | moduleName:@"Expandable" 23 | initialProperties:nil 24 | launchOptions:launchOptions]; 25 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 26 | 27 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 28 | UIViewController *rootViewController = [UIViewController new]; 29 | rootViewController.view = rootView; 30 | self.window.rootViewController = rootViewController; 31 | [self.window makeKeyAndVisible]; 32 | return YES; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Examples/Expandable/ios/Expandable/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 | -------------------------------------------------------------------------------- /Examples/Expandable/ios/Expandable/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 | } -------------------------------------------------------------------------------- /Examples/Expandable/ios/Expandable/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Examples/Expandable/ios/Expandable/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | Expandable 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 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 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UIViewControllerBasedStatusBarAppearance 40 | 41 | NSLocationWhenInUseUsageDescription 42 | 43 | NSAppTransportSecurity 44 | 45 | 46 | NSExceptionDomains 47 | 48 | localhost 49 | 50 | NSExceptionAllowsInsecureHTTPLoads 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /Examples/Expandable/ios/Expandable/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 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 | -------------------------------------------------------------------------------- /Examples/Expandable/ios/ExpandableTests/ExpandableTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 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 ExpandableTests : XCTestCase 18 | 19 | @end 20 | 21 | @implementation ExpandableTests 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 | -------------------------------------------------------------------------------- /Examples/Expandable/ios/ExpandableTests/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 | -------------------------------------------------------------------------------- /Examples/Expandable/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Expandable", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-native/local-cli/cli.js start", 7 | "test": "jest" 8 | }, 9 | "dependencies": { 10 | "react": "16.3.1", 11 | "react-native": "0.55.4", 12 | "react-native-today-widget": "^1.0.0" 13 | }, 14 | "devDependencies": { 15 | "babel-jest": "21.0.2", 16 | "babel-preset-react-native": "3.0.2", 17 | "jest": "21.0.2", 18 | "react-test-renderer": "16.0.0-alpha.12" 19 | }, 20 | "jest": { 21 | "preset": "react-native" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Examples/Expandable/screenshots/collapsed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Expandable/screenshots/collapsed.png -------------------------------------------------------------------------------- /Examples/Expandable/screenshots/expanded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/Examples/Expandable/screenshots/expanded.png -------------------------------------------------------------------------------- /UNLICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/UNLICENSE -------------------------------------------------------------------------------- /__tests__/index.android.js: -------------------------------------------------------------------------------- 1 | import 'react-native'; 2 | import React from 'react'; 3 | import Index from '../index.android.js'; 4 | 5 | // Note: test renderer must be required after react-native. 6 | import renderer from 'react-test-renderer'; 7 | 8 | it('renders correctly', () => { 9 | const tree = renderer.create(); 10 | }); 11 | -------------------------------------------------------------------------------- /__tests__/index.ios.js: -------------------------------------------------------------------------------- 1 | import 'react-native'; 2 | import React from 'react'; 3 | import Index from '../index.ios.js'; 4 | 5 | // Note: test renderer must be required after react-native. 6 | import renderer from 'react-test-renderer'; 7 | 8 | it('renders correctly', () => { 9 | const tree = renderer.create(); 10 | }); 11 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RNTodayWidgetExtension", 3 | "displayName": "RNTodayWidgetExtension" 4 | } -------------------------------------------------------------------------------- /bin/embedExtension.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'rubygems' 3 | require 'xcodeproj' 4 | 5 | project_location = './' # running as bin from root project 6 | extension_proj = 'RNTodayWidgetExtension.xcodeproj' 7 | project_path = Dir.glob("#{project_location}ios/*.{xcodeproj,xcworkspace}").first 8 | extension_path = "#{project_location}node_modules/react-native-today-widget/ios/#{extension_proj}" 9 | abort "Couldn't find XCode project in '#{project_location}ios/'" if project_path.nil? 10 | 11 | # load XCode projects and targets 12 | project = Xcodeproj::Project.open(project_path) 13 | app_target = project.targets.find { |t| !t.name['^(?!.*(tvOS|Tests)).*$'] } 14 | 15 | extension_ref = project.files.find do |file| 16 | file.name == extension_proj 17 | end 18 | 19 | extension = Xcodeproj::Project.open('./node_modules/' + extension_ref.path) 20 | appex = extension.products.first 21 | 22 | # add PBXContainerItemProxy as proxy for appex object, because it is from extension project 23 | container_item = project.new(Xcodeproj::Project::Object::PBXContainerItemProxy) 24 | container_item.container_portal = extension_ref.uuid 25 | container_item.proxy_type = "2" 26 | container_item.remote_info = "TodayWidgetExtension" 27 | container_item.remote_global_id_string = appex.uuid 28 | 29 | # add PBXReferenceProxy as proxy for appex reference 30 | reference_proxy = project.new(Xcodeproj::Project::Object::PBXReferenceProxy) 31 | reference_proxy.file_type = appex.explicit_file_type 32 | reference_proxy.path = appex.path 33 | reference_proxy.remote_ref = container_item 34 | reference_proxy.source_tree = appex.source_tree 35 | 36 | # add PBXGroup with proxy reference in childern 37 | products_group = project.new(Xcodeproj::Project::Object::PBXGroup) 38 | products_group.name = 'Products' 39 | products_group.source_tree = "" 40 | products_group< ['RemoveHeadersOnCopy'] } 86 | # save XCode project 87 | project.save 88 | end 89 | end 90 | 91 | puts 'App Extension linked and binary embeded' 92 | -------------------------------------------------------------------------------- /bin/setBundleId.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'rubygems' 4 | require 'xcodeproj' 5 | 6 | WIDGET_EXT='.TodayWidgetExtension' 7 | 8 | if File.exist?('./bin/setBundleId.rb') 9 | # running from node_modules during installation 10 | project_location = './../../ios/' 11 | extension_location = './ios/' 12 | else 13 | # running as bin from root project 14 | project_location = './ios/' 15 | extension_location = './node_modules/react-native-today-widget/ios/' 16 | end 17 | 18 | # Read values from main project 19 | project_path = Dir.glob("#{project_location}*.{xcodeproj,xcworkspace}").first 20 | if project_path.nil? 21 | puts "[WARN] Couldn't find XCode project in '#{project_location}'" 22 | end 23 | project = Xcodeproj::Project.open(project_path) 24 | 25 | app_target = project.targets.find { |t| !t.name['^(?!.*(tvOS|Tests)).*$'] } 26 | 27 | build_configuration_list = app_target.build_configuration_list 28 | default_configuration_name = build_configuration_list.default_configuration_name 29 | build_settings = build_configuration_list.build_settings(default_configuration_name) 30 | 31 | PRODUCT_BUNDLE_IDENTIFIER = build_settings['PRODUCT_BUNDLE_IDENTIFIER'] 32 | PRODUCT_NAME = build_settings['PRODUCT_NAME'] 33 | 34 | if PRODUCT_BUNDLE_IDENTIFIER 35 | puts "[INFO] Reading bundle ID from PRODUCT_BUNDLE_IDENTIFIER: #{PRODUCT_BUNDLE_IDENTIFIER}" 36 | bundle_id_projet = PRODUCT_BUNDLE_IDENTIFIER 37 | else 38 | INFOPLIST_FILE = build_settings['INFOPLIST_FILE'] 39 | info_plist_project = "#{project_location}#{INFOPLIST_FILE}" 40 | if info_plist_project.nil? 41 | puts "[WARN] Couldn't find Info.plist in '#{info_plist_project}'" 42 | end 43 | 44 | bundle_id_unescaped = Xcodeproj::Plist.read_from_path(info_plist_project)['CFBundleIdentifier'] 45 | puts "[INFO] Reading CFBundleIdentifier from #{info_plist_project}: #{bundle_id_unescaped}" 46 | 47 | # Convert PRODUCT_NAME to same format as rfc1034identifier provide 48 | converted_product_name = PRODUCT_NAME.gsub(/[^\u0000-\u007F]/) { |non_latin| "#{non_latin}-" } 49 | converted_product_name.tr!( 50 | "ÀÁÂÃÄÅàáâãäåĀāĂ㥹ÇçĆćĈĉĊċČčÐðĎďĐđÈÉÊËèéêëĒēĔĕĖėĘęĚěĜĝĞğĠġĢ‌​ģĤĥĦħÌÍÎÏìíîïĨĩĪīĬĭĮ‌​įİıĴĵĶķĸĹĺĻļĽľĿŀŁłÑñ‌​ŃńŅņŇňʼnŊŋÒÓÔÕÖØòóôõö‌​øŌōŎŏŐőŔŕŖŗŘřŚśŜŝŞşŠ‌​šȘșſŢţŤťŦŧȚțÙÚÛÜùúûü‌​ŨũŪūŬŭŮůŰűŲųŴŵÝýÿŶŷŸ‌​ŹźŻżŽž", 51 | "AAAAAAaaaaaaAaAaAaCcCcCcCcCcDdDdDdEEEEeeeeEeEeEeEeEeGgGgGgG‌​gHhHhIIIIiiiiIiIiIiI‌​iIiJjKkkLlLlLlLlLlNn‌​NnNnNnnNnOOOOOOooooo‌​oOoOoOoRrRrRrSsSsSsS‌​sSssTtTtTtTtUUUUuuuu‌​UuUuUuUuUuUuWwYyyYyY‌​ZzZzZz" 52 | ) 53 | converted_product_name.gsub!(/[^\w\d\-+]/, '-') 54 | 55 | bundle_id_projet = bundle_id_unescaped.gsub('$(PRODUCT_NAME:rfc1034identifier)', "#{converted_product_name}") 56 | if bundle_id_projet != bundle_id_unescaped 57 | puts "[INFO] Transformed value of bundle ID: #{bundle_id_projet}" 58 | end 59 | end 60 | 61 | bundle_id_extension = "#{bundle_id_projet}#{WIDGET_EXT}" 62 | 63 | # Write bundle id to project for extension 64 | info_plist_extension = Dir.glob("#{extension_location}TodayWidgetExtension/Info.plist").first 65 | if info_plist_extension.nil? 66 | puts "[WARN] Couldn't find Info.plist in '#{extension_location}TodayWidgetExtension/Info.plist'" 67 | end 68 | plist_extension = Xcodeproj::Plist.read_from_path(info_plist_extension) 69 | plist_extension['CFBundleIdentifier'] = bundle_id_extension 70 | puts "[INFO] Setting #{bundle_id_extension} as CFBundleIdentifier for #{info_plist_extension}" 71 | Xcodeproj::Plist.write_to_path(plist_extension, info_plist_extension) 72 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-eslint_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 7bb242d0e8d19fe3839613f0216bde12 2 | // flow-typed version: <>/babel-eslint_v^7.2.3/flow_v0.42.0 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/babylon-to-espree/attachComments' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-eslint/babylon-to-espree/convertComments' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'babel-eslint/babylon-to-espree/convertTemplateType' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'babel-eslint/babylon-to-espree/index' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'babel-eslint/babylon-to-espree/toAST' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'babel-eslint/babylon-to-espree/toToken' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'babel-eslint/babylon-to-espree/toTokens' { 50 | declare module.exports: any; 51 | } 52 | 53 | // Filename aliases 54 | declare module 'babel-eslint/babylon-to-espree/attachComments.js' { 55 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/attachComments'>; 56 | } 57 | declare module 'babel-eslint/babylon-to-espree/convertComments.js' { 58 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/convertComments'>; 59 | } 60 | declare module 'babel-eslint/babylon-to-espree/convertTemplateType.js' { 61 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/convertTemplateType'>; 62 | } 63 | declare module 'babel-eslint/babylon-to-espree/index.js' { 64 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/index'>; 65 | } 66 | declare module 'babel-eslint/babylon-to-espree/toAST.js' { 67 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/toAST'>; 68 | } 69 | declare module 'babel-eslint/babylon-to-espree/toToken.js' { 70 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/toToken'>; 71 | } 72 | declare module 'babel-eslint/babylon-to-espree/toTokens.js' { 73 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/toTokens'>; 74 | } 75 | declare module 'babel-eslint/index' { 76 | declare module.exports: $Exports<'babel-eslint'>; 77 | } 78 | declare module 'babel-eslint/index.js' { 79 | declare module.exports: $Exports<'babel-eslint'>; 80 | } 81 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-jest_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 4dd6cf423331a0e494ae7703a6241848 2 | // flow-typed version: <>/babel-jest_v20.0.3/flow_v0.42.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-jest' 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-jest' { 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-jest/build/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'babel-jest/build/index.js' { 31 | declare module.exports: $Exports<'babel-jest/build/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-preset-react-native_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 95a227a2cda6da8e96b9544b630a4c2e 2 | // flow-typed version: <>/babel-preset-react-native_v1.9.2/flow_v0.42.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-preset-react-native' 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-react-native' { 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-react-native/configs/hmr' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-preset-react-native/configs/internal' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'babel-preset-react-native/configs/main' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'babel-preset-react-native/lib/resolvePlugins' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'babel-preset-react-native/plugins' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'babel-preset-react-native/transforms/transform-symbol-member' { 46 | declare module.exports: any; 47 | } 48 | 49 | // Filename aliases 50 | declare module 'babel-preset-react-native/configs/hmr.js' { 51 | declare module.exports: $Exports<'babel-preset-react-native/configs/hmr'>; 52 | } 53 | declare module 'babel-preset-react-native/configs/internal.js' { 54 | declare module.exports: $Exports<'babel-preset-react-native/configs/internal'>; 55 | } 56 | declare module 'babel-preset-react-native/configs/main.js' { 57 | declare module.exports: $Exports<'babel-preset-react-native/configs/main'>; 58 | } 59 | declare module 'babel-preset-react-native/index' { 60 | declare module.exports: $Exports<'babel-preset-react-native'>; 61 | } 62 | declare module 'babel-preset-react-native/index.js' { 63 | declare module.exports: $Exports<'babel-preset-react-native'>; 64 | } 65 | declare module 'babel-preset-react-native/lib/resolvePlugins.js' { 66 | declare module.exports: $Exports<'babel-preset-react-native/lib/resolvePlugins'>; 67 | } 68 | declare module 'babel-preset-react-native/plugins.js' { 69 | declare module.exports: $Exports<'babel-preset-react-native/plugins'>; 70 | } 71 | declare module 'babel-preset-react-native/transforms/transform-symbol-member.js' { 72 | declare module.exports: $Exports<'babel-preset-react-native/transforms/transform-symbol-member'>; 73 | } 74 | -------------------------------------------------------------------------------- /flow-typed/npm/eslint-config-airbnb_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 314b1a4196420ee71f87d16bc14379b3 2 | // flow-typed version: <>/eslint-config-airbnb_v^15.0.1/flow_v0.42.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-config-airbnb' 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 'eslint-config-airbnb' { 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 'eslint-config-airbnb/base' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'eslint-config-airbnb/legacy' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'eslint-config-airbnb/rules/react-a11y' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'eslint-config-airbnb/rules/react' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'eslint-config-airbnb/test/test-base' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'eslint-config-airbnb/test/test-react-order' { 46 | declare module.exports: any; 47 | } 48 | 49 | // Filename aliases 50 | declare module 'eslint-config-airbnb/base.js' { 51 | declare module.exports: $Exports<'eslint-config-airbnb/base'>; 52 | } 53 | declare module 'eslint-config-airbnb/index' { 54 | declare module.exports: $Exports<'eslint-config-airbnb'>; 55 | } 56 | declare module 'eslint-config-airbnb/index.js' { 57 | declare module.exports: $Exports<'eslint-config-airbnb'>; 58 | } 59 | declare module 'eslint-config-airbnb/legacy.js' { 60 | declare module.exports: $Exports<'eslint-config-airbnb/legacy'>; 61 | } 62 | declare module 'eslint-config-airbnb/rules/react-a11y.js' { 63 | declare module.exports: $Exports<'eslint-config-airbnb/rules/react-a11y'>; 64 | } 65 | declare module 'eslint-config-airbnb/rules/react.js' { 66 | declare module.exports: $Exports<'eslint-config-airbnb/rules/react'>; 67 | } 68 | declare module 'eslint-config-airbnb/test/test-base.js' { 69 | declare module.exports: $Exports<'eslint-config-airbnb/test/test-base'>; 70 | } 71 | declare module 'eslint-config-airbnb/test/test-react-order.js' { 72 | declare module.exports: $Exports<'eslint-config-airbnb/test/test-react-order'>; 73 | } 74 | -------------------------------------------------------------------------------- /flow-typed/npm/eslint-plugin-react-native_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 72620c7050f5579c1862e2a447a31faf 2 | // flow-typed version: <>/eslint-plugin-react-native_v^2.3.2/flow_v0.42.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-plugin-react-native' 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 'eslint-plugin-react-native' { 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 'eslint-plugin-react-native/lib/rules/no-color-literals' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'eslint-plugin-react-native/lib/rules/no-inline-styles' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'eslint-plugin-react-native/lib/rules/no-unused-styles' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'eslint-plugin-react-native/lib/rules/split-platform-components' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'eslint-plugin-react-native/lib/util/Components' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'eslint-plugin-react-native/lib/util/stylesheet' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'eslint-plugin-react-native/lib/util/variable' { 50 | declare module.exports: any; 51 | } 52 | 53 | // Filename aliases 54 | declare module 'eslint-plugin-react-native/index' { 55 | declare module.exports: $Exports<'eslint-plugin-react-native'>; 56 | } 57 | declare module 'eslint-plugin-react-native/index.js' { 58 | declare module.exports: $Exports<'eslint-plugin-react-native'>; 59 | } 60 | declare module 'eslint-plugin-react-native/lib/rules/no-color-literals.js' { 61 | declare module.exports: $Exports<'eslint-plugin-react-native/lib/rules/no-color-literals'>; 62 | } 63 | declare module 'eslint-plugin-react-native/lib/rules/no-inline-styles.js' { 64 | declare module.exports: $Exports<'eslint-plugin-react-native/lib/rules/no-inline-styles'>; 65 | } 66 | declare module 'eslint-plugin-react-native/lib/rules/no-unused-styles.js' { 67 | declare module.exports: $Exports<'eslint-plugin-react-native/lib/rules/no-unused-styles'>; 68 | } 69 | declare module 'eslint-plugin-react-native/lib/rules/split-platform-components.js' { 70 | declare module.exports: $Exports<'eslint-plugin-react-native/lib/rules/split-platform-components'>; 71 | } 72 | declare module 'eslint-plugin-react-native/lib/util/Components.js' { 73 | declare module.exports: $Exports<'eslint-plugin-react-native/lib/util/Components'>; 74 | } 75 | declare module 'eslint-plugin-react-native/lib/util/stylesheet.js' { 76 | declare module.exports: $Exports<'eslint-plugin-react-native/lib/util/stylesheet'>; 77 | } 78 | declare module 'eslint-plugin-react-native/lib/util/variable.js' { 79 | declare module.exports: $Exports<'eslint-plugin-react-native/lib/util/variable'>; 80 | } 81 | -------------------------------------------------------------------------------- /flow-typed/npm/flow-bin_v0.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 6a5610678d4b01e13bbfbbc62bdaf583 2 | // flow-typed version: 3817bc6980/flow-bin_v0.x.x/flow_>=v0.25.x 3 | 4 | declare module "flow-bin" { 5 | declare module.exports: string; 6 | } 7 | -------------------------------------------------------------------------------- /flow-typed/npm/prettier_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 0f5119036cb66fa05663802fe9cea401 2 | // flow-typed version: <>/prettier_v^1.3.1/flow_v0.42.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'prettier' 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' { 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/bin/prettier' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'prettier/docs/prettier.min' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'prettier/docs/rollup.config' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'prettier/scripts/sync-flow-tests' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'prettier/src/ast-types' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'prettier/src/comments' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'prettier/src/deprecated' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'prettier/src/doc-builders' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'prettier/src/doc-debug' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'prettier/src/doc-printer' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'prettier/src/doc-utils' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module 'prettier/src/fast-path' { 70 | declare module.exports: any; 71 | } 72 | 73 | declare module 'prettier/src/options' { 74 | declare module.exports: any; 75 | } 76 | 77 | declare module 'prettier/src/parser' { 78 | declare module.exports: any; 79 | } 80 | 81 | declare module 'prettier/src/printer' { 82 | declare module.exports: any; 83 | } 84 | 85 | declare module 'prettier/src/typescript-ast-nodes' { 86 | declare module.exports: any; 87 | } 88 | 89 | declare module 'prettier/src/util' { 90 | declare module.exports: any; 91 | } 92 | 93 | declare module 'prettier/test' { 94 | declare module.exports: any; 95 | } 96 | 97 | // Filename aliases 98 | declare module 'prettier/bin/prettier.js' { 99 | declare module.exports: $Exports<'prettier/bin/prettier'>; 100 | } 101 | declare module 'prettier/docs/prettier.min.js' { 102 | declare module.exports: $Exports<'prettier/docs/prettier.min'>; 103 | } 104 | declare module 'prettier/docs/rollup.config.js' { 105 | declare module.exports: $Exports<'prettier/docs/rollup.config'>; 106 | } 107 | declare module 'prettier/index' { 108 | declare module.exports: $Exports<'prettier'>; 109 | } 110 | declare module 'prettier/index.js' { 111 | declare module.exports: $Exports<'prettier'>; 112 | } 113 | declare module 'prettier/scripts/sync-flow-tests.js' { 114 | declare module.exports: $Exports<'prettier/scripts/sync-flow-tests'>; 115 | } 116 | declare module 'prettier/src/ast-types.js' { 117 | declare module.exports: $Exports<'prettier/src/ast-types'>; 118 | } 119 | declare module 'prettier/src/comments.js' { 120 | declare module.exports: $Exports<'prettier/src/comments'>; 121 | } 122 | declare module 'prettier/src/deprecated.js' { 123 | declare module.exports: $Exports<'prettier/src/deprecated'>; 124 | } 125 | declare module 'prettier/src/doc-builders.js' { 126 | declare module.exports: $Exports<'prettier/src/doc-builders'>; 127 | } 128 | declare module 'prettier/src/doc-debug.js' { 129 | declare module.exports: $Exports<'prettier/src/doc-debug'>; 130 | } 131 | declare module 'prettier/src/doc-printer.js' { 132 | declare module.exports: $Exports<'prettier/src/doc-printer'>; 133 | } 134 | declare module 'prettier/src/doc-utils.js' { 135 | declare module.exports: $Exports<'prettier/src/doc-utils'>; 136 | } 137 | declare module 'prettier/src/fast-path.js' { 138 | declare module.exports: $Exports<'prettier/src/fast-path'>; 139 | } 140 | declare module 'prettier/src/options.js' { 141 | declare module.exports: $Exports<'prettier/src/options'>; 142 | } 143 | declare module 'prettier/src/parser.js' { 144 | declare module.exports: $Exports<'prettier/src/parser'>; 145 | } 146 | declare module 'prettier/src/printer.js' { 147 | declare module.exports: $Exports<'prettier/src/printer'>; 148 | } 149 | declare module 'prettier/src/typescript-ast-nodes.js' { 150 | declare module.exports: $Exports<'prettier/src/typescript-ast-nodes'>; 151 | } 152 | declare module 'prettier/src/util.js' { 153 | declare module.exports: $Exports<'prettier/src/util'>; 154 | } 155 | declare module 'prettier/test.js' { 156 | declare module.exports: $Exports<'prettier/test'>; 157 | } 158 | -------------------------------------------------------------------------------- /ios/RNTodayWidgetExtension.xcodeproj/xcshareddata/xcschemes/TodayWidgetExtension.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 6 | 9 | 10 | 16 | 22 | 23 | 24 | 25 | 26 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 55 | 57 | 63 | 64 | 65 | 66 | 67 | 68 | 75 | 76 | 82 | 83 | 84 | 85 | 87 | 88 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /ios/TodayWidgetExtension/DisplayMode.h: -------------------------------------------------------------------------------- 1 | // 2 | // DisplayMode.h 3 | // RNTodayWidgetExtension 4 | // 5 | // Created by Matej Kriz on 07.06.17. 6 | // Copyright © 2017 Facebook. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface DisplayMode : NSObject 13 | 14 | - (id)initWithContext:(NSExtensionContext*)context; 15 | 16 | + (float)getMaxHeight; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /ios/TodayWidgetExtension/DisplayMode.m: -------------------------------------------------------------------------------- 1 | // 2 | // DisplayMode.m 3 | // RNTodayWidgetExtension 4 | // 5 | // Created by Matej Kriz on 07.06.17. 6 | // Copyright © 2017 Facebook. All rights reserved. 7 | // 8 | 9 | #import "DisplayMode.h" 10 | 11 | #import 12 | #import 13 | 14 | @implementation DisplayMode 15 | 16 | static float maxHeight = 110; 17 | 18 | NSExtensionContext* extensionContext; 19 | 20 | // To export a module named DisplayMode 21 | RCT_EXPORT_MODULE(); 22 | 23 | - (id)initWithContext:(NSExtensionContext*)context { 24 | self = [super init]; 25 | extensionContext = context; 26 | return self; 27 | } 28 | 29 | + (float)getMaxHeight { 30 | return maxHeight; 31 | } 32 | 33 | RCT_EXPORT_METHOD(setExpandable:(BOOL)expandable height:(float)height ) 34 | { 35 | maxHeight = height; 36 | if (expandable) { 37 | [extensionContext setWidgetLargestAvailableDisplayMode:NCWidgetDisplayModeExpanded]; 38 | } else { 39 | [extensionContext setWidgetLargestAvailableDisplayMode:NCWidgetDisplayModeCompact]; 40 | } 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /ios/TodayWidgetExtension/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSAppTransportSecurity 6 | 7 | NSAllowsArbitraryLoads 8 | 9 | 10 | CFBundleDevelopmentRegion 11 | en 12 | CFBundleDisplayName 13 | TodayWidgetExtension 14 | CFBundleExecutable 15 | $(EXECUTABLE_NAME) 16 | CFBundleIdentifier 17 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier).TodayWidgetExtension 18 | CFBundleInfoDictionaryVersion 19 | 6.0 20 | CFBundleName 21 | $(PRODUCT_NAME) 22 | CFBundlePackageType 23 | XPC! 24 | CFBundleShortVersionString 25 | 1.0 26 | CFBundleVersion 27 | 1 28 | NSExtension 29 | 30 | NSExtensionPrincipalClass 31 | TodayViewController 32 | NSExtensionPointIdentifier 33 | com.apple.widget-extension 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /ios/TodayWidgetExtension/Linking.h: -------------------------------------------------------------------------------- 1 | // 2 | // DisplayMode.h 3 | // RNTodayWidgetExtension 4 | // 5 | // Created by Matej Kriz on 07.06.17. 6 | // Copyright © 2017 Facebook. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface Linking : NSObject 13 | 14 | - (id)initWithContext:(NSExtensionContext*)context; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ios/TodayWidgetExtension/Linking.m: -------------------------------------------------------------------------------- 1 | // 2 | // DisplayMode.m 3 | // RNTodayWidgetExtension 4 | // 5 | // Created by Matej Kriz on 07.06.17. 6 | // Copyright © 2017 Facebook. All rights reserved. 7 | // 8 | 9 | #import "Linking.h" 10 | 11 | #import 12 | #import 13 | 14 | @implementation Linking 15 | 16 | NSExtensionContext* widgetContext; 17 | 18 | // To export a module named Linking 19 | RCT_EXPORT_MODULE(); 20 | 21 | - (id)initWithContext:(NSExtensionContext*)context { 22 | self = [super init]; 23 | widgetContext = context; 24 | return self; 25 | } 26 | 27 | RCT_EXPORT_METHOD(openURL:(NSURL *)url ) 28 | { 29 | [widgetContext openURL:url completionHandler:nil]; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /ios/TodayWidgetExtension/TodayViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TodayViewController.h 3 | // TodayWidgetExtension 4 | // 5 | // Created by Matej Kriz on 21.05.17. 6 | // Copyright © 2017 Facebook. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TodayViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ios/TodayWidgetExtension/TodayViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TodayViewController.m 3 | // TodayWidgetExtension 4 | // 5 | // Created by Matej Kriz on 21.05.17. 6 | // Copyright © 2017 Facebook. All rights reserved. 7 | // 8 | 9 | #import "TodayViewController.h" 10 | 11 | #import 12 | #import 13 | #import 14 | 15 | #import "DisplayMode.h" 16 | #import "Linking.h" 17 | 18 | 19 | DisplayMode* displayMode; 20 | Linking* linking; 21 | 22 | @interface TodayViewController () 23 | 24 | @end 25 | 26 | @implementation TodayViewController 27 | 28 | - (void)loadView { 29 | 30 | NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.widget" fallbackResource:nil]; 31 | 32 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 33 | moduleName:@"TodayWidgetExtension" 34 | initialProperties:nil 35 | launchOptions:nil]; 36 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1 green:1 blue:1 alpha:0]; 37 | self.view = rootView; 38 | 39 | displayMode = [[DisplayMode alloc]initWithContext:self.extensionContext]; 40 | linking = [[Linking alloc]initWithContext:self.extensionContext]; 41 | } 42 | 43 | - (void)widgetActiveDisplayModeDidChange:(NCWidgetDisplayMode)activeDisplayMode withMaximumSize:(CGSize)maxSize{ 44 | if (activeDisplayMode == NCWidgetDisplayModeCompact){ 45 | self.preferredContentSize = maxSize; 46 | } 47 | else if (activeDisplayMode == NCWidgetDisplayModeExpanded){ 48 | self.preferredContentSize = CGSizeMake(maxSize.width, [DisplayMode getMaxHeight]); 49 | } 50 | } 51 | 52 | - (void)viewDidLoad { 53 | [super viewDidLoad]; 54 | // Do any additional setup after loading the view from its nib. 55 | 56 | // This is required in order for there to be space for 57 | // the React Native stuff to show up 58 | [self setPreferredContentSize:CGSizeMake(0, 200)]; 59 | } 60 | 61 | - (void)didReceiveMemoryWarning { 62 | [super didReceiveMemoryWarning]; 63 | // Dispose of any resources that can be recreated. 64 | } 65 | 66 | - (void)widgetPerformUpdateWithCompletionHandler:(void (^)(NCUpdateResult))completionHandler { 67 | // Perform any setup necessary in order to update the view. 68 | 69 | // If an error is encountered, use NCUpdateResultFailed 70 | // If there's no update required, use NCUpdateResultNoData 71 | // If there's an update, use NCUpdateResultNewData 72 | 73 | completionHandler(NCUpdateResultNewData); 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /lib/DevMenu/TextButton.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import React from 'react'; 3 | import { StyleSheet, TouchableOpacity, Text } from 'react-native'; 4 | 5 | type TextButtonProps = { 6 | onPress: () => void, 7 | title: string, 8 | }; 9 | 10 | const TextButton = ({ onPress, title }: TextButtonProps) => ( 11 | 12 | {title} 13 | 14 | ); 15 | 16 | const styles = StyleSheet.create({ 17 | container: { 18 | backgroundColor: 'white', 19 | flex: 1, 20 | height: 40, 21 | justifyContent: 'center', 22 | marginHorizontal: 2, 23 | opacity: 0.5, 24 | }, 25 | text: { 26 | alignItems: 'center', 27 | color: 'black', 28 | fontSize: 11, 29 | paddingHorizontal: 2, 30 | textAlign: 'center', 31 | }, 32 | }); 33 | 34 | export default TextButton; 35 | -------------------------------------------------------------------------------- /lib/DevMenu/index.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import * as React from 'react'; 3 | import { 4 | TouchableOpacity, 5 | NativeModules, 6 | StyleSheet, 7 | Text, 8 | View, 9 | } from 'react-native'; 10 | import TextButton from './TextButton'; 11 | import type { StyleObj } from 'react-native/Libraries/StyleSheet/StyleSheetTypes'; 12 | 13 | type DevMenuProps = { 14 | children?: React.Node, 15 | style?: StyleObj, 16 | title?: string, 17 | }; 18 | 19 | type DevMenuState = { 20 | isDebuggingRemotely: boolean, 21 | isOpen: boolean, 22 | }; 23 | 24 | const isDebuggingRemotelyActive = () => typeof importScripts === 'function'; 25 | 26 | class DevMenu extends React.Component { 27 | constructor(props: DevMenuProps) { 28 | super(props); 29 | 30 | this.state = { 31 | isDebuggingRemotely: isDebuggingRemotelyActive(), 32 | isOpen: false, 33 | }; 34 | } 35 | 36 | componentDidUpdate(prevProps: DevMenuProps, prevState: DevMenuState) { 37 | const { isDebuggingRemotely } = this.state; 38 | if (isDebuggingRemotely !== prevState.isDebuggingRemotely) { 39 | NativeModules.DevSettings.setIsDebuggingRemotely(isDebuggingRemotely); 40 | } 41 | } 42 | 43 | render() { 44 | const { children, style, title } = this.props; 45 | const { isDebuggingRemotely, isOpen } = this.state; 46 | const { DevSettings } = NativeModules; 47 | return ( 48 | 49 | this.setState({ isOpen: !isOpen })} 52 | > 53 | {children || {title || 'DM'}} 54 | 55 | {isOpen && ( 56 | 57 | DevSettings.reload()} /> 58 | 61 | this.setState({ isDebuggingRemotely: !isDebuggingRemotely }) 62 | } 63 | /> 64 | DevSettings.setLiveReloadEnabled(true)} 67 | /> 68 | DevSettings.setLiveReloadEnabled(false)} 71 | /> 72 | DevSettings.setHotLoadingEnabled(true)} 75 | /> 76 | DevSettings.setHotLoadingEnabled(false)} 79 | /> 80 | 81 | )} 82 | 83 | ); 84 | } 85 | } 86 | 87 | const styles = StyleSheet.create({ 88 | button: { 89 | padding: 2, 90 | }, 91 | buttonText: { 92 | opacity: 0.5, 93 | }, 94 | container: { 95 | flex: 1, 96 | left: 0, 97 | position: 'absolute', 98 | top: 0, 99 | }, 100 | containerInner: { 101 | alignItems: 'flex-start', 102 | flex: 1, 103 | flexDirection: 'row', 104 | left: 30, 105 | position: 'absolute', 106 | top: 0, 107 | width: 300, 108 | }, 109 | }); 110 | 111 | export default DevMenu; 112 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | import { NativeModules } from 'react-native'; 3 | import DevMenuComponent from './DevMenu'; 4 | 5 | export const DevMenu = DevMenuComponent; 6 | 7 | export const setExpandable = ( 8 | expandable: boolean = true, 9 | maxHeight: number = 110, 10 | ) => { 11 | if (NativeModules && NativeModules.DisplayMode) { 12 | NativeModules.DisplayMode.setExpandable(expandable, maxHeight); 13 | } 14 | }; 15 | 16 | export const openURL = (url: string) => { 17 | NativeModules.Linking.openURL(url); 18 | }; 19 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-today-widget", 3 | "description": "Today Widget extension (iOS) development using React Native", 4 | "version": "1.0.0", 5 | "author": "Matěj Kříž ", 6 | "license": "Unlicense", 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/matejkriz/react-native-today-widget" 10 | }, 11 | "keywords": [ 12 | "react-native", 13 | "today widget", 14 | "ios", 15 | "extension" 16 | ], 17 | "main": "lib/index.js", 18 | "bin": { 19 | "bundle-id": "./bin/setBundleId.rb", 20 | "embed-extension": "./bin/embedExtension.rb" 21 | }, 22 | "scripts": { 23 | "flow": "flow", 24 | "postinstall": "./bin/setBundleId.rb", 25 | "prettier": "prettier --bracket-spacing --single-quote --tab-width 2 --trailing-comma es5 --parser babylon --print-width 80 --write \"{{components,lib,pages,scripts,themes},__{tests,mocks}__}/**/*.js\"", 26 | "start": "node node_modules/react-native/local-cli/cli.js start", 27 | "test": "jest" 28 | }, 29 | "dependencies": {}, 30 | "devDependencies": { 31 | "babel-eslint": "^7.2.3", 32 | "babel-jest": "20.0.3", 33 | "babel-preset-react-native": "1.9.2", 34 | "eslint": "^3.19.0", 35 | "eslint-config-airbnb": "^15.0.1", 36 | "eslint-plugin-import": "^2.2.0", 37 | "eslint-plugin-jsx-a11y": "^5.0.3", 38 | "eslint-plugin-react": "^7.0.1", 39 | "eslint-plugin-react-native": "^2.3.2", 40 | "flow-bin": "0.42.0", 41 | "jest": "20.0.3", 42 | "prettier": "^1.3.1", 43 | "react": "16.0.0-beta.5", 44 | "react-native": "0.49", 45 | "react-test-renderer": "16.0.0-alpha.6" 46 | }, 47 | "jest": { 48 | "preset": "react-native" 49 | }, 50 | "peerDependencies": { 51 | "react": ">=16.0.0-alpha.12", 52 | "react-native": ">=0.49.0" 53 | }, 54 | "rnpm": { 55 | "commands": { 56 | "postlink": "./node_modules/.bin/embed-extension" 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /screenshots/complex_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/screenshots/complex_example.png -------------------------------------------------------------------------------- /screenshots/developer_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matejkriz/react-native-today-widget/c17e58d6e98ff38275044b41000b00f9245a7fba/screenshots/developer_menu.png --------------------------------------------------------------------------------