├── packages ├── taro-cli │ ├── .npmignore │ ├── .npmrc │ ├── templates │ │ └── default │ │ │ ├── src │ │ │ ├── app.css │ │ │ └── pages │ │ │ │ └── index │ │ │ │ └── index.css │ │ │ ├── config │ │ │ ├── dev.js │ │ │ └── prod.js │ │ │ ├── project.config.json │ │ │ └── global.d.ts │ ├── .gitignore │ ├── global.d.ts │ ├── index.js │ ├── src │ │ ├── config │ │ │ ├── rn-stylelint.json │ │ │ ├── browser_list.ts │ │ │ ├── index.ts │ │ │ ├── babylon.ts │ │ │ └── babel.ts │ │ ├── doctor │ │ │ ├── interface.ts │ │ │ ├── index.ts │ │ │ └── validatorEslintrc.ts │ │ ├── rn │ │ │ └── StyleSheet │ │ │ │ └── index.ts │ │ ├── jdreact │ │ │ ├── template │ │ │ │ └── JDReact.version │ │ │ └── test.js │ │ ├── presets │ │ │ └── commands │ │ │ │ └── convert.ts │ │ ├── commands │ │ │ ├── convert.ts │ │ │ ├── doctor.ts │ │ │ ├── info.ts │ │ │ ├── update.ts │ │ │ ├── config.ts │ │ │ └── create.ts │ │ └── index.ts │ ├── bin │ │ └── taro │ ├── .babelrc │ ├── __tests__ │ │ └── mocks │ │ │ └── config │ │ │ ├── dev.js │ │ │ └── prod.js │ └── jest.config.js ├── taro-h5 │ ├── README.md │ ├── __mocks__ │ │ ├── styleMock.js │ │ └── fileMock.js │ ├── src │ │ ├── api │ │ │ ├── customComponent │ │ │ │ └── index.js │ │ │ ├── privateApis │ │ │ │ └── index.js │ │ │ ├── image │ │ │ │ ├── react-wx-images-viewer │ │ │ │ │ ├── index.js │ │ │ │ │ └── components │ │ │ │ │ │ └── Loading.js │ │ │ │ └── index.js │ │ │ ├── fileTransfer │ │ │ │ └── index.js │ │ │ ├── open │ │ │ │ └── index.js │ │ │ ├── location │ │ │ │ └── index.js │ │ │ ├── canvas │ │ │ │ └── index.js │ │ │ └── system │ │ │ │ └── index.js │ │ ├── index.js │ │ └── index.cjs.js │ ├── types │ │ └── index.d.ts │ ├── babel.config.js │ ├── jest.config.js │ └── build │ │ └── rollup-plugin-export-name-only.js ├── taro │ ├── .gitignore │ ├── README.md │ ├── src │ │ ├── render.js │ │ ├── component.js │ │ ├── current.js │ │ ├── memo.js │ │ └── internal │ │ │ └── get-original.js │ ├── index.js │ ├── tsconfig.json │ └── types │ │ └── api │ │ ├── base │ │ └── env.d.ts │ │ └── alipay │ │ └── index.d.ts ├── taro-loader │ └── .gitignore ├── taro-router │ ├── .eslintignore │ ├── index.js │ ├── .prettierrc │ ├── src │ │ ├── index.tsx │ │ └── utils │ │ │ └── index.ts │ └── jest.config.js ├── taro-components-qa │ ├── index.js │ └── package.json ├── taro-components-rn │ ├── .watchmanconfig │ ├── TCRNExample │ │ ├── .watchmanconfig │ │ ├── .gitattributes │ │ ├── .babelrc │ │ ├── app.json │ │ ├── example │ │ │ ├── jdlogo.png │ │ │ └── EXWebView.js │ │ ├── index.js │ │ └── .buckconfig │ ├── __tests__ │ │ ├── 1x1.png │ │ └── view.spec.tsx │ ├── src │ │ ├── assets │ │ │ ├── loading.png │ │ │ ├── thumb.png │ │ │ ├── icons │ │ │ │ ├── back.png │ │ │ │ ├── cancel.png │ │ │ │ ├── circle.png │ │ │ │ ├── clear.png │ │ │ │ ├── delete.png │ │ │ │ ├── info.png │ │ │ │ ├── search.png │ │ │ │ ├── warn.png │ │ │ │ ├── download.png │ │ │ │ ├── success.png │ │ │ │ ├── waiting.png │ │ │ │ ├── info_circle.png │ │ │ │ ├── safe_warn.png │ │ │ │ ├── safe_success.png │ │ │ │ ├── success_circle.png │ │ │ │ ├── waiting_circle.png │ │ │ │ └── success_no_circle.png │ │ │ └── loading-warn.png │ │ ├── components │ │ │ ├── Label │ │ │ │ └── PropsType.tsx │ │ │ ├── View │ │ │ │ └── PropsType.tsx │ │ │ ├── Swiper │ │ │ │ └── styles.tsx │ │ │ ├── Textarea │ │ │ │ └── PropsType.tsx │ │ │ ├── Text │ │ │ │ └── PropsType.tsx │ │ │ ├── Slider │ │ │ │ └── styles.tsx │ │ │ ├── Progress │ │ │ │ ├── styles.tsx │ │ │ │ └── PropsType.tsx │ │ │ ├── Block │ │ │ │ └── index.tsx │ │ │ ├── RichText │ │ │ │ └── PropsType.tsx │ │ │ ├── Icon │ │ │ │ └── PropsType.tsx │ │ │ ├── Switch │ │ │ │ └── PropsType.tsx │ │ │ ├── Form │ │ │ │ └── PropsType.tsx │ │ │ ├── Checkbox │ │ │ │ └── styles.tsx │ │ │ └── Radio │ │ │ │ └── styles.tsx │ │ ├── lib │ │ │ └── provider │ │ │ │ └── index.tsx │ │ └── types │ │ │ └── definition.d.ts │ ├── .eslintignore │ ├── __mocks__ │ │ └── fileMock.js │ ├── .editorconfig │ ├── .gitignore │ ├── CHANGELOG.md │ └── .eslintrc.js ├── taroize │ ├── .eslintignore │ ├── .gitignore │ ├── index.js │ ├── tslint.json │ └── src │ │ ├── json.ts │ │ ├── cache.ts │ │ └── global.ts ├── taro-redux-h5 │ ├── .eslintignore │ ├── src │ │ ├── invariant.js │ │ ├── index.js │ │ └── prop-types.js │ ├── .gitignore │ └── react-redux │ │ ├── utils │ │ ├── wrapActionCreators.js │ │ ├── verifyPlainObject.js │ │ ├── tryToCall.js │ │ ├── isPlainObject.js │ │ └── PropTypes.js │ │ └── index.js ├── taro-components │ ├── .eslintignore │ ├── __mocks__ │ │ └── styleMock.js │ ├── src │ │ └── components │ │ │ ├── navigator │ │ │ └── navigator.css │ │ │ ├── picker │ │ │ ├── style │ │ │ │ └── index.scss │ │ │ └── constant.js │ │ │ ├── audio │ │ │ └── style │ │ │ │ └── index.scss │ │ │ ├── canvas │ │ │ └── style │ │ │ │ └── index.css │ │ │ ├── video │ │ │ ├── images │ │ │ │ ├── full.png │ │ │ │ ├── mute.png │ │ │ │ ├── pause.png │ │ │ │ ├── play.png │ │ │ │ ├── shrink.png │ │ │ │ ├── unmute.png │ │ │ │ └── volume.png │ │ │ └── utils.js │ │ │ ├── input │ │ │ └── index.scss │ │ │ ├── view │ │ │ └── style │ │ │ │ └── index.scss │ │ │ ├── web-view │ │ │ └── style │ │ │ │ └── index.scss │ │ │ ├── rich-text │ │ │ └── index.md │ │ │ ├── swiper │ │ │ └── style │ │ │ │ └── index.scss │ │ │ ├── block │ │ │ └── index.js │ │ │ ├── text │ │ │ ├── index.md │ │ │ ├── style │ │ │ │ └── index.scss │ │ │ └── __test__ │ │ │ │ └── text.test.js │ │ │ ├── camera │ │ │ └── index.js │ │ │ ├── label │ │ │ ├── index.js │ │ │ └── __test__ │ │ │ │ └── label.test.js │ │ │ ├── open-data │ │ │ └── index.js │ │ │ ├── picker-view │ │ │ └── index.js │ │ │ ├── scroll-view │ │ │ └── style │ │ │ │ └── index.scss │ │ │ ├── picker-view-column │ │ │ └── index.js │ │ │ ├── switch │ │ │ ├── index.md │ │ │ └── __test__ │ │ │ │ └── switch.test.js │ │ │ ├── textarea │ │ │ └── __test__ │ │ │ │ └── textarea.test.js │ │ │ ├── tabbar │ │ │ ├── panel.js │ │ │ └── container.js │ │ │ ├── checkbox │ │ │ └── __test__ │ │ │ │ └── checkbox.test.js │ │ │ ├── radio │ │ │ └── __test__ │ │ │ │ └── radio.test.js │ │ │ └── progress │ │ │ └── __test__ │ │ │ └── progress.test.js │ ├── types │ │ ├── Block.d.ts │ │ └── PickerViewColumn.d.ts │ ├── .gitignore │ ├── index.html │ ├── CHANGELOG.md │ └── .eslintrc.js ├── taro-rn-runner │ ├── src │ │ ├── config │ │ │ ├── uglify.ts │ │ │ ├── rn-stylelint.json │ │ │ ├── index.ts │ │ │ ├── babylon.ts │ │ │ └── babel_bak.ts │ │ ├── style │ │ │ └── StyleSheet │ │ │ │ └── index.ts │ │ ├── plugins │ │ │ └── TaroNormalModule.ts │ │ └── loaders │ │ │ └── utils │ │ │ └── config.ts │ ├── global.d.ts │ └── index.js ├── taro-with-weapp │ ├── .gitignore │ ├── index.js │ ├── tslint.json │ └── __tests__ │ │ └── utils.js ├── taro-jd │ ├── README.md │ ├── index.js │ └── src │ │ ├── next-tick.js │ │ ├── data-cache.js │ │ └── pure-component.js ├── taro-mini-runner │ ├── src │ │ ├── config │ │ │ ├── uglify.ts │ │ │ ├── browser_list.ts │ │ │ ├── index.ts │ │ │ ├── babylon.ts │ │ │ └── babel.ts │ │ ├── quickapp │ │ │ ├── style │ │ │ │ └── declaration │ │ │ │ │ ├── color │ │ │ │ │ └── index.ts │ │ │ │ │ ├── visibility │ │ │ │ │ └── index.ts │ │ │ │ │ ├── list │ │ │ │ │ └── index.ts │ │ │ │ │ ├── transition │ │ │ │ │ └── index.ts │ │ │ │ │ ├── margin │ │ │ │ │ └── index.ts │ │ │ │ │ ├── padding │ │ │ │ │ └── index.ts │ │ │ │ │ └── transform │ │ │ │ │ └── transform.ts │ │ │ ├── template │ │ │ │ ├── tag │ │ │ │ │ ├── taro-map │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── taro-image │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── taro-input │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── taro-label │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── taro-video │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── taro-camera │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── taro-canvas │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── taro-picker │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── taro-textarea │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── span │ │ │ │ │ │ └── index.ts │ │ │ │ │ └── text │ │ │ │ │ │ └── index.ts │ │ │ │ └── constant.ts │ │ │ └── template-rewriter.ts │ │ ├── loaders │ │ │ └── quickappStyleLoader.ts │ │ └── plugins │ │ │ └── TaroNormalModule.ts │ ├── jest.config.js │ └── index.js ├── taro-qq │ ├── README.md │ ├── index.js │ └── src │ │ ├── next-tick.js │ │ ├── data-cache.js │ │ └── pure-component.js ├── taro-quickapp │ ├── __mocks__ │ │ └── @system │ │ │ ├── audio.js │ │ │ ├── barcode.js │ │ │ ├── contact.js │ │ │ ├── device.js │ │ │ ├── fetch.js │ │ │ ├── prompt.js │ │ │ ├── record.js │ │ │ ├── request.js │ │ │ ├── router.js │ │ │ ├── sensor.js │ │ │ ├── share.js │ │ │ ├── sms.js │ │ │ ├── storage.js │ │ │ ├── webview.js │ │ │ ├── clipboard.js │ │ │ ├── geolocation.js │ │ │ ├── notification.js │ │ │ └── vibrator.js │ ├── __test__ │ │ └── api.test.js │ ├── README.md │ ├── index.js │ ├── src │ │ ├── global.js │ │ ├── next-tick.js │ │ ├── api │ │ │ ├── webview │ │ │ │ └── index.js │ │ │ ├── index.test.js │ │ │ └── index.js │ │ ├── pure-component.js │ │ └── data-cache.js │ ├── babel.config.js │ └── jest.config.js ├── taro-weapp │ ├── README.md │ ├── index.js │ └── src │ │ ├── next-tick.js │ │ ├── data-cache.js │ │ └── pure-component.js ├── taro-swan │ ├── README.md │ ├── index.js │ └── src │ │ ├── next-tick.js │ │ ├── data-cache.js │ │ └── pure-component.js ├── taro-tt │ ├── README.md │ ├── index.js │ └── src │ │ ├── next-tick.js │ │ ├── data-cache.js │ │ └── pure-component.js ├── taro-alipay │ ├── README.md │ ├── index.js │ └── src │ │ ├── next-tick.js │ │ ├── data-cache.js │ │ └── pure-component.js ├── taro-async-await │ ├── README.md │ └── index.js ├── taro-redux │ ├── src │ │ ├── connect │ │ │ └── Provider.js │ │ ├── hooks │ │ │ ├── context.js │ │ │ └── use-store.js │ │ └── utils │ │ │ ├── batch.js │ │ │ └── index.js │ ├── index.js │ ├── jest.config.js │ └── .babelrc ├── taro-transformer-wx │ ├── .eslintignore │ ├── README.md │ ├── src │ │ ├── env.ts │ │ └── interface.d.ts │ ├── index.js │ ├── .gitignore │ └── tslint.json ├── css-to-react-native │ ├── .babelrc │ ├── src │ │ ├── utils │ │ │ ├── allEqual.js │ │ │ └── values.js │ │ ├── transforms │ │ │ ├── rem.js │ │ │ └── media-queries │ │ │ │ └── features.js │ │ └── css-to-react-native │ │ │ └── transforms │ │ │ ├── textShadow.js │ │ │ ├── boxShadow.js │ │ │ └── textDecorationLine.js │ └── index.d.ts ├── postcss-unit-transform │ ├── README.md │ ├── package.json │ └── index.js ├── postcss-pxtransform │ ├── .gitignore │ ├── CHANGELOG.md │ ├── .npmignore │ ├── .travis.yml │ └── lib │ │ └── pixel-unit-regex.js ├── taro-rn │ ├── src │ │ ├── api │ │ │ ├── Mask │ │ │ │ └── index.ts │ │ │ ├── image │ │ │ │ └── index.ts │ │ │ ├── interface │ │ │ │ ├── loading.png │ │ │ │ ├── success.png │ │ │ │ └── index.ts │ │ │ ├── accelerometer │ │ │ │ └── index.js │ │ │ ├── Popup │ │ │ │ └── index.ts │ │ │ ├── Dialog │ │ │ │ └── variable.ts │ │ │ └── others │ │ │ │ └── index.ts │ │ ├── __tests__ │ │ │ └── __mock__ │ │ │ │ ├── mockVibrate.js │ │ │ │ ├── mockClipboard.js │ │ │ │ ├── mockCameraRoll.js │ │ │ │ └── mockNavigator.js │ │ └── types │ │ │ └── definition.d.ts │ ├── index.js │ ├── example │ │ ├── index.js │ │ └── pages │ │ │ └── media │ │ │ └── Map.js │ ├── .babelrc │ └── gulpfile.js ├── stylelint-taro-rn │ └── src │ │ ├── utils │ │ ├── isString.js │ │ ├── kebabCase.js │ │ ├── endsWith.js │ │ ├── namespace.js │ │ ├── isCustomProperty.js │ │ ├── hasScssInterpolation.js │ │ ├── hasPsvInterpolation.js │ │ ├── isExportBlock.js │ │ ├── hasLessInterpolation.js │ │ └── index.js │ │ ├── index.js │ │ └── rules │ │ └── index.js ├── taro-helper │ ├── jest.config.js │ ├── index.js │ ├── types │ │ └── babelRegister.d.ts │ └── src │ │ ├── babel.ts │ │ └── index.ts ├── taro-service │ ├── jest.config.js │ ├── index.js │ ├── src │ │ └── index.ts │ ├── __test__ │ │ └── test_plugin1.ts │ └── types │ │ ├── Plugin.d.ts │ │ └── Config.d.ts ├── taro-mobx-common │ ├── index.js │ └── src │ │ ├── utils.js │ │ ├── staticRendering.js │ │ ├── reporter.js │ │ └── index.js ├── taro-mobx-h5 │ ├── index.js │ └── src │ │ └── Provider.js ├── taro-mobx │ └── index.js ├── taro-plugin-less │ ├── jest.config.js │ └── index.js ├── taro-plugin-sass │ ├── jest.config.js │ └── index.js ├── taro-plugin-stylus │ ├── jest.config.js │ └── index.js ├── taro-plugin-terser │ ├── jest.config.js │ └── index.js ├── taro-plugin-uglify │ ├── jest.config.js │ └── index.js ├── taro-router-rn │ ├── index.js │ ├── src │ │ └── index.js │ ├── .babelrc │ ├── __tests__ │ │ └── __snapshots__ │ │ │ ├── RefreshProvider.spec.js.snap │ │ │ └── TaroProvider.spec.js.snap │ └── jest.config.js ├── taro-utils │ ├── index.js │ └── package.json ├── taro-webpack-runner │ ├── jest.config.js │ ├── index.js │ ├── CHANGELOG.md │ └── src │ │ └── config │ │ ├── build.conf.ts │ │ └── devServer.conf.ts ├── babel-plugin-transform-taroapi │ ├── jest.config.js │ └── types.d.ts ├── taro-redux-rn │ ├── .babelrc │ └── jest.config.js ├── stylelint-config-taro-rn │ └── screenshots │ │ └── warning.png ├── taro-plugin-csso │ ├── index.js │ └── package.json ├── taro-runner-utils │ ├── __tests__ │ │ └── styles │ │ │ ├── mixins.scss │ │ │ └── variables.scss │ ├── types │ │ └── index.d.ts │ ├── src │ │ └── index.ts │ ├── babel.config.js │ └── jest.config.js ├── babel-plugin-transform-jsx-to-stylesheet │ ├── .babelrc │ └── jest.config.js ├── taro-plugin-typescript │ ├── yarn.lock │ ├── index.js │ └── package.json ├── postcss-plugin-constparse │ └── package.json ├── eslint-config-taro │ ├── index.js │ └── CHANGELOG.md ├── taro-plugin-babel │ ├── index.js │ └── package.json ├── taro-mobx-rn │ ├── src │ │ └── Provider.js │ └── package.json └── eslint-plugin-taro │ ├── CHANGELOG.md │ └── rules │ └── no-ref.js ├── .eslintignore ├── .commitlintrc.js ├── website ├── static │ └── img │ │ ├── favicon.ico │ │ ├── logo-taro.png │ │ ├── o2logo@2x.png │ │ ├── favicon │ │ └── favicon.ico │ │ └── taro-logo-colorful.png └── versioned_docs │ ├── version-2.0.3 │ └── apis │ │ ├── framework │ │ ├── App.md │ │ └── Page.md │ │ ├── canvas │ │ ├── createContext.md │ │ └── drawCanvas.md │ │ ├── device │ │ ├── wifi │ │ │ └── WifiInfo.md │ │ └── ibeacon │ │ │ └── IBeaconInfo.md │ │ └── base │ │ └── env │ │ └── env.md │ ├── version-1.3.23 │ └── apis │ │ ├── alipay │ │ └── getOpenUserInfo.md │ │ ├── ui │ │ ├── interaction │ │ │ ├── hideToast.md │ │ │ └── hideLoading.md │ │ └── navigationbar │ │ │ ├── hideNavigationBarLoading.md │ │ │ └── showNavigationBarLoading.md │ │ ├── canvas │ │ ├── createContext.md │ │ ├── drawCanvas.md │ │ └── createCanvasContext.md │ │ ├── media │ │ └── background-audio │ │ │ ├── onBackgroundAudioPlay.md │ │ │ ├── onBackgroundAudioStop.md │ │ │ └── onBackgroundAudioPause.md │ │ ├── network │ │ └── webSocket │ │ │ ├── closeSocket.md │ │ │ ├── onSocketOpen.md │ │ │ ├── onSocketClose.md │ │ │ ├── onSocketError.md │ │ │ ├── onSocketMessage.md │ │ │ └── sendSocketMessage.md │ │ └── base │ │ └── arrayBufferToBase64.md │ ├── version-2.1.5 │ └── learn.md │ ├── version-1.3.14 │ ├── apis │ │ ├── interface │ │ │ ├── interactives │ │ │ │ ├── hideToast.md │ │ │ │ └── hideLoading.md │ │ │ ├── canvas │ │ │ │ ├── createContext.md │ │ │ │ ├── drawCanvas.md │ │ │ │ └── createCanvasContext.md │ │ │ └── navigationbar │ │ │ │ ├── hideNavigationBarLoading.md │ │ │ │ └── showNavigationBarLoading.md │ │ ├── multimedia │ │ │ └── backgroundaudio │ │ │ │ ├── onBackgroundAudioPlay.md │ │ │ │ ├── onBackgroundAudioStop.md │ │ │ │ └── onBackgroundAudioPause.md │ │ ├── device │ │ │ ├── nfc │ │ │ │ └── onHCEMessage.md │ │ │ ├── wifi │ │ │ │ ├── onGetWifiList.md │ │ │ │ └── onWifiConnected.md │ │ │ ├── ibeacon │ │ │ │ ├── onBeaconUpdate.md │ │ │ │ └── onBeaconServiceChange.md │ │ │ ├── ble │ │ │ │ ├── closeBLEConnection.md │ │ │ │ ├── createBLEConnection.md │ │ │ │ └── getBLEDeviceServices.md │ │ │ └── bluetooth │ │ │ │ ├── getBluetoothDevices.md │ │ │ │ ├── openBluetoothAdapter.md │ │ │ │ ├── closeBluetoothAdapter.md │ │ │ │ └── getBluetoothAdapterState.md │ │ ├── network │ │ │ └── socket │ │ │ │ ├── closeSocket.md │ │ │ │ ├── onSocketOpen.md │ │ │ │ ├── onSocketClose.md │ │ │ │ ├── onSocketError.md │ │ │ │ ├── onSocketMessage.md │ │ │ │ └── sendSocketMessage.md │ │ ├── storage │ │ │ ├── clearStorageSync.md │ │ │ └── clearStorage.md │ │ ├── about │ │ │ └── env.md │ │ ├── extend-apis │ │ │ └── arrayBufferToBase64.md │ │ ├── location │ │ │ └── getLocation.md │ │ └── open-api │ │ │ └── login │ │ │ └── login.md │ ├── hybrid.md │ └── specials.md │ ├── version-1.3.26 │ └── apis │ │ └── device │ │ └── wifi │ │ ├── offGetWifiList.md │ │ └── offWifiConnected.md │ ├── version-2.1.1 │ └── apis │ │ └── framework │ │ └── Page.md │ └── version-1.3.15 │ └── components │ └── open │ └── others.md ├── docs ├── apis │ ├── framework │ │ ├── App.md │ │ └── Page.md │ ├── canvas │ │ ├── createContext.md │ │ ├── drawCanvas.md │ │ └── createOffscreenCanvas.md │ ├── base │ │ └── env │ │ │ └── env.md │ ├── about │ │ └── env.md │ ├── files │ │ └── getFileSystemManager.md │ ├── media │ │ └── video-processing │ │ │ └── createMediaContainer.md │ ├── alipay │ │ └── getOpenUserInfo.md │ └── network │ │ └── udp │ │ └── createUDPSocket.md ├── learn.md ├── hybrid.md ├── specials.md └── components │ └── open │ └── others.md ├── scripts ├── tsconfig.json ├── parser │ └── taro-env.ts └── write.ts ├── .gitignore ├── .editorconfig ├── .travis.yml └── PLANS.md /packages/taro-cli/.npmignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/taro-h5/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/taro/.gitignore: -------------------------------------------------------------------------------- 1 | lib -------------------------------------------------------------------------------- /packages/taro-loader/.gitignore: -------------------------------------------------------------------------------- 1 | lib 2 | -------------------------------------------------------------------------------- /packages/taro-cli/.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | -------------------------------------------------------------------------------- /packages/taro-cli/templates/default/src/app.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/taro-router/.eslintignore: -------------------------------------------------------------------------------- 1 | jest.config.js -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | dist 2 | __tests__ 3 | *.d.ts 4 | -------------------------------------------------------------------------------- /packages/taro-components-qa/index.js: -------------------------------------------------------------------------------- 1 | // 空的占位文件 2 | -------------------------------------------------------------------------------- /packages/taro-components-rn/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /packages/taroize/.eslintignore: -------------------------------------------------------------------------------- 1 | /lib 2 | /index.js 3 | -------------------------------------------------------------------------------- /packages/taro-components-rn/TCRNExample/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /packages/taro-redux-h5/.eslintignore: -------------------------------------------------------------------------------- 1 | lib 2 | node_modules -------------------------------------------------------------------------------- /packages/taro/README.md: -------------------------------------------------------------------------------- 1 | # @tarojs/taro 2 | 多端解决方案基础框架 3 | -------------------------------------------------------------------------------- /packages/taro-cli/templates/default/src/pages/index/index.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/taro-components/.eslintignore: -------------------------------------------------------------------------------- 1 | coverage/ 2 | types/ 3 | -------------------------------------------------------------------------------- /packages/taro-h5/__mocks__/styleMock.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /packages/taroize/.gitignore: -------------------------------------------------------------------------------- 1 | lib 2 | t.js 3 | *.wxml 4 | s.js -------------------------------------------------------------------------------- /packages/taro-redux-h5/src/invariant.js: -------------------------------------------------------------------------------- 1 | export default () => {} 2 | -------------------------------------------------------------------------------- /packages/taro-rn-runner/src/config/uglify.ts: -------------------------------------------------------------------------------- 1 | export default { } 2 | -------------------------------------------------------------------------------- /packages/taro-with-weapp/.gitignore: -------------------------------------------------------------------------------- 1 | .rpt2_cache 2 | lib 3 | t.js 4 | -------------------------------------------------------------------------------- /packages/taro/src/render.js: -------------------------------------------------------------------------------- 1 | export default function render () {} 2 | -------------------------------------------------------------------------------- /packages/taro-components/__mocks__/styleMock.js: -------------------------------------------------------------------------------- 1 | module.exports = {} 2 | -------------------------------------------------------------------------------- /packages/taro-h5/__mocks__/fileMock.js: -------------------------------------------------------------------------------- 1 | module.exports = 'test-file-stub'; -------------------------------------------------------------------------------- /packages/taro-jd/README.md: -------------------------------------------------------------------------------- 1 | # @tarojs/taro-jd 2 | 多端解决方案京东小程序端基础框架 3 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/config/uglify.ts: -------------------------------------------------------------------------------- 1 | export default { } 2 | -------------------------------------------------------------------------------- /packages/taro-qq/README.md: -------------------------------------------------------------------------------- 1 | # @tarojs/taro-qq 2 | 多端解决方案QQ轻应用端基础框架 3 | -------------------------------------------------------------------------------- /packages/taro-quickapp/__mocks__/@system/audio.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /packages/taro-quickapp/__mocks__/@system/barcode.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /packages/taro-quickapp/__mocks__/@system/contact.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /packages/taro-quickapp/__mocks__/@system/device.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /packages/taro-quickapp/__mocks__/@system/fetch.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /packages/taro-quickapp/__mocks__/@system/prompt.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /packages/taro-quickapp/__mocks__/@system/record.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /packages/taro-quickapp/__mocks__/@system/request.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /packages/taro-quickapp/__mocks__/@system/router.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /packages/taro-quickapp/__mocks__/@system/sensor.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /packages/taro-quickapp/__mocks__/@system/share.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /packages/taro-quickapp/__mocks__/@system/sms.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /packages/taro-quickapp/__mocks__/@system/storage.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /packages/taro-quickapp/__mocks__/@system/webview.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /packages/taro-weapp/README.md: -------------------------------------------------------------------------------- 1 | # @tarojs/taro-weapp 2 | 多端解决方案小程序端基础框架 3 | -------------------------------------------------------------------------------- /packages/taro-components-rn/TCRNExample/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /packages/taro-quickapp/__mocks__/@system/clipboard.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /packages/taro-quickapp/__mocks__/@system/geolocation.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /packages/taro-quickapp/__mocks__/@system/notification.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /packages/taro-quickapp/__mocks__/@system/vibrator.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /packages/taro-quickapp/__test__/api.test.js: -------------------------------------------------------------------------------- 1 | test('api test', () => {}) 2 | -------------------------------------------------------------------------------- /packages/taro-swan/README.md: -------------------------------------------------------------------------------- 1 | # @tarojs/taro-swan 2 | 3 | 多端解决方案百度小程序端基础框架 4 | -------------------------------------------------------------------------------- /packages/taro-tt/README.md: -------------------------------------------------------------------------------- 1 | # @tarojs/taro-tt 2 | 3 | 多端解决方案头条小程序端基础框架 4 | -------------------------------------------------------------------------------- /packages/taro-alipay/README.md: -------------------------------------------------------------------------------- 1 | # @tarojs/taro-alipay 2 | 3 | 多端解决方案支付宝小程序端基础框架 4 | -------------------------------------------------------------------------------- /packages/taro-async-await/README.md: -------------------------------------------------------------------------------- 1 | # @tarojs/async-await 2 | 支持async await写法 3 | -------------------------------------------------------------------------------- /packages/taro-redux/src/connect/Provider.js: -------------------------------------------------------------------------------- 1 | export default class Provider {} 2 | -------------------------------------------------------------------------------- /packages/taro-transformer-wx/.eslintignore: -------------------------------------------------------------------------------- 1 | /lib 2 | /node_modules 3 | t.js 4 | tt.js -------------------------------------------------------------------------------- /packages/taroize/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/src/index').parse 2 | -------------------------------------------------------------------------------- /packages/css-to-react-native/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/taro-cli/.gitignore: -------------------------------------------------------------------------------- 1 | templates/* 2 | !templates/default 3 | templates/default/.* -------------------------------------------------------------------------------- /packages/taro-h5/src/api/customComponent/index.js: -------------------------------------------------------------------------------- 1 | export { nextTick } from 'nervjs' 2 | -------------------------------------------------------------------------------- /packages/taro-quickapp/README.md: -------------------------------------------------------------------------------- 1 | # @tarojs/taro-quickapp 2 | 3 | 多端解决方案快应用端基础框架 4 | -------------------------------------------------------------------------------- /packages/postcss-unit-transform/README.md: -------------------------------------------------------------------------------- 1 | # postcss-taro-unit-transform 2 | 3 | 小程序的单位转换 4 | -------------------------------------------------------------------------------- /packages/taro-h5/types/index.d.ts: -------------------------------------------------------------------------------- 1 | import TaroH5 from './type' 2 | 3 | export = TaroH5 4 | -------------------------------------------------------------------------------- /.commitlintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['@commitlint/config-conventional'] 3 | } 4 | -------------------------------------------------------------------------------- /packages/taro-components-rn/TCRNExample/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["react-native"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/taro-transformer-wx/README.md: -------------------------------------------------------------------------------- 1 | # @tarojs/transformer-wx 2 | 3 | 把 JSX 语法转换成可以在小程序运行的字符串模板。 -------------------------------------------------------------------------------- /packages/postcss-pxtransform/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | npm-debug.log 3 | yarn-error.log 4 | .idea -------------------------------------------------------------------------------- /packages/taro-rn/src/api/Mask/index.ts: -------------------------------------------------------------------------------- 1 | import Mask from './Mask' 2 | 3 | export { 4 | Mask 5 | } 6 | -------------------------------------------------------------------------------- /packages/taro-transformer-wx/src/env.ts: -------------------------------------------------------------------------------- 1 | export const isTestEnv = process.env.NODE_ENV === 'test' 2 | -------------------------------------------------------------------------------- /packages/taro-redux-h5/src/index.js: -------------------------------------------------------------------------------- 1 | export { Provider, connect, connectAdvanced } from '../react-redux' 2 | -------------------------------------------------------------------------------- /website/static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/website/static/img/favicon.ico -------------------------------------------------------------------------------- /website/static/img/logo-taro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/website/static/img/logo-taro.png -------------------------------------------------------------------------------- /website/static/img/o2logo@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/website/static/img/o2logo@2x.png -------------------------------------------------------------------------------- /packages/css-to-react-native/src/utils/allEqual.js: -------------------------------------------------------------------------------- 1 | export const allEqual = arr => arr.every(v => v === arr[0]); 2 | -------------------------------------------------------------------------------- /packages/stylelint-taro-rn/src/utils/isString.js: -------------------------------------------------------------------------------- 1 | export const isString = string => typeof string === "string"; 2 | -------------------------------------------------------------------------------- /packages/taro-cli/global.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.json' { 2 | const value: any 3 | export default value 4 | } 5 | -------------------------------------------------------------------------------- /packages/taro-h5/src/api/privateApis/index.js: -------------------------------------------------------------------------------- 1 | export * from './onPageScroll' 2 | export * from './onReachBottom' 3 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/quickapp/style/declaration/color/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'opacity': '' 3 | } 4 | -------------------------------------------------------------------------------- /packages/css-to-react-native/src/utils/values.js: -------------------------------------------------------------------------------- 1 | export const values = obj => Object.keys(obj).map(key => obj[key]); 2 | -------------------------------------------------------------------------------- /packages/taro-components-rn/TCRNExample/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "TCRNExample", 3 | "displayName": "TCRNExample" 4 | } -------------------------------------------------------------------------------- /packages/taro-components/src/components/navigator/navigator.css: -------------------------------------------------------------------------------- 1 | .navigator-hover { 2 | background: #efefef; 3 | } 4 | -------------------------------------------------------------------------------- /packages/taro-helper/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'ts-jest', 3 | testEnvironment: 'node' 4 | } 5 | -------------------------------------------------------------------------------- /packages/taro-rn-runner/global.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.json' { 2 | const value: any 3 | export default value 4 | } 5 | -------------------------------------------------------------------------------- /packages/taro-router/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js') 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-service/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'ts-jest', 3 | testEnvironment: 'node' 4 | } 5 | -------------------------------------------------------------------------------- /packages/taro/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-cli/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-cli/src/config/rn-stylelint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "stylelint-config-taro-rn", 3 | "rules": { 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/picker/style/index.scss: -------------------------------------------------------------------------------- 1 | .weui-picker, .weui-picker__hd{ 2 | font-size: 12px; 3 | } -------------------------------------------------------------------------------- /packages/taro-helper/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports -------------------------------------------------------------------------------- /packages/taro-jd/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'ts-jest', 3 | testEnvironment: 'node' 4 | } 5 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/quickapp/style/declaration/visibility/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'visibility': '' 3 | } 4 | -------------------------------------------------------------------------------- /packages/taro-mobx-common/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js') 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-mobx-h5/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js') 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-mobx/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-plugin-less/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'ts-jest', 3 | testEnvironment: 'node' 4 | } 5 | -------------------------------------------------------------------------------- /packages/taro-plugin-sass/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'ts-jest', 3 | testEnvironment: 'node' 4 | } 5 | -------------------------------------------------------------------------------- /packages/taro-plugin-stylus/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'ts-jest', 3 | testEnvironment: 'node' 4 | } 5 | -------------------------------------------------------------------------------- /packages/taro-plugin-terser/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'ts-jest', 3 | testEnvironment: 'node' 4 | } 5 | -------------------------------------------------------------------------------- /packages/taro-plugin-uglify/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'ts-jest', 3 | testEnvironment: 'node' 4 | } 5 | -------------------------------------------------------------------------------- /packages/taro-qq/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-redux/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-rn/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-router-rn/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js') 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-service/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports -------------------------------------------------------------------------------- /packages/taro-service/src/index.ts: -------------------------------------------------------------------------------- 1 | import Kernel from './Kernel' 2 | 3 | export { Kernel } 4 | export default { Kernel } 5 | -------------------------------------------------------------------------------- /packages/taro-swan/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-tt/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-utils/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-weapp/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-webpack-runner/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'ts-jest', 3 | testEnvironment: 'node' 4 | } 5 | -------------------------------------------------------------------------------- /website/static/img/favicon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/website/static/img/favicon/favicon.ico -------------------------------------------------------------------------------- /packages/postcss-pxtransform/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | This project adheres to [Semantic Versioning](http://semver.org/). 3 | -------------------------------------------------------------------------------- /packages/taro-alipay/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/audio/style/index.scss: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | 3 | audio { 4 | max-width:100%; 5 | } 6 | -------------------------------------------------------------------------------- /packages/taro-h5/src/index.js: -------------------------------------------------------------------------------- 1 | import Taro from './taro/index' 2 | 3 | export * from './api/index' 4 | 5 | export default Taro 6 | -------------------------------------------------------------------------------- /packages/taro-quickapp/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-rn-runner/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-with-weapp/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /website/static/img/taro-logo-colorful.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/website/static/img/taro-logo-colorful.png -------------------------------------------------------------------------------- /packages/babel-plugin-transform-taroapi/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'ts-jest', 3 | testEnvironment: 'node' 4 | } 5 | -------------------------------------------------------------------------------- /packages/taro-cli/src/config/browser_list.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | 'last 3 versions', 3 | 'Android >= 4.1', 4 | 'ios >= 8' 5 | ] 6 | -------------------------------------------------------------------------------- /packages/taro-components-rn/__tests__/1x1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/__tests__/1x1.png -------------------------------------------------------------------------------- /packages/taro-helper/types/babelRegister.d.ts: -------------------------------------------------------------------------------- 1 | export default function createBabelRegister({ only }: { 2 | only: any; 3 | }): void; 4 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-plugin-less/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-plugin-sass/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-plugin-stylus/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-plugin-terser/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-plugin-uglify/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /packages/taro-redux-h5/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | .DS_Store 4 | dist 5 | lib 6 | .nyc_output 7 | coverage 8 | es 9 | -------------------------------------------------------------------------------- /packages/taro-redux/src/hooks/context.js: -------------------------------------------------------------------------------- 1 | import Taro from '@tarojs/taro' 2 | 3 | export const ReduxContext = Taro.createContext(null) 4 | -------------------------------------------------------------------------------- /packages/taro-rn-runner/src/config/rn-stylelint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "stylelint-config-taro-rn", 3 | "rules": { 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/taro-rn/src/__tests__/__mock__/mockVibrate.js: -------------------------------------------------------------------------------- 1 | const Vibration = { 2 | vibrate () {} 3 | } 4 | 5 | export default Vibration 6 | -------------------------------------------------------------------------------- /packages/taro-webpack-runner/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./dist/index.js').default 2 | module.exports.default = module.exports 3 | -------------------------------------------------------------------------------- /docs/apis/framework/App.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: App 3 | sidebar_label: App 4 | --- 5 | 6 | 注册小程序。接受一个 `Object` 参数,其指定小程序的生命周期回调等。 7 | 8 | ## 方法 9 | -------------------------------------------------------------------------------- /packages/taro-redux-rn/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["env", "react"], 3 | "plugins": ["babel-plugin-transform-class-properties"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/taro-rn/src/api/image/index.ts: -------------------------------------------------------------------------------- 1 | export { previewImage } from './previewImage' 2 | // export { chooseImage } from './chooseImage' 3 | -------------------------------------------------------------------------------- /packages/taro-rn/src/api/interface/loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-rn/src/api/interface/loading.png -------------------------------------------------------------------------------- /packages/taro-rn/src/api/interface/success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-rn/src/api/interface/success.png -------------------------------------------------------------------------------- /packages/taro-cli/src/doctor/interface.ts: -------------------------------------------------------------------------------- 1 | export interface IErrorLine { 2 | desc: string, 3 | valid: boolean, 4 | solution?: string 5 | } 6 | -------------------------------------------------------------------------------- /packages/taro-components-rn/src/assets/loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/src/assets/loading.png -------------------------------------------------------------------------------- /packages/taro-components-rn/src/assets/thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/src/assets/thumb.png -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/config/browser_list.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | 'last 3 versions', 3 | 'Android >= 4.1', 4 | 'ios >= 8' 5 | ] 6 | -------------------------------------------------------------------------------- /packages/taro-rn/src/api/accelerometer/index.js: -------------------------------------------------------------------------------- 1 | export { startAccelerometer, stopAccelerometer, onAccelerometerChange } from './accelerometer' 2 | -------------------------------------------------------------------------------- /packages/taro-router-rn/src/index.js: -------------------------------------------------------------------------------- 1 | import {initRouter} from './initRouter' 2 | 3 | export default {initRouter} 4 | 5 | export { initRouter } 6 | -------------------------------------------------------------------------------- /packages/stylelint-taro-rn/src/utils/kebabCase.js: -------------------------------------------------------------------------------- 1 | export const kebabCase = string => 2 | string.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(); 3 | -------------------------------------------------------------------------------- /packages/stylelint-taro-rn/src/utils/endsWith.js: -------------------------------------------------------------------------------- 1 | export const endsWith = (str, suffix) => 2 | str.indexOf(suffix, str.length - suffix.length) !== -1; 3 | -------------------------------------------------------------------------------- /packages/taro-cli/src/rn/StyleSheet/index.ts: -------------------------------------------------------------------------------- 1 | import StyleSheetValidation from './StyleSheetValidation' 2 | 3 | export { 4 | StyleSheetValidation 5 | } 6 | -------------------------------------------------------------------------------- /packages/taro-components-rn/src/assets/icons/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/src/assets/icons/back.png -------------------------------------------------------------------------------- /packages/taro-components-rn/src/assets/icons/cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/src/assets/icons/cancel.png -------------------------------------------------------------------------------- /packages/taro-components-rn/src/assets/icons/circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/src/assets/icons/circle.png -------------------------------------------------------------------------------- /packages/taro-components-rn/src/assets/icons/clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/src/assets/icons/clear.png -------------------------------------------------------------------------------- /packages/taro-components-rn/src/assets/icons/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/src/assets/icons/delete.png -------------------------------------------------------------------------------- /packages/taro-components-rn/src/assets/icons/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/src/assets/icons/info.png -------------------------------------------------------------------------------- /packages/taro-components-rn/src/assets/icons/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/src/assets/icons/search.png -------------------------------------------------------------------------------- /packages/taro-components-rn/src/assets/icons/warn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/src/assets/icons/warn.png -------------------------------------------------------------------------------- /packages/taro-components-rn/src/assets/loading-warn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/src/assets/loading-warn.png -------------------------------------------------------------------------------- /packages/taro-transformer-wx/index.js: -------------------------------------------------------------------------------- 1 | var transform = require('./lib/src').default 2 | module.exports = transform 3 | module.exports.default = transform 4 | -------------------------------------------------------------------------------- /packages/stylelint-config-taro-rn/screenshots/warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/stylelint-config-taro-rn/screenshots/warning.png -------------------------------------------------------------------------------- /packages/taro-components-rn/src/assets/icons/download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/src/assets/icons/download.png -------------------------------------------------------------------------------- /packages/taro-components-rn/src/assets/icons/success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/src/assets/icons/success.png -------------------------------------------------------------------------------- /packages/taro-components-rn/src/assets/icons/waiting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/src/assets/icons/waiting.png -------------------------------------------------------------------------------- /packages/taro-components/src/components/canvas/style/index.css: -------------------------------------------------------------------------------- 1 | .taro-canvas { 2 | position: relative; 3 | width: 300px; 4 | height: 150px; 5 | } 6 | -------------------------------------------------------------------------------- /packages/taro-h5/src/api/image/react-wx-images-viewer/index.js: -------------------------------------------------------------------------------- 1 | import WxImageViewer from './components/WxImageViewer' 2 | 3 | export default WxImageViewer 4 | -------------------------------------------------------------------------------- /packages/taro-components-rn/TCRNExample/example/jdlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/TCRNExample/example/jdlogo.png -------------------------------------------------------------------------------- /packages/taro-components-rn/src/assets/icons/info_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/src/assets/icons/info_circle.png -------------------------------------------------------------------------------- /packages/taro-components-rn/src/assets/icons/safe_warn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/src/assets/icons/safe_warn.png -------------------------------------------------------------------------------- /packages/taro-components/src/components/picker/constant.js: -------------------------------------------------------------------------------- 1 | export const TOP = 102 2 | export const LINE_HEIGHT = 34 3 | export const MASK_HEIGHT = LINE_HEIGHT * 7 4 | -------------------------------------------------------------------------------- /packages/taro-h5/src/api/fileTransfer/index.js: -------------------------------------------------------------------------------- 1 | export { default as downloadFile } from './downloadFile' 2 | export { default as uploadFile } from './uploadFile' 3 | -------------------------------------------------------------------------------- /packages/taro-rn-runner/src/style/StyleSheet/index.ts: -------------------------------------------------------------------------------- 1 | import StyleSheetValidation from './StyleSheetValidation' 2 | 3 | export { 4 | StyleSheetValidation 5 | } 6 | -------------------------------------------------------------------------------- /packages/taro-rn/src/types/definition.d.ts: -------------------------------------------------------------------------------- 1 | interface WebSocket { } 2 | interface TextMetrics { } 3 | interface CanvasGradient { } 4 | interface CanvasGradient { } 5 | -------------------------------------------------------------------------------- /scripts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "module": "umd", 5 | "resolveJsonModule": false 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/stylelint-taro-rn/src/utils/namespace.js: -------------------------------------------------------------------------------- 1 | const prefix = "taro-rn"; 2 | 3 | export function namespace(ruleName) { 4 | return `${prefix}/${ruleName}`; 5 | } 6 | -------------------------------------------------------------------------------- /packages/taro-components-rn/src/assets/icons/safe_success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/src/assets/icons/safe_success.png -------------------------------------------------------------------------------- /packages/taro-components/src/components/video/images/full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components/src/components/video/images/full.png -------------------------------------------------------------------------------- /packages/taro-components/src/components/video/images/mute.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components/src/components/video/images/mute.png -------------------------------------------------------------------------------- /packages/taro-components/src/components/video/images/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components/src/components/video/images/pause.png -------------------------------------------------------------------------------- /packages/taro-components/src/components/video/images/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components/src/components/video/images/play.png -------------------------------------------------------------------------------- /packages/taro-quickapp/src/global.js: -------------------------------------------------------------------------------- 1 | const appGlobal = global || {} 2 | const globalRef = Object.getPrototypeOf(appGlobal) || appGlobal 3 | 4 | export default globalRef 5 | -------------------------------------------------------------------------------- /packages/taro-rn/src/api/Popup/index.ts: -------------------------------------------------------------------------------- 1 | import Popup from './Popup' 2 | import PopupHeader from './PopupHeader' 3 | 4 | export { 5 | Popup, 6 | PopupHeader 7 | } 8 | -------------------------------------------------------------------------------- /packages/taro-router/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 2, 3 | "singleQuote": true, 4 | "jsxSingleQuote": true, 5 | "semi": false, 6 | "printWidth": 80 7 | } 8 | -------------------------------------------------------------------------------- /packages/css-to-react-native/index.d.ts: -------------------------------------------------------------------------------- 1 | export default function transform(css: string, options?: { 2 | parseMediaQueries?: boolean; 3 | }): { [selector: string]: unknown; }; 4 | -------------------------------------------------------------------------------- /packages/taro-cli/bin/taro: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | require('../dist/util').printPkgVersion() 4 | 5 | const CLI = require('../dist/cli').default 6 | new CLI().run() 7 | -------------------------------------------------------------------------------- /packages/taro-components-rn/src/assets/icons/success_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/src/assets/icons/success_circle.png -------------------------------------------------------------------------------- /packages/taro-components-rn/src/assets/icons/waiting_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/src/assets/icons/waiting_circle.png -------------------------------------------------------------------------------- /packages/taro-components/src/components/video/images/shrink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components/src/components/video/images/shrink.png -------------------------------------------------------------------------------- /packages/taro-components/src/components/video/images/unmute.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components/src/components/video/images/unmute.png -------------------------------------------------------------------------------- /packages/taro-components/src/components/video/images/volume.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components/src/components/video/images/volume.png -------------------------------------------------------------------------------- /packages/taro-rn/example/index.js: -------------------------------------------------------------------------------- 1 | import { AppRegistry } from 'react-native' 2 | import App from './pages/home' 3 | 4 | AppRegistry.registerComponent('taro-rn', () => App) 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-taroapi/types.d.ts: -------------------------------------------------------------------------------- 1 | declare module "@tarojs/taro-h5/dist/taroApis" { 2 | export const apis: { 3 | [key: string]: boolean 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/taro-components-rn/src/assets/icons/success_no_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/piscdong/taro/2.x/packages/taro-components-rn/src/assets/icons/success_no_circle.png -------------------------------------------------------------------------------- /packages/postcss-pxtransform/.npmignore: -------------------------------------------------------------------------------- 1 | .npmignore 2 | .gitignore 3 | .editorconfig 4 | 5 | node_modules/ 6 | npm-debug.log 7 | yarn.lock 8 | 9 | *.test.js 10 | .travis.yml 11 | -------------------------------------------------------------------------------- /packages/taro-components-rn/TCRNExample/index.js: -------------------------------------------------------------------------------- 1 | import { AppRegistry } from 'react-native' 2 | import App from './App' 3 | 4 | AppRegistry.registerComponent('TCRNExample', () => App) 5 | -------------------------------------------------------------------------------- /packages/taro-components/types/Block.d.ts: -------------------------------------------------------------------------------- 1 | import { ComponentType } from 'react' 2 | 3 | /** 4 | * @ignore 5 | */ 6 | declare const Block: ComponentType 7 | 8 | export { Block } 9 | -------------------------------------------------------------------------------- /packages/taro-plugin-csso/index.js: -------------------------------------------------------------------------------- 1 | const csso = require('csso') 2 | 3 | module.exports = function minifyCSS (content, file, config) { 4 | return csso.minify(content, config) 5 | } 6 | -------------------------------------------------------------------------------- /packages/taro-rn-runner/src/config/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | OUTPUT_DIR: 'dist', 3 | SOURCE_DIR: 'src', 4 | TEMP_DIR: '.temp', 5 | NPM_DIR: 'npm', 6 | ENTRY: 'app' 7 | } 8 | -------------------------------------------------------------------------------- /packages/taro/src/component.js: -------------------------------------------------------------------------------- 1 | class Component { 2 | constructor (props) { 3 | this.state = {} 4 | this.props = props || {} 5 | } 6 | } 7 | 8 | export default Component 9 | -------------------------------------------------------------------------------- /packages/taro-cli/templates/default/config/dev.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | NODE_ENV: '"development"' 4 | }, 5 | defineConstants: {}, 6 | mini: {}, 7 | h5: {} 8 | } 9 | -------------------------------------------------------------------------------- /packages/taro-components-rn/TCRNExample/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/config/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | OUTPUT_DIR: 'dist', 3 | SOURCE_DIR: 'src', 4 | TEMP_DIR: '.temp', 5 | NPM_DIR: 'npm', 6 | ENTRY: 'app' 7 | } 8 | -------------------------------------------------------------------------------- /packages/taro-runner-utils/__tests__/styles/mixins.scss: -------------------------------------------------------------------------------- 1 | @mixin transform($property) { 2 | -webkit-transform: $property; 3 | -ms-transform: $property; 4 | transform: $property; 5 | } 6 | -------------------------------------------------------------------------------- /packages/postcss-pxtransform/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | cache: yarn 3 | node_js: 4 | - node 5 | - "8" 6 | - "6" 7 | - "4" 8 | install: 9 | - YARN_IGNORE_ENGINES=true yarn 10 | -------------------------------------------------------------------------------- /packages/taro-components-rn/.eslintignore: -------------------------------------------------------------------------------- 1 | coverage/ 2 | regions.js 3 | regions.object.js 4 | regionsFormatter.js 5 | setupTests.js 6 | gulpfile.js 7 | dist/ 8 | backupcode/ 9 | TCRNExample/ 10 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/quickapp/template/tag/taro-map/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | name: 'taro-map', 3 | subcomponent: 'I:', 4 | url: 'https://doc.quickapp.cn/widgets/map.html' 5 | } -------------------------------------------------------------------------------- /packages/taro-runner-utils/types/index.d.ts: -------------------------------------------------------------------------------- 1 | import { getBundleResult, getBundleContent, getSassLoaderOption } from './scss'; 2 | export { getBundleResult, getBundleContent, getSassLoaderOption }; 3 | -------------------------------------------------------------------------------- /packages/taro-transformer-wx/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | node_modules 3 | .cache 4 | .DS_Store 5 | lerna-debug.log 6 | yarn-error.log 7 | _book 8 | .idea 9 | lib 10 | t.js 11 | tt.js 12 | test.js 13 | -------------------------------------------------------------------------------- /packages/taro-cli/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "env", 4 | "react", 5 | "stage-0" 6 | ], 7 | "plugins": [ 8 | "babel-plugin-transform-class-properties" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /packages/taro-cli/__tests__/mocks/config/dev.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | NODE_ENV: '"development"' 4 | }, 5 | defineConstants: { 6 | }, 7 | weapp: {}, 8 | h5: {} 9 | } 10 | -------------------------------------------------------------------------------- /packages/taro-cli/__tests__/mocks/config/prod.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | NODE_ENV: '"production"' 4 | }, 5 | defineConstants: { 6 | }, 7 | weapp: {}, 8 | h5: {} 9 | } 10 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/quickapp/template/tag/taro-image/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | name: 'taro-image', 3 | subcomponent: 'I:', 4 | url: 'https://doc.quickapp.cn/widgets/image.html' 5 | } -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/quickapp/template/tag/taro-input/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | name: 'taro-input', 3 | subcomponent: 'I:', 4 | url: 'https://doc.quickapp.cn/widgets/input.html' 5 | } -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/quickapp/template/tag/taro-label/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | name: 'taro-label', 3 | subcomponent: 'I:', 4 | url: 'https://doc.quickapp.cn/widgets/label.html' 5 | } -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/quickapp/template/tag/taro-video/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | name: 'taro-video', 3 | subcomponent: 'I:', 4 | url: 'https://doc.quickapp.cn/widgets/video.html' 5 | } -------------------------------------------------------------------------------- /packages/taro-service/__test__/test_plugin1.ts: -------------------------------------------------------------------------------- 1 | export default (ctx, opts) => { 2 | ctx.registerCommand({ 3 | name: 'test1', 4 | fn () { 5 | // console.log('test1') 6 | } 7 | }) 8 | } 9 | -------------------------------------------------------------------------------- /packages/taro/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "module": "umd", 5 | "resolveJsonModule": false 6 | }, 7 | "include": ["./types"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/taro-cli/src/config/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | RN_OUTPUT_DIR: 'rn_temp', 3 | OUTPUT_DIR: 'dist', 4 | SOURCE_DIR: 'src', 5 | TEMP_DIR: '.temp', 6 | NPM_DIR: 'npm', 7 | ENTRY: 'app' 8 | } 9 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/quickapp/template/tag/taro-camera/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | name: 'taro-camera', 3 | subcomponent: 'I:', 4 | url: 'https://doc.quickapp.cn/widgets/camera.html' 5 | } -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/quickapp/template/tag/taro-canvas/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | name: 'taro-canvas', 3 | subcomponent: 'I:', 4 | url: 'https://doc.quickapp.cn/widgets/canvas.html' 5 | } -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/quickapp/template/tag/taro-picker/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | name: 'taro-picker', 3 | subcomponent: 'I:', 4 | url: 'https://doc.quickapp.cn/widgets/picker.html' 5 | } -------------------------------------------------------------------------------- /packages/taro-rn/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["react-native"], 3 | "env": { 4 | "test": { 5 | "plugins": [ 6 | "transform-es2015-modules-commonjs" 7 | ] 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /packages/taro-router-rn/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "env", 4 | "react", 5 | "stage-0" 6 | ], 7 | "plugins": [ 8 | "babel-plugin-transform-class-properties" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /packages/css-to-react-native/src/transforms/rem.js: -------------------------------------------------------------------------------- 1 | export const remToPx = value => { 2 | return value.replace( 3 | /(\d*\.?\d+)rem/g, 4 | (match, m1) => parseFloat(m1, 10) * 16 + "px", 5 | ); 6 | }; 7 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/quickapp/template/tag/taro-textarea/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | name: 'taro-textarea', 3 | subcomponent: 'I:', 4 | url: 'https://doc.quickapp.cn/widgets/textarea.html' 5 | } -------------------------------------------------------------------------------- /packages/taro-components/src/components/input/index.scss: -------------------------------------------------------------------------------- 1 | input { 2 | display: block; 3 | height: 24px; 4 | text-align: inherit; 5 | text-overflow: clip; 6 | overflow: hidden; 7 | white-space: nowrap; 8 | } 9 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/quickapp/style/declaration/list/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'list-style': 'I:', 3 | 'list-style-image': 'I:', 4 | 'list-style-position': 'I:', 5 | 'list-style-type': 'I:' 6 | } 7 | -------------------------------------------------------------------------------- /packages/taro-rn/src/api/interface/index.ts: -------------------------------------------------------------------------------- 1 | export { showActionSheet } from './showActionSheet' 2 | export { showModal } from './showModal' 3 | export { showLoading, showToast, hideToast, hideLoading } from './toast' 4 | -------------------------------------------------------------------------------- /packages/taro-router/src/index.tsx: -------------------------------------------------------------------------------- 1 | export { default as createHistory } from './history/createHistory'; 2 | export { default as Router } from './router/router'; 3 | export { default as mountApis } from './apis/index'; 4 | -------------------------------------------------------------------------------- /packages/taro-runner-utils/__tests__/styles/variables.scss: -------------------------------------------------------------------------------- 1 | $color-ui-info: #78A4FA !default; 2 | $color-ui-positive: #13CE66 !default; 3 | $color-ui-negative: #FF4949 !default; 4 | $color-ui-warning: #FFC82C !default; 5 | -------------------------------------------------------------------------------- /packages/taro-runner-utils/src/index.ts: -------------------------------------------------------------------------------- 1 | import { getBundleResult, getBundleContent, getSassLoaderOption } from './scss' 2 | 3 | export { 4 | getBundleResult, 5 | getBundleContent, 6 | getSassLoaderOption 7 | } 8 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/loaders/quickappStyleLoader.ts: -------------------------------------------------------------------------------- 1 | import styleRewriter from '../quickapp/style-rewriter' 2 | 3 | export default function quickappStyleLoader (source) { 4 | return styleRewriter(source) 5 | } 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | node_modules 3 | .cache 4 | .DS_Store 5 | lerna-debug.log 6 | yarn-error.log 7 | _book 8 | .idea 9 | .vscode 10 | temp 11 | website/build 12 | website/package.json 13 | packages/**/package-lock.json 14 | -------------------------------------------------------------------------------- /packages/taro-components-rn/src/components/Label/PropsType.tsx: -------------------------------------------------------------------------------- 1 | import { StyleProp, ViewStyle } from 'react-native' 2 | 3 | export interface LabelProps { 4 | children?: React.ReactNode; 5 | style?: StyleProp; 6 | } 7 | -------------------------------------------------------------------------------- /website/versioned_docs/version-2.0.3/apis/framework/App.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: App 3 | sidebar_label: App 4 | id: version-2.0.3-App 5 | original_id: App 6 | --- 7 | 8 | 注册小程序。接受一个 `Object` 参数,其指定小程序的生命周期回调等。 9 | 10 | ## 方法 11 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-jsx-to-stylesheet/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "env", 4 | "react", 5 | "stage-0" 6 | ], 7 | "plugins": [ 8 | "babel-plugin-transform-class-properties" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /packages/taro-quickapp/src/next-tick.js: -------------------------------------------------------------------------------- 1 | const nextTick = (fn, ...args) => { 2 | fn = typeof fn === 'function' ? fn.bind(null, ...args) : fn 3 | const timerFunc = setTimeout 4 | timerFunc(fn) 5 | } 6 | 7 | export default nextTick 8 | -------------------------------------------------------------------------------- /packages/babel-plugin-transform-jsx-to-stylesheet/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | verbose: true, 3 | transform: { 4 | '^.+\\.js$': 'babel-jest' 5 | }, 6 | testPathIgnorePatterns: ['/node_modules/', '/__tests__/mocks/'] 7 | } 8 | -------------------------------------------------------------------------------- /packages/stylelint-taro-rn/src/utils/isCustomProperty.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Check whether a property is a custom one 3 | */ 4 | export function isCustomProperty(property /*: string */) /*: boolean */ { 5 | return property.slice(0, 2) === "--"; 6 | } 7 | -------------------------------------------------------------------------------- /packages/taro-cli/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | verbose: true, 3 | preset: 'react-native', 4 | transform: { 5 | '^.+\\.js$': 'babel-jest' 6 | }, 7 | testPathIgnorePatterns: ['/node_modules/', '/__tests__/mocks/'] 8 | } 9 | -------------------------------------------------------------------------------- /packages/taro-quickapp/src/api/webview/index.js: -------------------------------------------------------------------------------- 1 | import webview from '@system.webview' 2 | 3 | export function webviewLoadUrl (opts = {}) { 4 | return webview.loadUrl(opts) 5 | } 6 | 7 | export default { 8 | webviewLoadUrl 9 | } 10 | -------------------------------------------------------------------------------- /packages/taroize/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["tslint-config-standard"], 3 | "rules": { 4 | "no-console": true, 5 | "no-unused-variable": false, 6 | "member-ordering": false, 7 | "no-debugger": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/quickapp/template/tag/span/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | name (node) { 3 | if (node.parent && node.parent.name === 'div') { 4 | return 'text' 5 | } 6 | return node.name 7 | } 8 | } -------------------------------------------------------------------------------- /packages/taro-router/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export const tryToCall = (func, ctx: any = null, ...args) => { 2 | if (!func) return 3 | if (ctx) { 4 | return func.apply(ctx, args) 5 | } else { 6 | return func(...args) 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/view/style/index.scss: -------------------------------------------------------------------------------- 1 | body, html{ 2 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 3 | user-select: none; 4 | -moz-user-select: none; 5 | -webkit-user-select: none; 6 | -ms-user-select: none; 7 | } -------------------------------------------------------------------------------- /packages/taro-redux-h5/react-redux/utils/wrapActionCreators.js: -------------------------------------------------------------------------------- 1 | import { bindActionCreators } from 'redux' 2 | 3 | export default function wrapActionCreators(actionCreators) { 4 | return dispatch => bindActionCreators(actionCreators, dispatch) 5 | } 6 | -------------------------------------------------------------------------------- /packages/taro-runner-utils/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | [ 4 | '@babel/preset-env', 5 | { 6 | targets: { 7 | node: 'current', 8 | }, 9 | }, 10 | ], 11 | ], 12 | } 13 | -------------------------------------------------------------------------------- /packages/taro-with-weapp/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["tslint-config-standard"], 3 | "rules": { 4 | "no-console": true, 5 | "no-unused-variable": false, 6 | "member-ordering": false, 7 | "no-debugger": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/web-view/style/index.scss: -------------------------------------------------------------------------------- 1 | iframe { 2 | border: none; 3 | } 4 | .taro-webview { 5 | position: fixed; 6 | top: 0; 7 | bottom: 0; 8 | width: 100%; 9 | height: 100%; 10 | z-index: 999; 11 | } -------------------------------------------------------------------------------- /packages/taro-h5/src/api/image/react-wx-images-viewer/components/Loading.js: -------------------------------------------------------------------------------- 1 | import Nerv from 'nervjs' 2 | 3 | const Loading = (props) => { 4 | return ( 5 |
6 | ) 7 | } 8 | 9 | export default Loading 10 | -------------------------------------------------------------------------------- /packages/taro-jd/src/next-tick.js: -------------------------------------------------------------------------------- 1 | const nextTick = (fn, ...args) => { 2 | fn = typeof fn === 'function' ? fn.bind(null, ...args) : fn 3 | const timerFunc = jd.nextTick ? jd.nextTick : setTimeout 4 | timerFunc(fn) 5 | } 6 | 7 | export default nextTick 8 | -------------------------------------------------------------------------------- /packages/taro-qq/src/next-tick.js: -------------------------------------------------------------------------------- 1 | const nextTick = (fn, ...args) => { 2 | fn = typeof fn === 'function' ? fn.bind(null, ...args) : fn 3 | const timerFunc = qq.nextTick ? qq.nextTick : setTimeout 4 | timerFunc(fn) 5 | } 6 | 7 | export default nextTick 8 | -------------------------------------------------------------------------------- /packages/taro-tt/src/next-tick.js: -------------------------------------------------------------------------------- 1 | const nextTick = (fn, ...args) => { 2 | fn = typeof fn === 'function' ? fn.bind(null, ...args) : fn 3 | const timerFunc = tt.nextTick ? tt.nextTick : setTimeout 4 | timerFunc(fn) 5 | } 6 | 7 | export default nextTick 8 | -------------------------------------------------------------------------------- /packages/taro-alipay/src/next-tick.js: -------------------------------------------------------------------------------- 1 | const nextTick = (fn, ...args) => { 2 | fn = typeof fn === 'function' ? fn.bind(null, ...args) : fn 3 | const timerFunc = my.nextTick ? my.nextTick : setTimeout 4 | timerFunc(fn) 5 | } 6 | 7 | export default nextTick 8 | -------------------------------------------------------------------------------- /packages/taro-components-rn/src/components/View/PropsType.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { StyleProp, ViewStyle } from 'react-native' 3 | 4 | export interface ViewProps { 5 | style?: StyleProp; 6 | children?: React.ReactNode; 7 | } 8 | -------------------------------------------------------------------------------- /packages/taro-mobx-common/src/utils.js: -------------------------------------------------------------------------------- 1 | export function isPlainObject (value) { 2 | if (!value || typeof value !== 'object') { 3 | return false 4 | } 5 | const proto = Object.getPrototypeOf(value) 6 | return !proto || proto === Object.prototype 7 | } 8 | -------------------------------------------------------------------------------- /packages/taro-rn/src/api/Dialog/variable.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | weuiDialogBackgroundColor: '#FFFFFF', 3 | weuiDialogLineColor: '#D5D5D6', 4 | weuiDialogLinkColor: '#3CC51F', 5 | weuiDialogLinkActiveBc: '#EEEEEE', 6 | weuiDialogGapWidth: 1.6 * 16 7 | } 8 | -------------------------------------------------------------------------------- /packages/taro-swan/src/next-tick.js: -------------------------------------------------------------------------------- 1 | const nextTick = (fn, ...args) => { 2 | fn = typeof fn === 'function' ? fn.bind(null, ...args) : fn 3 | const timerFunc = swan.nextTick ? swan.nextTick : setTimeout 4 | timerFunc(fn) 5 | } 6 | 7 | export default nextTick 8 | -------------------------------------------------------------------------------- /packages/taro-weapp/src/next-tick.js: -------------------------------------------------------------------------------- 1 | const nextTick = (fn, ...args) => { 2 | fn = typeof fn === 'function' ? fn.bind(null, ...args) : fn 3 | const timerFunc = wx.nextTick ? wx.nextTick : setTimeout 4 | timerFunc(fn) 5 | } 6 | 7 | export default nextTick 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /packages/taro-components-rn/src/components/Swiper/styles.tsx: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from 'react-native' 2 | 3 | export default StyleSheet.create({ 4 | page: { 5 | flex: 1, 6 | justifyContent: 'center', 7 | alignItems: 'center' 8 | } 9 | }) 10 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/quickapp/style/declaration/transition/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'transition': 'I:', 3 | 'transition-property': 'I:', 4 | 'transition-duration': 'I:', 5 | 'transition-timing-function': 'I:', 6 | 'transition-delay': 'I:' 7 | } 8 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/quickapp/template/tag/text/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | name (node) { 3 | if (node.parent && ['text', 'span'].includes(node.parent.name)) { 4 | return 'span' 5 | } 6 | return node.name 7 | } 8 | } -------------------------------------------------------------------------------- /packages/taroize/src/json.ts: -------------------------------------------------------------------------------- 1 | import { buildTemplate } from './utils' 2 | import * as t from 'babel-types' 3 | 4 | export function parseJSON (json?: string) { 5 | if (!json) { 6 | return 7 | } 8 | return buildTemplate(`(${json})`) as t.ObjectExpression 9 | } 10 | -------------------------------------------------------------------------------- /packages/taro-components-rn/src/components/Textarea/PropsType.tsx: -------------------------------------------------------------------------------- 1 | import { InputProps, EventOnLineChange } from '../Input/PropsType' 2 | 3 | export interface TextareaProps extends InputProps { 4 | autoHeight?: boolean, 5 | onLineChange?: (evt: EventOnLineChange) => void, 6 | } 7 | -------------------------------------------------------------------------------- /packages/taro-h5/src/api/open/index.js: -------------------------------------------------------------------------------- 1 | import { processOpenapi } from '../utils' 2 | 3 | export const requestPayment = processOpenapi('chooseWXPay', undefined, undefined, options => { 4 | return Object.assign(options, { timestamp: Number.parseInt(options.timeStamp, 10) }) 5 | }) 6 | -------------------------------------------------------------------------------- /docs/apis/canvas/createContext.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.createContext(不推荐使用) 3 | sidebar_label: createContext 4 | --- 5 | 6 | 7 | 创建并返回绘图上下文。 8 | 9 | ## API支持度 10 | 11 | | API | 微信小程序 | H5 | React Native | 12 | | :-: | :-: | :-: | :-: | 13 | | Taro.createContext | ✔️ | | | 14 | -------------------------------------------------------------------------------- /packages/taro-components/.gitignore: -------------------------------------------------------------------------------- 1 | # dependency 2 | node_modules 3 | webpack.config.js 4 | src/demo 5 | 6 | # macOS 7 | .DS_Store 8 | 9 | # ide 10 | .vs_code 11 | .idea 12 | 13 | # build 14 | dist 15 | build 16 | 17 | # jest 18 | coverage 19 | __snapshots__ 20 | .stencil 21 | -------------------------------------------------------------------------------- /packages/taro-redux-h5/react-redux/index.js: -------------------------------------------------------------------------------- 1 | import Provider, { createProvider } from './components/Provider' 2 | import connectAdvanced from './components/connectAdvanced' 3 | import connect from './connect/connect' 4 | 5 | export { Provider, createProvider, connectAdvanced, connect } 6 | -------------------------------------------------------------------------------- /packages/taro-components-rn/__mocks__/fileMock.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | 3 | /** 4 | * REF: https://jestjs.io/docs/en/webpack 5 | */ 6 | module.exports = (src, filename, config, options) => { 7 | return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';' 8 | } 9 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/rich-text/index.md: -------------------------------------------------------------------------------- 1 | rich-text 2 | 3 | ## API 4 | 5 | | | 属性 | 类型 | 默认值 | 说明 | 6 | | --- | ----- | -------------- | ------ | ---------------------- | 7 | | √ | nodes | Array / String | [ ] | 节点列表 / HTML String | 8 | -------------------------------------------------------------------------------- /packages/taro-h5/src/index.cjs.js: -------------------------------------------------------------------------------- 1 | /* 这个入口提供给使用require的用户 */ 2 | 3 | import Taro from './taro/index' 4 | import * as TaroApis from './api/index' 5 | 6 | export * from './taro/index' 7 | export * from './api/index' 8 | 9 | Object.assign(Taro, TaroApis) 10 | 11 | export default Taro 12 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/swiper/style/index.scss: -------------------------------------------------------------------------------- 1 | .swiper-container-wrapper { 2 | height: 150px; 3 | } 4 | .swiper-container { 5 | height: 100%; 6 | } 7 | .swiper-pagination { 8 | font-size: 0; 9 | } 10 | .swiper-pagination-bullet { 11 | opacity: 1 12 | } 13 | -------------------------------------------------------------------------------- /packages/taro-router/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'ts-jest', 3 | testEnvironment: 'jsdom', 4 | testURL: 'https://taro.aotu.io', 5 | globals: { 6 | window: true 7 | }, 8 | moduleNameMapper: { 9 | 'nervjs': '/node_modules/nervjs' 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/stylelint-taro-rn/src/utils/hasScssInterpolation.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Check whether a string has scss interpolation 3 | */ 4 | module.exports = function(string /*: string */) /*: boolean */ { 5 | if (/#{.+?}/.test(string)) { 6 | return true; 7 | } 8 | 9 | return false; 10 | }; 11 | -------------------------------------------------------------------------------- /packages/taro-components-qa/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@tarojs/components-qa", 3 | "version": "2.2.8", 4 | "description": "多端解决方案基础组件(快应用)", 5 | "main": "./index.js", 6 | "files": [ 7 | "src", 8 | "index.js" 9 | ], 10 | "author": "O2Team", 11 | "license": "MIT" 12 | } 13 | -------------------------------------------------------------------------------- /packages/taro-h5/src/api/location/index.js: -------------------------------------------------------------------------------- 1 | import { processOpenapi } from '../utils/index' 2 | 3 | export { default as chooseLocation } from './chooseLocation' 4 | export const getLocation = processOpenapi('getLocation') 5 | export const openLocation = processOpenapi('openLocation', { scale: 18 }) 6 | -------------------------------------------------------------------------------- /packages/taro-plugin-typescript/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | typescript@^2.9.2: 6 | version "2.9.2" 7 | resolved "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c" 8 | -------------------------------------------------------------------------------- /packages/taro-transformer-wx/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["tslint-config-standard"], 3 | "rules": { 4 | "no-console": true, 5 | "no-unused-variable": false, 6 | "member-ordering": false, 7 | "no-debugger": true, 8 | "no-unnecessary-type-assertion": false 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /docs/learn.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 社区贡献的学习教程 3 | --- 4 | 5 | ## 系列教程 6 | 7 | - [Taro 小程序大型实战系列](https://mp.weixin.qq.com/mp/homepage?__biz=MzA5NTcxOTcyMg==&hid=2&sn=0a87f540e1c09afae1db4d1f9add979c&scene=1&devicetype=android-29&version=27000d37&lang=zh_CN&nettype=WIFI&ascene=7&session_us=gh_99d83437df31&wx_header=1) -------------------------------------------------------------------------------- /packages/taro-cli/src/jdreact/template/JDReact.version: -------------------------------------------------------------------------------- 1 | { 2 | "moduleName":"$$MODULE_NAME", 3 | "moduleCode":"1.0", 4 | "targetAppVersion":"5.5.0", 5 | "frameworkVersion":"$$SDK_VERSION", 6 | "platform":"$$PLATFORM", 7 | "chineseModuleName":"Taro流程测试", 8 | "poErp":"chengshuai" 9 | } 10 | -------------------------------------------------------------------------------- /packages/taro-mobx-common/src/staticRendering.js: -------------------------------------------------------------------------------- 1 | let globalIsUsingStaticRendering = false 2 | 3 | export function useStaticRendering (enable) { 4 | globalIsUsingStaticRendering = enable 5 | } 6 | 7 | export function isUsingStaticRendering () { 8 | return globalIsUsingStaticRendering 9 | } 10 | -------------------------------------------------------------------------------- /packages/taro-components-rn/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = 0 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/block/index.js: -------------------------------------------------------------------------------- 1 | import 'weui' 2 | import Nerv from 'nervjs' 3 | 4 | export default class Block extends Nerv.Component { 5 | constructor (props) { 6 | super(props) 7 | } 8 | 9 | render () { 10 | return
{this.props.children}
11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/taro-redux-rn/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | verbose: true, 3 | transform: { 4 | '^.+\\.js$': 'babel-jest' 5 | }, 6 | setupTestFrameworkScriptFile: 'jest-enzyme', 7 | testEnvironment: 'enzyme', 8 | testEnvironmentOptions: { 9 | enzymeAdapter: 'react16' 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/stylelint-taro-rn/src/utils/hasPsvInterpolation.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Check whether a string has postcss-simple-vars interpolation 3 | */ 4 | module.exports = function(string /*: string */) /*: boolean */ { 5 | if (/\$\(.+?\)/.test(string)) { 6 | return true; 7 | } 8 | 9 | return false; 10 | }; 11 | -------------------------------------------------------------------------------- /packages/taro/types/api/base/env.d.ts: -------------------------------------------------------------------------------- 1 | declare namespace Taro { 2 | /** 3 | * @supported weapp 4 | * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/env/envObj.html 5 | */ 6 | abstract class env { 7 | /** 文件系统中的用户目录路径 (本地路径) */ 8 | static USER_DATA_PATH: string 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/taro-components-rn/src/components/Text/PropsType.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { StyleProp, ViewStyle } from 'react-native' 3 | 4 | export interface TextProps { 5 | style?: StyleProp; 6 | children?: React.ReactNode; 7 | selectable?: boolean; 8 | onClick?: () => void; 9 | } 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.23/apis/alipay/getOpenUserInfo.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.getOpenUserInfo() 3 | sidebar_label: getOpenUserInfo 4 | id: version-1.3.23-getOpenUserInfo 5 | original_id: getOpenUserInfo 6 | --- 7 | 8 | 此接口可获取支付宝会员的基础信息 9 | 10 | ## 类型 11 | 12 | ```tsx 13 | () => Promise 14 | ``` 15 | -------------------------------------------------------------------------------- /packages/postcss-plugin-constparse/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "postcss-plugin-constparse", 3 | "version": "2.2.8", 4 | "description": "parse constants defined in config", 5 | "main": "index.js", 6 | "author": "Simba", 7 | "license": "MIT", 8 | "dependencies": { 9 | "postcss": "^6.0.22" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/eslint-config-taro/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: [ 3 | './rules/jsx', 4 | './rules/imports', 5 | './rules/variables' 6 | ].map(require.resolve).concat('plugin:taro/all'), 7 | parserOptions: { 8 | ecmaVersion: 2018, 9 | ecmaFeatures: { 10 | jsx: true 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/stylelint-taro-rn/src/utils/isExportBlock.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Check whether a node is an :export block 3 | */ 4 | export function isExportBlock(node /*: Object */) /*: boolean */ { 5 | if (node.type === "rule" && node.selector && node.selector === ":export") { 6 | return true; 7 | } 8 | 9 | return false; 10 | } 11 | -------------------------------------------------------------------------------- /packages/taro-cli/src/presets/commands/convert.ts: -------------------------------------------------------------------------------- 1 | export default (ctx) => { 2 | ctx.registerCommand({ 3 | name: 'convert', 4 | async fn () { 5 | const Convertor = require('../../convertor').default 6 | const convertor = new Convertor(ctx.paths.appPath) 7 | convertor.run() 8 | } 9 | }) 10 | } 11 | -------------------------------------------------------------------------------- /packages/taro-components-rn/.gitignore: -------------------------------------------------------------------------------- 1 | # dependency 2 | node_modules 3 | 4 | # macOS 5 | .DS_Store 6 | 7 | # ide 8 | .vs_code 9 | .idea 10 | 11 | # build 12 | dist 13 | build 14 | 15 | # jest 16 | coverage 17 | __snapshots__ 18 | 19 | # tcr-testing 20 | tcr-testing.sh 21 | 22 | TCRNExample/android/ 23 | TCRNExample/ios/ 24 | -------------------------------------------------------------------------------- /packages/taro-h5/src/api/canvas/index.js: -------------------------------------------------------------------------------- 1 | export { default as canvasGetImageData } from './canvasGetImageData' 2 | export { default as canvasPutImageData } from './canvasPutImageData' 3 | export { default as canvasToTempFilePath } from './canvasToTempFilePath' 4 | export { default as createCanvasContext } from './createCanvasContext' 5 | -------------------------------------------------------------------------------- /packages/taro-quickapp/src/api/index.test.js: -------------------------------------------------------------------------------- 1 | describe('test', () => { 2 | const chalk = require('chalk') 3 | const api = require('./index') 4 | const unsupportedApi = require('./unsupportedApi') 5 | console.log(Object.keys(api).map(e => !unsupportedApi[e] ? e : chalk.red(e)).join(' ')) 6 | 7 | test('api test', () => {}) 8 | }) 9 | -------------------------------------------------------------------------------- /packages/taro-redux-h5/src/prop-types.js: -------------------------------------------------------------------------------- 1 | function proptype () { } 2 | proptype.isRequired = proptype 3 | 4 | const getProptype = () => proptype 5 | 6 | const PropTypes = { 7 | element: getProptype, 8 | func: getProptype, 9 | shape: getProptype, 10 | instanceOf: getProptype 11 | } 12 | 13 | export default PropTypes 14 | -------------------------------------------------------------------------------- /packages/taro-redux/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | verbose: true, 3 | moduleFileExtensions: ['js', 'jsx', 'json'], 4 | rootDir: __dirname, 5 | testMatch: ['/**/*.test.js'], 6 | transform: { 7 | '^.+\\.js?$': 'babel-jest' 8 | }, 9 | transformIgnorePatterns: ['/node_modules/'] 10 | } 11 | -------------------------------------------------------------------------------- /packages/stylelint-taro-rn/src/index.js: -------------------------------------------------------------------------------- 1 | import { createPlugin } from "stylelint"; 2 | import { namespace } from "./utils"; 3 | import rules from "./rules"; 4 | 5 | const rulesPlugins = Object.keys(rules).map(ruleName => { 6 | return createPlugin(namespace(ruleName), rules[ruleName]); 7 | }); 8 | 9 | export default rulesPlugins; 10 | -------------------------------------------------------------------------------- /packages/taro-components-rn/src/components/Slider/styles.tsx: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from 'react-native' 2 | 3 | export default StyleSheet.create({ 4 | wrapper: { 5 | flexDirection: 'row', 6 | alignItems: 'center', 7 | }, 8 | bar: { 9 | flexGrow: 1 10 | }, 11 | info: { 12 | marginLeft: 15, 13 | } 14 | }) 15 | -------------------------------------------------------------------------------- /packages/taro-plugin-typescript/index.js: -------------------------------------------------------------------------------- 1 | const ts = require('typescript') 2 | 3 | module.exports = function tsc (content, file, config) { 4 | let p 5 | try { 6 | const res = ts.transpileModule(content, config) 7 | p = Promise.resolve(res) 8 | } catch (e) { 9 | p = Promise.reject(e) 10 | } 11 | return p 12 | } 13 | -------------------------------------------------------------------------------- /website/versioned_docs/version-2.0.3/apis/framework/Page.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Page 3 | sidebar_label: Page 4 | id: version-2.0.3-Page 5 | original_id: Page 6 | --- 7 | 8 | 注册小程序中的一个页面。接受一个 `Object` 类型参数,其指定页面的初始数据、生命周期回调、事件处理函数等。 9 | 10 | ## 方法 11 | 12 | | 参数 | 类型 | 说明 | 13 | | --- | --- | --- | 14 | | route | `string` | 当前页面的路径 | 15 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | sudo: false 3 | 4 | node_js: 5 | - "10" 6 | 7 | cache: 8 | directories: 9 | - node_modules 10 | 11 | jobs: 12 | include: 13 | - stage: test 14 | script: 15 | - npm install 16 | - travis_wait 30 npm run bootstrap 17 | - npm run build 18 | - npm run test 19 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/quickapp/style/declaration/margin/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'margin': (value, declaration, addDeclaration) => { 3 | if (~value.indexOf('auto')) { 4 | return 'I:' 5 | } 6 | }, 7 | 'margin-bottom': '', 8 | 'margin-left': '', 9 | 'margin-right': '', 10 | 'margin-top': '' 11 | } 12 | -------------------------------------------------------------------------------- /packages/taro-rn/src/__tests__/__mock__/mockClipboard.js: -------------------------------------------------------------------------------- 1 | class Clipboard { 2 | constructor () { 3 | this.clipboardData = '' 4 | } 5 | 6 | setString (str) { 7 | this.clipboardData = str 8 | } 9 | 10 | getString () { 11 | return Promise.resolve(this.clipboardData) 12 | } 13 | } 14 | 15 | export default Clipboard 16 | -------------------------------------------------------------------------------- /packages/taro-with-weapp/__tests__/utils.js: -------------------------------------------------------------------------------- 1 | import { Component } from 'nervjs' 2 | 3 | export class TaroComponent extends Component { 4 | $router = { 5 | params: { 6 | a: 1 7 | } 8 | } 9 | 10 | $scope = {} 11 | } 12 | 13 | export const delay = (fn) => { 14 | setTimeout(() => { 15 | fn() 16 | }, 0) 17 | } 18 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/quickapp/style/declaration/padding/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'padding': (value, declaration, addDeclaration) => { 3 | if (~value.indexOf('auto')) { 4 | return 'I:' 5 | } 6 | }, 7 | 'padding-bottom': '', 8 | 'padding-left': '', 9 | 'padding-right': '', 10 | 'padding-top': '' 11 | } 12 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/quickapp/template/constant.ts: -------------------------------------------------------------------------------- 1 | 2 | interface Location { 3 | line: number; 4 | column: number; 5 | } 6 | 7 | export interface NodeType { 8 | attributes: object; 9 | children: object[]; 10 | isSelfClosing: boolean; 11 | location: Location; 12 | name: string; 13 | parent?: object; 14 | } -------------------------------------------------------------------------------- /packages/taro-rn/src/__tests__/__mock__/mockCameraRoll.js: -------------------------------------------------------------------------------- 1 | const cameraRoll = { 2 | saveToCameraRoll (filePath, type) { 3 | const path = type === 'photo' ? `photo://${filePath}` : `video://${filePath}` 4 | return new Promise((resolve, reject) => { 5 | resolve(path) 6 | }) 7 | } 8 | } 9 | 10 | export default cameraRoll 11 | -------------------------------------------------------------------------------- /packages/taro-runner-utils/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | verbose: true, 3 | moduleFileExtensions: ['js', 'jsx', 'json'], 4 | rootDir: __dirname, 5 | testMatch: ['/__tests__/**/*.test.js'], 6 | transform: { 7 | '^.+\\.js?$': 'babel-jest' 8 | }, 9 | transformIgnorePatterns: ['/node_modules/'] 10 | } 11 | -------------------------------------------------------------------------------- /packages/taro-components-rn/TCRNExample/example/EXWebView.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react' 2 | import { WebView } from '../../dist' 3 | 4 | export default class EXSlider extends Component { 5 | render () { 6 | return ( 7 | 8 | ) 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/text/index.md: -------------------------------------------------------------------------------- 1 | text 2 | 3 | ## API 4 | 5 | | | 属性 | 类型 | 默认值 | 说明 | 6 | | --- | ---------- | ------- | ------ | ------------ | 7 | | √ | selectable | Boolean | false | 文本是否可选 | 8 | | | space | Boolean | false | 显示连续空格 | 9 | | | decode | Boolean | false | 是否解码 | 10 | -------------------------------------------------------------------------------- /packages/taro-transformer-wx/src/interface.d.ts: -------------------------------------------------------------------------------- 1 | import { NodePath } from 'babel-traverse' 2 | import * as t from 'babel-types' 3 | 4 | interface LoopRef { 5 | id: string | t.Expression, 6 | fn: t.FunctionExpression | t.ArrowFunctionExpression | t.MemberExpression, 7 | type: 'component' | 'dom', 8 | component: NodePath 9 | } 10 | -------------------------------------------------------------------------------- /packages/taro-h5/src/api/image/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * previewImage api基于开源的React组件[react-wx-images-viewer](https://github.com/react-ld/react-wx-images-viewer)开发,感谢! 3 | */ 4 | 5 | export { default as chooseImage } from './chooseImage' 6 | export { default as getImageInfo } from './getImageInfo' 7 | export { default as previewImage } from './previewImage' 8 | -------------------------------------------------------------------------------- /docs/apis/canvas/drawCanvas.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.drawCanvas(不推荐使用) 3 | sidebar_label: drawCanvas 4 | --- 5 | 6 | 7 | 使用方式同 [`wx.drawCanvas`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/draw-canvas.html)。 8 | 9 | ## API支持度 10 | 11 | | API | 微信小程序 | H5 | React Native | 12 | | :-: | :-: | :-: | :-: | 13 | | Taro.drawCanvas | ✔️ | | | 14 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/text/style/index.scss: -------------------------------------------------------------------------------- 1 | .taro-text { 2 | -moz-user-select: none; 3 | -webkit-user-select: none; 4 | -ms-user-select: none; 5 | user-select: none; 6 | &__selectable { 7 | -moz-user-select: text; 8 | -webkit-user-select: text; 9 | -ms-user-select: text; 10 | user-select: text; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/taro/types/api/alipay/index.d.ts: -------------------------------------------------------------------------------- 1 | declare namespace Taro { 2 | /** 3 | * 此接口可获取支付宝会员的基础信息(头像图片地址、昵称、性别、国家码、省份、所在市区),接入方法请参考 获取会员基础信息介绍。如需获取支付宝会员标识(user_id),请调用 my.getAuthCode 和 alipay.system.oauth.token 接口。 4 | * @supported alipay 5 | * @see https://docs.alipay.com/mini/api/ch8chh 6 | */ 7 | function getOpenUserInfo(): Promise 8 | } 9 | -------------------------------------------------------------------------------- /packages/taro-cli/src/commands/convert.ts: -------------------------------------------------------------------------------- 1 | import { Kernel } from '@tarojs/service' 2 | 3 | export default function convert (kernel: Kernel, { 4 | appPath, 5 | isHelp 6 | }: { 7 | appPath: string, 8 | isHelp?: boolean 9 | }) { 10 | kernel.run({ 11 | name: 'convert', 12 | opts: { 13 | appPath, 14 | isHelp 15 | } 16 | }) 17 | } 18 | -------------------------------------------------------------------------------- /packages/taro-cli/src/commands/doctor.ts: -------------------------------------------------------------------------------- 1 | import { Kernel } from '@tarojs/service' 2 | 3 | export default function doctor (kernel: Kernel, { 4 | appPath, 5 | isHelp 6 | }: { 7 | appPath: string, 8 | isHelp?: boolean 9 | }) { 10 | kernel.run({ 11 | name: 'doctor', 12 | opts: { 13 | appPath, 14 | isHelp 15 | } 16 | }) 17 | } 18 | -------------------------------------------------------------------------------- /packages/taro-components-rn/src/components/Progress/styles.tsx: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from 'react-native' 2 | 3 | export default StyleSheet.create({ 4 | wrapper: { 5 | flexDirection: 'row', 6 | alignItems: 'center', 7 | }, 8 | bar: { 9 | flexGrow: 1 10 | }, 11 | barThumb: { 12 | }, 13 | info: { 14 | marginLeft: 15, 15 | } 16 | }) 17 | -------------------------------------------------------------------------------- /packages/taro/src/current.js: -------------------------------------------------------------------------------- 1 | let Current 2 | 3 | if (process.env.TARO_ENV === 'alipay') { 4 | if (!my.Current) { 5 | my.Current = { 6 | current: null, 7 | index: 0 8 | } 9 | } 10 | Current = my.Current 11 | } else { 12 | Current = { 13 | current: null, 14 | index: 0 15 | } 16 | } 17 | 18 | export { 19 | Current 20 | } 21 | -------------------------------------------------------------------------------- /docs/apis/base/env/env.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.env() 3 | sidebar_label: env 4 | --- 5 | 6 | > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/base/env/envObj.html) 7 | 8 | ## 类型 9 | 10 | ```tsx 11 | typeof env 12 | ``` 13 | 14 | ## API 支持度 15 | 16 | | API | 微信小程序 | H5 | React Native | 17 | | :---: | :---: | :---: | :---: | 18 | | Taro.env | ✔️ | | | 19 | -------------------------------------------------------------------------------- /packages/taro-components-rn/src/lib/provider/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import AntProvider from '@ant-design/react-native/lib/provider' 3 | 4 | export default class Provider extends React.Component { 5 | render () { 6 | return ( 7 | 8 | {this.props.children} 9 | 10 | ) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/taro-components/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Nerv App 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/taro-redux/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["@babel/preset-env", { 4 | "spec": true 5 | }] 6 | ], 7 | "plugins": [ 8 | "@babel/plugin-proposal-class-properties", 9 | "@babel/plugin-proposal-object-rest-spread", 10 | ["@babel/plugin-transform-react-jsx", { 11 | "pragma": "Nerv.createElement" 12 | }] 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /packages/taro-alipay/src/data-cache.js: -------------------------------------------------------------------------------- 1 | const data = {} 2 | 3 | export function cacheDataSet (key, val) { 4 | data[key] = val 5 | } 6 | 7 | export function cacheDataGet (key, delelteAfterGet) { 8 | const temp = data[key] 9 | delelteAfterGet && delete data[key] 10 | return temp 11 | } 12 | 13 | export function cacheDataHas (key) { 14 | return key in data 15 | } 16 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/camera/index.js: -------------------------------------------------------------------------------- 1 | import Nerv from 'nervjs' 2 | 3 | class Camera extends Nerv.Component { 4 | constructor () { 5 | super(...arguments) 6 | } 7 | 8 | componentDidMount () { 9 | console.error('h5 暂不支持 Camera 组件') 10 | } 11 | 12 | render () { 13 | return
14 | } 15 | } 16 | 17 | export default Camera 18 | -------------------------------------------------------------------------------- /packages/taro-jd/src/data-cache.js: -------------------------------------------------------------------------------- 1 | const data = {} 2 | 3 | export function cacheDataSet (key, val) { 4 | data[key] = val 5 | } 6 | 7 | export function cacheDataGet (key, delelteAfterGet) { 8 | const temp = data[key] 9 | delelteAfterGet && delete data[key] 10 | return temp 11 | } 12 | 13 | export function cacheDataHas (key) { 14 | return key in data 15 | } 16 | -------------------------------------------------------------------------------- /packages/taro-qq/src/data-cache.js: -------------------------------------------------------------------------------- 1 | const data = {} 2 | 3 | export function cacheDataSet (key, val) { 4 | data[key] = val 5 | } 6 | 7 | export function cacheDataGet (key, delelteAfterGet) { 8 | const temp = data[key] 9 | delelteAfterGet && delete data[key] 10 | return temp 11 | } 12 | 13 | export function cacheDataHas (key) { 14 | return key in data 15 | } 16 | -------------------------------------------------------------------------------- /packages/taro-swan/src/data-cache.js: -------------------------------------------------------------------------------- 1 | const data = {} 2 | 3 | export function cacheDataSet (key, val) { 4 | data[key] = val 5 | } 6 | 7 | export function cacheDataGet (key, delelteAfterGet) { 8 | const temp = data[key] 9 | delelteAfterGet && delete data[key] 10 | return temp 11 | } 12 | 13 | export function cacheDataHas (key) { 14 | return key in data 15 | } 16 | -------------------------------------------------------------------------------- /packages/taro-tt/src/data-cache.js: -------------------------------------------------------------------------------- 1 | const data = {} 2 | 3 | export function cacheDataSet (key, val) { 4 | data[key] = val 5 | } 6 | 7 | export function cacheDataGet (key, delelteAfterGet) { 8 | const temp = data[key] 9 | delelteAfterGet && delete data[key] 10 | return temp 11 | } 12 | 13 | export function cacheDataHas (key) { 14 | return key in data 15 | } 16 | -------------------------------------------------------------------------------- /packages/taro-weapp/src/data-cache.js: -------------------------------------------------------------------------------- 1 | const data = {} 2 | 3 | export function cacheDataSet (key, val) { 4 | data[key] = val 5 | } 6 | 7 | export function cacheDataGet (key, delelteAfterGet) { 8 | const temp = data[key] 9 | delelteAfterGet && delete data[key] 10 | return temp 11 | } 12 | 13 | export function cacheDataHas (key) { 14 | return key in data 15 | } 16 | -------------------------------------------------------------------------------- /packages/taro-components-rn/src/components/Block/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { ViewProps } from '../View/PropsType' 3 | 4 | // _Block.displayName = '_Block' 5 | 6 | const _Block: React.SFC = (props) => { 7 | return ( 8 | <> 9 | {props.children} 10 | 11 | ) 12 | } 13 | 14 | export { _Block } 15 | export default _Block 16 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/label/index.js: -------------------------------------------------------------------------------- 1 | import 'weui' 2 | import Nerv from 'nervjs' 3 | 4 | class Label extends Nerv.Component { 5 | constructor () { 6 | super(...arguments) 7 | } 8 | 9 | render () { 10 | const {...reset} = this.props 11 | return 12 | } 13 | } 14 | 15 | export default Label 16 | -------------------------------------------------------------------------------- /website/versioned_docs/version-2.0.3/apis/canvas/createContext.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.createContext(不推荐使用) 3 | sidebar_label: createContext 4 | id: version-2.0.3-createContext 5 | original_id: createContext 6 | --- 7 | 8 | 9 | 创建并返回绘图上下文。 10 | 11 | ## API支持度 12 | 13 | | API | 微信小程序 | H5 | React Native | 14 | | :-: | :-: | :-: | :-: | 15 | | Taro.createContext | ✔️ | | | 16 | -------------------------------------------------------------------------------- /docs/hybrid.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro 代码与小程序代码混写 3 | --- 4 | 5 | Taro 项目 支持 Taro 的代码与小程序(微信/百度/支付宝/字节跳动)原生的页面、组件代码混合存在,只需要将原生的页面、组件代码放入 `src` 目录下,随后在 入口文件 `app.js` 中定义好 `pages` 配置指向对应的原生的页面即可,在原生页面的配置中,你可以通过 `usingComponents` 来定义需要引入的组件,这里可以指定 Taro 组件同时也可以指定小程序原生的组件。 6 | 7 | `usingComponents` 指定的小程序原生组件名字需要以**小写**开头。 8 | 9 | > 请参考示例项目:https://github.com/NervJS/taro-sample-weapp 10 | -------------------------------------------------------------------------------- /packages/taro-cli/src/config/babylon.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | sourceType: 'module', 3 | plugins: [ 4 | 'typescript', 5 | 'classProperties', 6 | 'jsx', 7 | 'trailingFunctionCommas', 8 | 'asyncFunctions', 9 | 'exponentiationOperator', 10 | 'asyncGenerators', 11 | 'objectRestSpread', 12 | 'decorators', 13 | 'dynamicImport' 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /packages/taro-cli/templates/default/project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "miniprogramRoot": "./dist", 3 | "projectname": "<%= projectName %>", 4 | "description": "<%= description %>", 5 | "appid": "touristappid", 6 | "setting": { 7 | "urlCheck": true, 8 | "es6": false, 9 | "postcss": false, 10 | "minified": false 11 | }, 12 | "compileType": "miniprogram" 13 | } 14 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.23/apis/ui/interaction/hideToast.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.hideToast() 3 | sidebar_label: hideToast 4 | id: version-1.3.23-hideToast 5 | original_id: hideToast 6 | --- 7 | 8 | 9 | 隐藏消息提示框 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 17 | | :-: | :-: | :-: | :-: | 18 | | Taro.hideToast | ✔️ | ✔️ | ✔️ | 19 | 20 | -------------------------------------------------------------------------------- /website/versioned_docs/version-2.1.5/learn.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 社区贡献的学习教程 3 | id: version-2.1.5-learn 4 | original_id: learn 5 | --- 6 | 7 | ## 系列教程 8 | 9 | - [Taro 小程序大型实战系列](https://mp.weixin.qq.com/mp/homepage?__biz=MzA5NTcxOTcyMg==&hid=2&sn=0a87f540e1c09afae1db4d1f9add979c&scene=1&devicetype=android-29&version=27000d37&lang=zh_CN&nettype=WIFI&ascene=7&session_us=gh_99d83437df31&wx_header=1) -------------------------------------------------------------------------------- /packages/taro-components-rn/src/components/RichText/PropsType.tsx: -------------------------------------------------------------------------------- 1 | import { StyleProp, ViewStyle } from 'react-native' 2 | 3 | export type Node = { 4 | type: 'node' | 'text'; 5 | name?: string; 6 | attrs?: any; 7 | children?: Node[]; 8 | text: string; 9 | } 10 | 11 | export interface RichTextProps { 12 | style?: StyleProp; 13 | nodes: Node[] | string; 14 | } 15 | -------------------------------------------------------------------------------- /packages/taro-h5/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "presets": [ 3 | [ 4 | "@babel/preset-env" 5 | ], 6 | ], 7 | "plugins": [ 8 | "@babel/plugin-proposal-class-properties", 9 | "@babel/plugin-proposal-object-rest-spread", 10 | ["@babel/plugin-transform-react-jsx", { 11 | "pragma": "Nerv.createElement" 12 | }] 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/config/babylon.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | sourceType: 'module', 3 | plugins: [ 4 | 'typescript', 5 | 'classProperties', 6 | 'jsx', 7 | 'trailingFunctionCommas', 8 | 'asyncFunctions', 9 | 'exponentiationOperator', 10 | 'asyncGenerators', 11 | 'objectRestSpread', 12 | 'decorators', 13 | 'dynamicImport' 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /packages/taro-rn-runner/src/config/babylon.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | sourceType: 'module', 3 | plugins: [ 4 | 'typescript', 5 | 'classProperties', 6 | 'jsx', 7 | 'trailingFunctionCommas', 8 | 'asyncFunctions', 9 | 'exponentiationOperator', 10 | 'asyncGenerators', 11 | 'objectRestSpread', 12 | 'decorators', 13 | 'dynamicImport' 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /packages/taro-rn/src/api/others/index.ts: -------------------------------------------------------------------------------- 1 | let base64js = require('base64-js') 2 | 3 | export function arrayBufferToBase64 (arrayBuffer) { 4 | return base64js.fromByteArray(arrayBuffer) 5 | } 6 | 7 | export function base64ToArrayBuffer (base64) { 8 | return base64js.toByteArray(base64) 9 | } 10 | 11 | export default { 12 | arrayBufferToBase64, 13 | base64ToArrayBuffer 14 | } 15 | -------------------------------------------------------------------------------- /packages/css-to-react-native/src/css-to-react-native/transforms/textShadow.js: -------------------------------------------------------------------------------- 1 | import { parseShadow } from "./util"; 2 | 3 | export default tokenStream => { 4 | const { offset, radius, color } = parseShadow(tokenStream); 5 | return { 6 | $merge: { 7 | textShadowOffset: offset, 8 | textShadowRadius: radius, 9 | textShadowColor: color, 10 | }, 11 | }; 12 | }; 13 | -------------------------------------------------------------------------------- /packages/postcss-unit-transform/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "postcss-taro-unit-transform", 3 | "version": "2.2.8", 4 | "description": "小程序单位转换", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "luckyadam", 10 | "license": "MIT", 11 | "dependencies": { 12 | "postcss": "^6.0.21" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/taro-cli/src/index.ts: -------------------------------------------------------------------------------- 1 | import Convertor from './convertor' 2 | import doctor from './doctor' 3 | import Project from './create/project' 4 | import { Compiler as H5Compiler } from './h5/index' 5 | 6 | export default { 7 | Convertor, 8 | doctor, 9 | Project, 10 | H5Compiler 11 | } 12 | 13 | export { 14 | Convertor, 15 | doctor, 16 | Project, 17 | H5Compiler 18 | } 19 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/open-data/index.js: -------------------------------------------------------------------------------- 1 | import Nerv from 'nervjs' 2 | 3 | class OpenData extends Nerv.Component { 4 | componentDidMount () { 5 | console.error('H5 暂不支持 OpenData 组件!') 6 | } 7 | 8 | render () { 9 | const { ...reset } = this.props 10 | return
{this.props.children}
11 | } 12 | } 13 | 14 | export default OpenData 15 | -------------------------------------------------------------------------------- /packages/taroize/src/cache.ts: -------------------------------------------------------------------------------- 1 | import { Wxml } from './wxml' 2 | import { cloneDeep } from 'lodash' 3 | const cacheMap = new Map() 4 | 5 | export function getCacheWxml(dirpath: string): Wxml | undefined { 6 | return cloneDeep(cacheMap.get(dirpath)) 7 | } 8 | 9 | export function saveCacheWxml(dirpath: string, wxml: Wxml) { 10 | cacheMap.set(dirpath, cloneDeep(wxml)) 11 | } -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/interface/interactives/hideToast.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.hideToast() 3 | sidebar_label: hideToast 4 | id: version-1.3.14-hideToast 5 | original_id: hideToast 6 | --- 7 | 8 | 9 | 隐藏消息提示框 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 17 | | :-: | :-: | :-: | :-: | 18 | | Taro.hideToast | ✔️ | ✔️ | ✔️ | 19 | 20 | -------------------------------------------------------------------------------- /packages/stylelint-taro-rn/src/utils/hasLessInterpolation.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Check whether a string has less interpolation 3 | * 4 | * @param {string} string 5 | * @return {boolean} If `true`, a string has less interpolation 6 | */ 7 | module.exports = function(string /*: string */) /*: boolean */ { 8 | if (/@{.+?}/.test(string)) { 9 | return true; 10 | } 11 | 12 | return false; 13 | }; 14 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/picker-view/index.js: -------------------------------------------------------------------------------- 1 | import Nerv from 'nervjs' 2 | 3 | class PickerView extends Nerv.Component { 4 | componentDidMount () { 5 | console.error('H5 暂不支持 PickerView 组件!') 6 | } 7 | 8 | render () { 9 | const { ...reset } = this.props 10 | return
{this.props.children}
11 | } 12 | } 13 | 14 | export default PickerView 15 | -------------------------------------------------------------------------------- /packages/taro-plugin-babel/index.js: -------------------------------------------------------------------------------- 1 | const { transform } = require('babel-core') 2 | 3 | module.exports = function babel (content, file, config) { 4 | let p 5 | try { 6 | if (!config) config = {} 7 | config.filename = file 8 | const res = transform(content, config) 9 | p = Promise.resolve(res) 10 | } catch (e) { 11 | p = Promise.reject(e) 12 | } 13 | return p 14 | } 15 | -------------------------------------------------------------------------------- /packages/taro-cli/src/commands/info.ts: -------------------------------------------------------------------------------- 1 | import { Kernel } from '@tarojs/service' 2 | 3 | export default function info (kernel: Kernel, { 4 | appPath, 5 | rn, 6 | isHelp 7 | }: { 8 | appPath: string, 9 | rn?: boolean, 10 | isHelp?: boolean 11 | }) { 12 | kernel.run({ 13 | name: 'info', 14 | opts: { 15 | appPath, 16 | rn, 17 | isHelp 18 | } 19 | }) 20 | } 21 | -------------------------------------------------------------------------------- /packages/taro-components-rn/src/components/Icon/PropsType.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { ViewStyle, StyleProp } from 'react-native' 3 | 4 | export interface IconProps { 5 | style?: StyleProp; 6 | type: 'success' | 'success_no_circle' | 'info' | 'warn' | 'waiting' | 'cancel' | 'download' | 'search' | 'clear'; 7 | size?: number | string; 8 | color?: string; 9 | } 10 | -------------------------------------------------------------------------------- /packages/taro-mobx-h5/src/Provider.js: -------------------------------------------------------------------------------- 1 | import { Children } from 'nervjs' 2 | import Taro from '@tarojs/taro-h5' 3 | import { setStore } from '@tarojs/mobx-common' 4 | 5 | export default class Provider extends Taro.Component { 6 | constructor (props) { 7 | super(props) 8 | setStore(props.store) 9 | } 10 | 11 | render () { 12 | return Children.only(this.props.children) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/taro-redux-h5/react-redux/utils/verifyPlainObject.js: -------------------------------------------------------------------------------- 1 | import isPlainObject from './isPlainObject' 2 | import warning from './warning' 3 | 4 | export default function verifyPlainObject(value, displayName, methodName) { 5 | if (!isPlainObject(value)) { 6 | warning( 7 | `${methodName}() in ${displayName} must return a plain object. Instead received ${value}.` 8 | ) 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.23/apis/canvas/createContext.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.createContext(不推荐使用) 3 | sidebar_label: createContext 4 | id: version-1.3.23-createContext 5 | original_id: createContext 6 | --- 7 | 8 | 9 | 创建并返回绘图上下文。 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 17 | | :-: | :-: | :-: | :-: | 18 | | Taro.createContext | ✔️ | | | 19 | 20 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.23/apis/ui/interaction/hideLoading.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.hideLoading() 3 | sidebar_label: hideLoading 4 | id: version-1.3.23-hideLoading 5 | original_id: hideLoading 6 | --- 7 | 8 | 9 | 隐藏 loading 提示框 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 17 | | :-: | :-: | :-: | :-: | 18 | | Taro.hideLoading | ✔️ | ✔️ | ✔️ | 19 | 20 | -------------------------------------------------------------------------------- /packages/css-to-react-native/src/css-to-react-native/transforms/boxShadow.js: -------------------------------------------------------------------------------- 1 | import { parseShadow } from "./util"; 2 | 3 | export default tokenStream => { 4 | const { offset, radius, color } = parseShadow(tokenStream); 5 | return { 6 | $merge: { 7 | shadowOffset: offset, 8 | shadowRadius: radius, 9 | shadowColor: color, 10 | shadowOpacity: 1, 11 | }, 12 | }; 13 | }; 14 | -------------------------------------------------------------------------------- /packages/taro-mobx-rn/src/Provider.js: -------------------------------------------------------------------------------- 1 | import { Children } from 'react' 2 | import { Component } from '@tarojs/taro-rn' 3 | import { setStore } from '@tarojs/mobx-common' 4 | 5 | export default class Provider extends Component { 6 | constructor (props) { 7 | super(props) 8 | setStore(props.store) 9 | } 10 | 11 | render () { 12 | return Children.only(this.props.children) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /scripts/parser/taro-env.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | { name: 'weapp', label: '微信小程序' }, 3 | { name: 'swan', label: '百度小程序' }, 4 | { name: 'alipay', label: '支付宝小程序' }, 5 | { name: 'tt', label: '字节跳动小程序' }, 6 | { name: 'qq', label: 'QQ 小程序' }, 7 | { name: 'jd', label: '京东小程序' }, 8 | { name: 'h5', label: 'H5' }, 9 | { name: 'rn', label: 'React Native' }, 10 | { name: 'quickapp', label: '快应用' }, 11 | ] -------------------------------------------------------------------------------- /packages/taro-components-rn/src/types/definition.d.ts: -------------------------------------------------------------------------------- 1 | // import * as ReactNative from 'react-native'; 2 | 3 | // declare module 'react-native' { 4 | // interface ARTStatic { 5 | // Transform: any; 6 | // } 7 | // } 8 | 9 | declare module 'react-dom/server.browser' { 10 | import { ReactElement } from 'react'; 11 | 12 | export const renderToStaticMarkup: (element: ReactElement) => string; 13 | } 14 | -------------------------------------------------------------------------------- /packages/taro-jd/src/pure-component.js: -------------------------------------------------------------------------------- 1 | import { shallowEqual } from '@tarojs/utils' 2 | 3 | import Component from './component' 4 | 5 | class PureComponent extends Component { 6 | isPureComponent = true 7 | 8 | shouldComponentUpdate (nextProps, nextState) { 9 | return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState) 10 | } 11 | } 12 | 13 | export default PureComponent 14 | -------------------------------------------------------------------------------- /packages/taro-qq/src/pure-component.js: -------------------------------------------------------------------------------- 1 | import { shallowEqual } from '@tarojs/utils' 2 | 3 | import Component from './component' 4 | 5 | class PureComponent extends Component { 6 | isPureComponent = true 7 | 8 | shouldComponentUpdate (nextProps, nextState) { 9 | return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState) 10 | } 11 | } 12 | 13 | export default PureComponent 14 | -------------------------------------------------------------------------------- /packages/taro-swan/src/pure-component.js: -------------------------------------------------------------------------------- 1 | import { shallowEqual } from '@tarojs/utils' 2 | 3 | import Component from './component' 4 | 5 | class PureComponent extends Component { 6 | isPureComponent = true 7 | 8 | shouldComponentUpdate (nextProps, nextState) { 9 | return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState) 10 | } 11 | } 12 | 13 | export default PureComponent 14 | -------------------------------------------------------------------------------- /packages/taro-tt/src/pure-component.js: -------------------------------------------------------------------------------- 1 | import { shallowEqual } from '@tarojs/utils' 2 | 3 | import Component from './component' 4 | 5 | class PureComponent extends Component { 6 | isPureComponent = true 7 | 8 | shouldComponentUpdate (nextProps, nextState) { 9 | return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState) 10 | } 11 | } 12 | 13 | export default PureComponent 14 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/interface/canvas/createContext.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.createContext(不推荐使用) 3 | sidebar_label: createContext 4 | id: version-1.3.14-createContext 5 | original_id: createContext 6 | --- 7 | 8 | 9 | 创建并返回绘图上下文。 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 17 | | :-: | :-: | :-: | :-: | 18 | | Taro.createContext | ✔️ | | | 19 | 20 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/interface/interactives/hideLoading.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.hideLoading() 3 | sidebar_label: hideLoading 4 | id: version-1.3.14-hideLoading 5 | original_id: hideLoading 6 | --- 7 | 8 | 9 | 隐藏 loading 提示框 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 17 | | :-: | :-: | :-: | :-: | 18 | | Taro.hideLoading | ✔️ | ✔️ | ✔️ | 19 | 20 | -------------------------------------------------------------------------------- /packages/taro-alipay/src/pure-component.js: -------------------------------------------------------------------------------- 1 | import { shallowEqual } from '@tarojs/utils' 2 | 3 | import Component from './component' 4 | 5 | class PureComponent extends Component { 6 | isPureComponent = true 7 | 8 | shouldComponentUpdate (nextProps, nextState) { 9 | return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState) 10 | } 11 | } 12 | 13 | export default PureComponent 14 | -------------------------------------------------------------------------------- /packages/taro-cli/src/doctor/index.ts: -------------------------------------------------------------------------------- 1 | import configValidator from './configValidator' 2 | import packageValidator from './packageValidator' 3 | import recommandValidator from './recommandValidator' 4 | import eslintValidator from './eslintValidator' 5 | 6 | export default { 7 | validators: [ 8 | configValidator, 9 | packageValidator, 10 | recommandValidator, 11 | eslintValidator 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/scroll-view/style/index.scss: -------------------------------------------------------------------------------- 1 | .taro-scroll { 2 | -webkit-overflow-scrolling: auto; 3 | &::-webkit-scrollbar { 4 | display: none; 5 | } 6 | } 7 | .taro-scroll-view { 8 | overflow: hidden; 9 | &__scroll-x { 10 | overflow-x: scroll; 11 | overflow-y: hidden; 12 | } 13 | &__scroll-y { 14 | overflow-x: hidden; 15 | overflow-y: scroll; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/plugins/TaroNormalModule.ts: -------------------------------------------------------------------------------- 1 | import * as NormalModule from 'webpack/lib/NormalModule' 2 | import { PARSE_AST_TYPE } from '@tarojs/helper' 3 | 4 | export default class TaroNormalModule extends NormalModule { 5 | name: string 6 | miniType: PARSE_AST_TYPE 7 | constructor (data) { 8 | super(data) 9 | this.name = data.name 10 | this.miniType = data.miniType 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/taro-quickapp/src/pure-component.js: -------------------------------------------------------------------------------- 1 | import { shallowEqual } from '@tarojs/utils' 2 | 3 | import Component from './component' 4 | 5 | class PureComponent extends Component { 6 | isPureComponent = true 7 | 8 | shouldComponentUpdate (nextProps, nextState) { 9 | return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState) 10 | } 11 | } 12 | 13 | export default PureComponent 14 | -------------------------------------------------------------------------------- /packages/taro-weapp/src/pure-component.js: -------------------------------------------------------------------------------- 1 | import { shallowEqual } from '@tarojs/utils' 2 | 3 | import Component from './component' 4 | 5 | class PureComponent extends Component { 6 | isPureComponent = true 7 | 8 | shouldComponentUpdate (nextProps, nextState) { 9 | return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState) 10 | } 11 | } 12 | 13 | export default PureComponent 14 | -------------------------------------------------------------------------------- /packages/taro/src/memo.js: -------------------------------------------------------------------------------- 1 | import { isFunction } from './util' 2 | import shallowEqual from '@tarojs/utils/src/shallow-equal' 3 | 4 | export function memo (component, propsAreEqual) { 5 | component.prototype.shouldComponentUpdate = function (nextProps) { 6 | return isFunction(propsAreEqual) ? !propsAreEqual(this.props, nextProps) : !shallowEqual(this.props, nextProps) 7 | } 8 | 9 | return component 10 | } 11 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/picker-view-column/index.js: -------------------------------------------------------------------------------- 1 | import Nerv from 'nervjs' 2 | 3 | class PickerViewColumn extends Nerv.Component { 4 | componentDidMount () { 5 | console.error('H5 暂不支持 PickerViewColumn 组件!') 6 | } 7 | 8 | render () { 9 | const { ...rest } = this.props 10 | return
{this.props.children}
11 | } 12 | } 13 | 14 | export default PickerViewColumn 15 | -------------------------------------------------------------------------------- /packages/taro-rn-runner/src/plugins/TaroNormalModule.ts: -------------------------------------------------------------------------------- 1 | import * as NormalModule from 'webpack/lib/NormalModule' 2 | import { PARSE_AST_TYPE } from '../utils/constants' 3 | 4 | export default class TaroNormalModule extends NormalModule { 5 | name: string 6 | miniType: PARSE_AST_TYPE 7 | constructor (data) { 8 | super(data) 9 | this.name = data.name 10 | this.miniType = data.miniType 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/postcss-pxtransform/lib/pixel-unit-regex.js: -------------------------------------------------------------------------------- 1 | /*eslint-disable*/ 2 | 3 | // excluding regex trick: http://www.rexegg.com/regex-best-trick.html 4 | 5 | // Not anything inside double quotes 6 | // Not anything inside single quotes 7 | // Not anything inside url() 8 | // Any digit followed by px 9 | // !singlequotes|!doublequotes|!url()|pixelunit 10 | 11 | module.exports = /"[^"]+"|'[^']+'|url\([^\)]+\)|(\d*\.?\d+)px/g 12 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/switch/index.md: -------------------------------------------------------------------------------- 1 | switch 2 | 3 | ## API 4 | 5 | | | 属性 | 类型 | 默认值 | 说明 | 6 | | --- | ------- | ------- | ------ | ------------------------------ | 7 | | √ | checked | Boolean | false | 是否选中 | 8 | | √ | type | String | switch | 样式,有效值:switch, checkbox | 9 | | | color | Color | | switch 的颜色,同 css 的 color | 10 | -------------------------------------------------------------------------------- /packages/taro-quickapp/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'presets': [ 3 | ['@babel/preset-env', { 4 | // 'modules': 'umd', 5 | 'spec': true 6 | }] 7 | ], 8 | 'plugins': [ 9 | '@babel/plugin-proposal-class-properties', 10 | '@babel/plugin-proposal-object-rest-spread', 11 | ['@babel/plugin-transform-react-jsx', { 12 | 'pragma': 'Nerv.createElement' 13 | }] 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /packages/taro-rn/example/pages/media/Map.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { View, Text } from 'react-native' 3 | import { styles } from '../styles' 4 | 5 | export default class Map extends React.Component { 6 | constructor (props) { 7 | super(props) 8 | } 9 | 10 | render () { 11 | return ( 12 | 13 | 地图 14 | 15 | ) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /scripts/write.ts: -------------------------------------------------------------------------------- 1 | import * as fs from "fs" 2 | import * as path from "path" 3 | 4 | export default function writeFile (route: string, text: string = '') { 5 | if (!route || !text) return 6 | try { 7 | fs.writeFileSync(route, text, {}) 8 | } catch (error) { 9 | const routepath = path.parse(route) 10 | fs.mkdirSync(routepath.dir, { recursive: true }) 11 | fs.writeFileSync(route, text, {}) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/taroize/src/global.ts: -------------------------------------------------------------------------------- 1 | export const usedComponents = new Set() 2 | 3 | export const errors: string[] = [] 4 | 5 | export const globals = { 6 | hasCatchTrue: false 7 | } 8 | 9 | export const resetGlobals = () => { 10 | globals.hasCatchTrue = false 11 | // tslint:disable-next-line: no-use-before-declare 12 | THIRD_PARTY_COMPONENTS.clear() 13 | } 14 | 15 | export const THIRD_PARTY_COMPONENTS = new Set() 16 | -------------------------------------------------------------------------------- /website/versioned_docs/version-2.0.3/apis/device/wifi/WifiInfo.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: WifiInfo 3 | sidebar_label: WifiInfo 4 | id: version-2.0.3-WifiInfo 5 | original_id: WifiInfo 6 | --- 7 | 8 | Wifi 信息 9 | 10 | ## 方法 11 | 12 | | 参数 | 类型 | 说明 | 13 | | --- | --- | --- | 14 | | BSSID | `string` | Wi-Fi 的 BSSID | 15 | | SSID | `string` | Wi-Fi 的 SSID | 16 | | secure | `boolean` | Wi-Fi 是否安全 | 17 | | signalStrength | `number` | Wi-Fi 信号强度 | 18 | -------------------------------------------------------------------------------- /packages/css-to-react-native/src/transforms/media-queries/features.js: -------------------------------------------------------------------------------- 1 | export const dimensionFeatures = [ 2 | "width", 3 | "height", 4 | "device-width", 5 | "device-height", 6 | ]; 7 | export const mediaQueryFeatures = [ 8 | "orientation", 9 | "scan", 10 | "resolution", 11 | "aspect-ratio", 12 | "device-aspect-ratio", 13 | "grid", 14 | "color", 15 | "color-index", 16 | "monochrome", 17 | ].concat(dimensionFeatures); 18 | -------------------------------------------------------------------------------- /packages/taro-quickapp/src/api/index.js: -------------------------------------------------------------------------------- 1 | // 未实现 2 | 3 | // 已实现 api 4 | export * from './request' 5 | export * from './storage' 6 | export * from './router' 7 | export * from './interactive' 8 | export * from './equipment' 9 | export * from './share' 10 | export * from './notification' 11 | export * from './system' 12 | export * from './webview' 13 | export * from './media' 14 | export * from './device' 15 | export * from './unsupportedApi' 16 | -------------------------------------------------------------------------------- /packages/taro-redux-h5/react-redux/utils/tryToCall.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 尝试调用函数 3 | * 4 | * @param {function} func 调用的函数 5 | * @param {any} ctx 调用上下文 6 | * @param {...any} args 函数调用参数 7 | * @returns {any} returnValue 8 | */ 9 | export const tryToCall = (func, ctx = null, ...args) => { 10 | if (!func) return 11 | if (ctx) { 12 | return func.apply(ctx, args) 13 | } else { 14 | return func(...args) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/taro-redux/src/utils/batch.js: -------------------------------------------------------------------------------- 1 | // Default to a dummy "batch" implementation that just runs the callback 2 | function defaultNoopBatch (callback) { 3 | callback() 4 | } 5 | 6 | let batch = defaultNoopBatch 7 | 8 | // Allow injecting another batching function later 9 | export const setBatch = newBatch => (batch = newBatch) 10 | 11 | // Supply a getter just to skip dealing with ESM bindings 12 | export const getBatch = () => batch 13 | -------------------------------------------------------------------------------- /packages/eslint-config-taro/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | 7 | ## [0.0.69-beta.1](https://github.com/NervJS/taro/compare/v0.0.69-beta.0...v0.0.69-beta.1) (2018-07-09) 8 | 9 | 10 | 11 | 12 | **Note:** Version bump only for package eslint-config-taro 13 | -------------------------------------------------------------------------------- /packages/taro-components-rn/__tests__/view.spec.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | // import 'react-native' 3 | import { _View } from '../src/components/view' 4 | import * as renderer from 'react-test-renderer' 5 | 6 | describe('', () => { 7 | it('renders correctly', () => { 8 | const tree = renderer 9 | .create( 10 | <_View /> 11 | ) 12 | .toJSON() 13 | expect(tree).toMatchSnapshot() 14 | }) 15 | }) 16 | -------------------------------------------------------------------------------- /packages/taro-router-rn/__tests__/__snapshots__/RefreshProvider.spec.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`RefreshProvider should render success 1`] = ` 4 | 15 | 16 | 17 | `; 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-2.0.3/apis/base/env/env.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.env() 3 | sidebar_label: env 4 | id: version-2.0.3-env 5 | original_id: env 6 | --- 7 | 8 | > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/base/env/envObj.html) 9 | 10 | ## 类型 11 | 12 | ```tsx 13 | typeof env 14 | ``` 15 | 16 | ## API 支持度 17 | 18 | | API | 微信小程序 | H5 | React Native | 19 | | :---: | :---: | :---: | :---: | 20 | | Taro.env | ✔️ | | | 21 | -------------------------------------------------------------------------------- /website/versioned_docs/version-2.0.3/apis/canvas/drawCanvas.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.drawCanvas(不推荐使用) 3 | sidebar_label: drawCanvas 4 | id: version-2.0.3-drawCanvas 5 | original_id: drawCanvas 6 | --- 7 | 8 | 9 | 使用方式同 [`wx.drawCanvas`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/draw-canvas.html)。 10 | 11 | ## API支持度 12 | 13 | | API | 微信小程序 | H5 | React Native | 14 | | :-: | :-: | :-: | :-: | 15 | | Taro.drawCanvas | ✔️ | | | 16 | -------------------------------------------------------------------------------- /docs/specials.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 常见问题 3 | --- 4 | 5 | - [Issue #46](https://github.com/NervJS/taro/issues/46),`redux-saga` 的引入问题处理 6 | 7 | - 在 H5 模式下,tabBar 可能会挡住页面 fixed 元素问题:这是因为与小程序的 tabBar 不同,在 H5 下 tabBar 是一个普通的组件,当页面中存在 `fixed(bottom)` 定位的元素时,其表现会与小程序中不一致。Taro 提供了一个适配的方法: 8 | 9 | 例如: 10 | 11 | ```css 12 | .fixed { 13 | bottom: 0; 14 | /* 在 H5 模式下将会编译成 margin-bottom: 50px,在小程序模式下则会忽略 */ 15 | margin-bottom: taro-tabbar-height; 16 | } 17 | ``` 18 | -------------------------------------------------------------------------------- /packages/taro-cli/src/doctor/validatorEslintrc.ts: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'extends': ['taro'], 3 | 'rules': { 4 | 'no-unused-vars': ['error', { 'varsIgnorePattern': 'Taro' }], 5 | 'react/jsx-filename-extension': [1, { 'extensions': ['.js', '.jsx', '.tsx'] }] 6 | }, 7 | 'parser': '@typescript-eslint/parser', 8 | 'parserOptions': { 9 | 'ecmaFeatures': { 10 | 'jsx': true 11 | }, 12 | 'useJSXTextNode': true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/taro-service/types/Plugin.d.ts: -------------------------------------------------------------------------------- 1 | import Kernel from './Kernel'; 2 | import { IHook, ICommand, IPlatform } from '../src/utils/types'; 3 | export default class Plugin { 4 | id: string; 5 | path: string; 6 | ctx: Kernel; 7 | constructor(opts: any); 8 | register(hook: IHook): void; 9 | registerCommand(command: ICommand): void; 10 | registerPlatform(platform: IPlatform): void; 11 | registerMethod(...args: any[]): void; 12 | } 13 | -------------------------------------------------------------------------------- /packages/stylelint-taro-rn/src/rules/index.js: -------------------------------------------------------------------------------- 1 | import cssPropertyNoUnknown from "./css-property-no-unknown"; 2 | import stylePropertyNoUnknown from "./style-property-no-unknown"; 3 | import fontWeightNoIgnoredValues from "./font-weight-no-ignored-values"; 4 | 5 | export default { 6 | "font-weight-no-ignored-values": fontWeightNoIgnoredValues, 7 | "css-property-no-unknown": cssPropertyNoUnknown, 8 | "style-property-no-unknown": stylePropertyNoUnknown 9 | }; 10 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/textarea/__test__/textarea.test.js: -------------------------------------------------------------------------------- 1 | import Nerv from 'nervjs' 2 | import { renderIntoDocument } from 'nerv-test-utils' 3 | import Textarea from '../index' 4 | 5 | describe('Textarea', () => { 6 | it('render Textarea', () => { 7 | const component = renderIntoDocument() 8 | const dom = Nerv.findDOMNode(component) 9 | expect(dom.textContent).toEqual('hello taro') 10 | }) 11 | }) 12 | -------------------------------------------------------------------------------- /packages/taro-mobx-common/src/reporter.js: -------------------------------------------------------------------------------- 1 | class EventEmitter { 2 | listeners = [] 3 | 4 | on (cb) { 5 | this.listeners.push(cb) 6 | return () => { 7 | const index = this.listeners.indexOf(cb) 8 | if (index !== -1) { 9 | this.listeners.splice(index, 1) 10 | } 11 | } 12 | } 13 | 14 | emit (data) { 15 | this.listeners.forEach(fn => fn(data)) 16 | } 17 | } 18 | 19 | export const errorsReporter = new EventEmitter() 20 | -------------------------------------------------------------------------------- /packages/taro/src/internal/get-original.js: -------------------------------------------------------------------------------- 1 | import { ENV_TYPE, getEnv } from '../env' 2 | 3 | function isObject (arg) { 4 | return arg === Object(arg) && typeof arg !== 'function' 5 | } 6 | 7 | let env = null 8 | 9 | export function getOriginal (item) { 10 | if (env === null) { 11 | env = getEnv() 12 | } 13 | if (isObject(item)) { 14 | return item[env === ENV_TYPE.SWAN ? 'privateOriginal' : '$original'] || item 15 | } 16 | return item 17 | } 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/hybrid.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro 代码与小程序代码混写 3 | id: version-1.3.14-hybrid 4 | original_id: hybrid 5 | --- 6 | 7 | Taro 项目 支持 Taro 的代码与小程序(微信/百度/支付宝/字节跳动)原生的页面、组件代码混合存在,只需要将原生的页面、组件代码放入 `src` 目录下,随后在 入口文件 `app.js` 中定义好 `pages` 配置指向对应的原生的页面即可,在原生页面的配置中,你可以通过 `usingComponents` 来定义需要引入的组件,这里可以指定 Taro 组件同时也可以指定小程序原生的组件。 8 | 9 | `usingComponents` 指定的小程序原生组件名字需要以**小写**开头。 10 | 11 | > 请参考示例项目:https://github.com/NervJS/taro-sample-weapp 12 | -------------------------------------------------------------------------------- /packages/taro-cli/templates/default/config/prod.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | NODE_ENV: '"production"' 4 | }, 5 | defineConstants: {}, 6 | mini: {}, 7 | h5: { 8 | /** 9 | * 如果h5端编译后体积过大,可以使用webpack-bundle-analyzer插件对打包体积进行分析。 10 | * 参考代码如下: 11 | * webpackChain (chain) { 12 | * chain.plugin('analyzer') 13 | * .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, []) 14 | * } 15 | */ 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/taro-components/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | 7 | ## [0.0.67-beta.3](https://github.com/NervJS/taro/compare/v0.0.67-beta.2...v0.0.67-beta.3) (2018-07-04) 8 | 9 | 10 | ### Features 11 | 12 | * 重构swiper 组件 ([d10a9df](https://github.com/NervJS/taro/commit/d10a9df)) 13 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/label/__test__/label.test.js: -------------------------------------------------------------------------------- 1 | import Nerv from 'nervjs' 2 | import { renderIntoDocument } from 'nerv-test-utils' 3 | import Label from '../index' 4 | 5 | describe('Label', () => { 6 | it('render Label', () => { 7 | const label = 8 | const component = renderIntoDocument(label) 9 | const dom = Nerv.findDOMNode(component) 10 | expect(dom.textContent).toEqual('hello taro') 11 | }) 12 | }) 13 | -------------------------------------------------------------------------------- /docs/apis/framework/Page.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Page 3 | sidebar_label: Page 4 | --- 5 | 6 | 注册小程序中的一个页面。接受一个 `Object` 类型参数,其指定页面的初始数据、生命周期回调、事件处理函数等。 7 | 8 | ## 方法 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
参数类型说明
routestring当前页面的路径
26 | -------------------------------------------------------------------------------- /packages/taro-async-await/index.js: -------------------------------------------------------------------------------- 1 | // support for async functions 2 | 3 | if (process.env.TARO_ENV !== 'alipay') { 4 | var g = typeof window !== 'undefined' && 5 | window.Math === Math ? window : typeof global === 'object' ? global : this 6 | 7 | if (!g.Promise) { 8 | g.Promise = require('promise-polyfill') 9 | } 10 | if (!g.regeneratorRuntime) { 11 | g.regeneratorRuntime = require('regenerator-runtime/runtime') 12 | } 13 | } else { 14 | void 0 15 | } 16 | -------------------------------------------------------------------------------- /packages/taro-service/types/Config.d.ts: -------------------------------------------------------------------------------- 1 | import { IProjectConfig } from '@tarojs/taro/types/compile'; 2 | interface IConfigOptions { 3 | appPath: string; 4 | } 5 | export default class Config { 6 | appPath: string; 7 | configPath: string; 8 | initialConfig: IProjectConfig; 9 | isInitSuccess: boolean; 10 | constructor(opts: IConfigOptions); 11 | init(): void; 12 | getConfigWithNamed(platform: any, useConfigName: any): any; 13 | } 14 | export {}; 15 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.23/apis/canvas/drawCanvas.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.drawCanvas(不推荐使用) 3 | sidebar_label: drawCanvas 4 | id: version-1.3.23-drawCanvas 5 | original_id: drawCanvas 6 | --- 7 | 8 | 9 | 使用方式同 [`wx.drawCanvas`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/draw-canvas.html)。 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 17 | | :-: | :-: | :-: | :-: | 18 | | Taro.drawCanvas | ✔️ | | | 19 | 20 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.23/apis/ui/navigationbar/hideNavigationBarLoading.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.hideNavigationBarLoading() 3 | sidebar_label: hideNavigationBarLoading 4 | id: version-1.3.23-hideNavigationBarLoading 5 | original_id: hideNavigationBarLoading 6 | --- 7 | 8 | 9 | 隐藏导航条加载动画。 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 17 | | :-: | :-: | :-: | :-: | 18 | | Taro.hideNavigationBarLoading | ✔️ | | ✔️ | 19 | 20 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/interface/navigationbar/hideNavigationBarLoading.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.hideNavigationBarLoading() 3 | sidebar_label: hideNavigationBarLoading 4 | id: version-1.3.14-hideNavigationBarLoading 5 | original_id: hideNavigationBarLoading 6 | --- 7 | 8 | 9 | 隐藏导航条加载动画。 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 17 | | :-: | :-: | :-: | :-: | 18 | | Taro.hideNavigationBarLoading | ✔️ | | ✔️ | 19 | 20 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.23/apis/ui/navigationbar/showNavigationBarLoading.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.showNavigationBarLoading() 3 | sidebar_label: showNavigationBarLoading 4 | id: version-1.3.23-showNavigationBarLoading 5 | original_id: showNavigationBarLoading 6 | --- 7 | 8 | 9 | 在当前页面显示导航条加载动画。 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 17 | | :-: | :-: | :-: | :-: | 18 | | Taro.showNavigationBarLoading | ✔️ | | ✔️ | 19 | 20 | -------------------------------------------------------------------------------- /docs/components/open/others.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 其他 3 | sidebar_label: 其他 4 | --- 5 | 6 | ##### 其他组件 7 | 8 | 除导航列表的一些组件外,还有一些差异化组件,每个端不同,后续计划将这些统一封装。目前差异化组件请详看各小程序官网。 9 | 10 | >其他组件请看各小程序官方文档 11 | 12 | [微信小程序](https://developers.weixin.qq.com/miniprogram/dev/component/)。 13 | 14 | [百度小程序](https://smartprogram.baidu.com/docs/develop/component/view/)。 15 | 16 | [支付宝小程序](https://docs.alipay.com/mini/component/overview)。 17 | 18 | [字节跳动小程序](https://developer.toutiao.com/docs/comp/)。 19 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/quickapp/style/declaration/transform/transform.ts: -------------------------------------------------------------------------------- 1 | const nameList = ['translate', 'translateX', 'translateY', 'scale', 'scaleX', 'scaleY', 'rotate', 'rotateX', 'rotateY'] 2 | 3 | export default { 4 | 'transform': (value, declaration, addDeclaration) => { 5 | const name = value.match(/\w+/)[0] 6 | if (!~nameList.indexOf(name)) { 7 | return 'I:' 8 | } 9 | if (~value.indexOf('%')) { 10 | return 'I:' 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/interface/canvas/drawCanvas.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.drawCanvas(不推荐使用) 3 | sidebar_label: drawCanvas 4 | id: version-1.3.14-drawCanvas 5 | original_id: drawCanvas 6 | --- 7 | 8 | 9 | 使用方式同 [`wx.drawCanvas`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/draw-canvas.html)。 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 17 | | :-: | :-: | :-: | :-: | 18 | | Taro.drawCanvas | ✔️ | | | 19 | 20 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/interface/navigationbar/showNavigationBarLoading.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.showNavigationBarLoading() 3 | sidebar_label: showNavigationBarLoading 4 | id: version-1.3.14-showNavigationBarLoading 5 | original_id: showNavigationBarLoading 6 | --- 7 | 8 | 9 | 在当前页面显示导航条加载动画。 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 17 | | :-: | :-: | :-: | :-: | 18 | | Taro.showNavigationBarLoading | ✔️ | | ✔️ | 19 | 20 | -------------------------------------------------------------------------------- /docs/apis/about/env.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 环境判断 3 | --- 4 | 5 | ## Taro.ENV_TYPE 6 | 7 | `ENV_TYPE.WEAPP` 微信小程序环境 8 | 9 | `ENV_TYPE.SWAN` 百度小程序环境 10 | 11 | `ENV_TYPE.ALIPAY` 支付宝小程序环境 12 | 13 | `ENV_TYPE.TT` 字节跳动小程序环境 14 | 15 | `ENV_TYPE.WEB` WEB(H5)环境 16 | 17 | `ENV_TYPE.RN` ReactNative 环境 18 | 19 | `ENV_TYPE.QUICKAPP` 快应用环境 20 | 21 | `ENV_TYPE.QQ` QQ小程序 环境 22 | 23 | `ENV_TYPE.JD` 京东小程序 环境 24 | 25 | ## Taro.getEnv() 26 | 27 | 获取当前环境值,具体值如上 `Taro.ENV_TYPE` 28 | -------------------------------------------------------------------------------- /packages/taro-cli/src/commands/update.ts: -------------------------------------------------------------------------------- 1 | import { Kernel } from '@tarojs/service' 2 | 3 | export default function update (kernel: Kernel, { 4 | appPath, 5 | updateType, 6 | version, 7 | isHelp 8 | }: { 9 | appPath: string, 10 | updateType: string, 11 | version?: string, 12 | isHelp?: boolean 13 | }) { 14 | kernel.run({ 15 | name: 'update', 16 | opts: { 17 | appPath, 18 | updateType, 19 | version, 20 | isHelp 21 | } 22 | }) 23 | } 24 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/multimedia/backgroundaudio/onBackgroundAudioPlay.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.onBackgroundAudioPlay(CALLBACK) 3 | sidebar_label: onBackgroundAudioPlay 4 | id: version-1.3.14-onBackgroundAudioPlay 5 | original_id: onBackgroundAudioPlay 6 | --- 7 | 8 | 9 | 监听音乐播放。 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 支付宝小程序 | 百度小程序 | 17 | | :-: | :-: | :-: | :-: | :-: | :-: | 18 | | Taro.onBackgroundAudioPlay | ✔️ | | | 19 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/multimedia/backgroundaudio/onBackgroundAudioStop.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.onBackgroundAudioStop(CALLBACK) 3 | sidebar_label: onBackgroundAudioStop 4 | id: version-1.3.14-onBackgroundAudioStop 5 | original_id: onBackgroundAudioStop 6 | --- 7 | 8 | 9 | 监听音乐停止。 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 支付宝小程序 | 百度小程序 | 17 | | :-: | :-: | :-: | :-: | :-: | :-: | 18 | | Taro.onBackgroundAudioStop | ✔️ | | | 19 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.23/apis/media/background-audio/onBackgroundAudioPlay.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.onBackgroundAudioPlay(CALLBACK) 3 | sidebar_label: onBackgroundAudioPlay 4 | id: version-1.3.23-onBackgroundAudioPlay 5 | original_id: onBackgroundAudioPlay 6 | --- 7 | 8 | 9 | 监听音乐播放。 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 支付宝小程序 | 百度小程序 | 17 | | :-: | :-: | :-: | :-: | :-: | :-: | 18 | | Taro.onBackgroundAudioPlay | ✔️ | | | 19 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.23/apis/media/background-audio/onBackgroundAudioStop.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.onBackgroundAudioStop(CALLBACK) 3 | sidebar_label: onBackgroundAudioStop 4 | id: version-1.3.23-onBackgroundAudioStop 5 | original_id: onBackgroundAudioStop 6 | --- 7 | 8 | 9 | 监听音乐停止。 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 支付宝小程序 | 百度小程序 | 17 | | :-: | :-: | :-: | :-: | :-: | :-: | 18 | | Taro.onBackgroundAudioStop | ✔️ | | | 19 | -------------------------------------------------------------------------------- /packages/taro-components-rn/src/components/Switch/PropsType.tsx: -------------------------------------------------------------------------------- 1 | import { StyleProp, ViewStyle } from 'react-native' 2 | 3 | export type EventOnChange = { 4 | detail: { 5 | value: boolean 6 | } 7 | } 8 | 9 | export interface SwitchState { 10 | checked: boolean; 11 | } 12 | 13 | export interface SwitchProps { 14 | style?: StyleProp; 15 | checked?: boolean; 16 | type: 'switch' | 'checkbox'; 17 | color: string; 18 | onChange?: (evt: EventOnChange) => void; 19 | } 20 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/device/nfc/onHCEMessage.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.onHCEMessage(CALLBACK) 3 | sidebar_label: onHCEMessage 4 | id: version-1.3.14-onHCEMessage 5 | original_id: onHCEMessage 6 | --- 7 | 8 | 9 | 使用方式同 [`wx.onHCEMessage`](https://developers.weixin.qq.com/miniprogram/dev/api/wx.onHCEMessage.html)。 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 17 | | :-: | :-: | :-: | :-: | 18 | | Taro.onHCEMessage | ✔️ | | | 19 | 20 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.23/apis/media/background-audio/onBackgroundAudioPause.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.onBackgroundAudioPause(CALLBACK) 3 | sidebar_label: onBackgroundAudioPause 4 | id: version-1.3.23-onBackgroundAudioPause 5 | original_id: onBackgroundAudioPause 6 | --- 7 | 8 | 9 | 监听音乐暂停。 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 支付宝小程序 | 百度小程序 | 17 | | :-: | :-: | :-: | :-: | :-: | :-: | 18 | | Taro.onBackgroundAudioPause | ✔️ | | | 19 | -------------------------------------------------------------------------------- /docs/apis/files/getFileSystemManager.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.getFileSystemManager() 3 | sidebar_label: getFileSystemManager 4 | --- 5 | 6 | 获取全局唯一的文件管理器 7 | 8 | > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileSystemManager.html) 9 | 10 | ## 类型 11 | 12 | ```tsx 13 | () => FileSystemManager 14 | ``` 15 | 16 | ## 参数 17 | 18 | ## API 支持度 19 | 20 | | API | 微信小程序 | H5 | React Native | 21 | | :---: | :---: | :---: | :---: | 22 | | Taro.getFileSystemManager | ✔️ | | | 23 | -------------------------------------------------------------------------------- /packages/eslint-plugin-taro/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | 7 | ## [0.0.69-beta.1](https://github.com/NervJS/taro/compare/v0.0.69-beta.0...v0.0.69-beta.1) (2018-07-09) 8 | 9 | 10 | ### Bug Fixes 11 | 12 | * **eslint:** this.$rourer 触发 JSX 事件名 ([1af94f3](https://github.com/NervJS/taro/commit/1af94f3)) 13 | -------------------------------------------------------------------------------- /packages/taro-components-rn/src/components/Form/PropsType.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { ViewStyle, StyleProp } from 'react-native' 3 | 4 | export type FormValues = { 5 | [key: string]: any; 6 | } 7 | 8 | export type EventOnSubmit = { 9 | detail: { 10 | value: any; 11 | } 12 | } 13 | 14 | export interface FormProps { 15 | children: React.ReactNode; 16 | style?: StyleProp; 17 | onSubmit?: (evt: EventOnSubmit) => void; 18 | onReset?: () => void; 19 | } 20 | -------------------------------------------------------------------------------- /packages/taro-h5/src/api/system/index.js: -------------------------------------------------------------------------------- 1 | import { getSystemInfo, getSystemInfoSync } from './info' 2 | import { getNetworkType, onNetworkStatusChange } from './network' 3 | import { processOpenapi } from '../utils' 4 | 5 | export const scanCode = processOpenapi('scanQRCode', { needResult: 1 }, res => ({ 6 | errMsg: res.errMsg === 'scanQRCode:ok' ? 'scanCode:ok' : res.errMsg, 7 | result: res.resultStr 8 | })) 9 | export { getSystemInfo, getSystemInfoSync, getNetworkType, onNetworkStatusChange } 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/device/wifi/onGetWifiList.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.onGetWifiList(CALLBACK) 3 | sidebar_label: onGetWifiList 4 | id: version-1.3.14-onGetWifiList 5 | original_id: onGetWifiList 6 | --- 7 | 8 | 9 | 使用方式同 [`wx.onGetWifiList`](https://developers.weixin.qq.com/miniprogram/dev/api/wx.onGetWifiList.html)。 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 17 | | :-: | :-: | :-: | :-: | 18 | | Taro.onGetWifiList | ✔️ | | | 19 | 20 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/multimedia/backgroundaudio/onBackgroundAudioPause.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.onBackgroundAudioPause(CALLBACK) 3 | sidebar_label: onBackgroundAudioPause 4 | id: version-1.3.14-onBackgroundAudioPause 5 | original_id: onBackgroundAudioPause 6 | --- 7 | 8 | 9 | 监听音乐暂停。 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 支付宝小程序 | 百度小程序 | 17 | | :-: | :-: | :-: | :-: | :-: | :-: | 18 | | Taro.onBackgroundAudioPause | ✔️ | | | 19 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/network/socket/closeSocket.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.closeSocket 3 | sidebar_label: closeSocket 4 | id: version-1.3.14-closeSocket 5 | original_id: closeSocket 6 | --- 7 | 8 | 9 | `@Deprecated` 请使用 **SocketTask.close** 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 支付宝小程序 | 百度小程序 | 17 | | :-: | :-: | :-: | :-: | :-: | :-: | 18 | | SocketTask | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 19 | | Taro.closeSocket | ✔️ | | | ✔️ | ✔️ | 20 | 21 | -------------------------------------------------------------------------------- /docs/apis/canvas/createOffscreenCanvas.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.createOffscreenCanvas() 3 | sidebar_label: createOffscreenCanvas 4 | --- 5 | 6 | 创建离屏 canvas 实例 7 | 8 | > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html) 9 | 10 | ## 类型 11 | 12 | ```tsx 13 | () => OffscreenCanvas 14 | ``` 15 | 16 | ## 参数 17 | 18 | ## API 支持度 19 | 20 | | API | 微信小程序 | H5 | React Native | 21 | | :---: | :---: | :---: | :---: | 22 | | Taro.createOffscreenCanvas | ✔️ | | | 23 | -------------------------------------------------------------------------------- /packages/taro-cli/src/commands/config.ts: -------------------------------------------------------------------------------- 1 | import { Kernel } from '@tarojs/service' 2 | 3 | export default function config (kernel: Kernel, { 4 | cmd, 5 | key, 6 | value, 7 | json, 8 | isHelp 9 | }: { 10 | cmd: string, 11 | key?: string, 12 | value?: string, 13 | json?: boolean, 14 | isHelp?: boolean 15 | }) { 16 | kernel.run({ 17 | name: 'config', 18 | opts: { 19 | cmd, 20 | key, 21 | value, 22 | json, 23 | isHelp 24 | } 25 | }) 26 | } 27 | -------------------------------------------------------------------------------- /packages/taro-cli/src/config/babel.ts: -------------------------------------------------------------------------------- 1 | const babelOptions: IBabelOptions = { 2 | sourceMap: true, 3 | presets: [ 4 | 'env' 5 | ], 6 | plugins: [ 7 | require('babel-plugin-transform-react-jsx'), 8 | 'transform-decorators-legacy', 9 | 'transform-class-properties', 10 | 'transform-object-rest-spread' 11 | ] 12 | } 13 | 14 | export default babelOptions 15 | 16 | export interface IBabelOptions { 17 | sourceMap: boolean, 18 | presets: string[], 19 | plugins: any[] 20 | } 21 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/tabbar/panel.js: -------------------------------------------------------------------------------- 1 | import 'weui' 2 | import Nerv from 'nervjs' 3 | import classNames from 'classnames' 4 | import View from '../view' 5 | export default class TabbarPanel extends Nerv.Component { 6 | render () { 7 | const { children, className, ...reset } = this.props 8 | const cls = classNames('taro-tabbar__panel', className) 9 | return ( 10 | 11 | {children} 12 | 13 | ) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/taro-webpack-runner/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | 7 | ## [0.0.69-beta.1](https://github.com/NervJS/taro/compare/v0.0.69-beta.0...v0.0.69-beta.1) (2018-07-09) 8 | 9 | 10 | ### Bug Fixes 11 | 12 | * **webpack-runner:** 修复Dynamic Import后报错的问题 ([57db5ad](https://github.com/NervJS/taro/commit/57db5ad)) 13 | -------------------------------------------------------------------------------- /packages/taro-webpack-runner/src/config/build.conf.ts: -------------------------------------------------------------------------------- 1 | import { BuildConfig } from '../util/types'; 2 | 3 | export default ({ 4 | sourceRoot = 'src', 5 | outputRoot = 'dist', 6 | publicPath = '/', 7 | staticDirectory = 'static', 8 | chunkDirectory = 'chunk', 9 | designWidth = 750 10 | }: BuildConfig): Partial => { 11 | return { 12 | sourceRoot, 13 | outputRoot, 14 | publicPath, 15 | staticDirectory, 16 | chunkDirectory, 17 | designWidth 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.23/apis/network/webSocket/closeSocket.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.closeSocket 3 | sidebar_label: closeSocket 4 | id: version-1.3.23-closeSocket 5 | original_id: closeSocket 6 | --- 7 | 8 | 9 | `@Deprecated` 请使用 **SocketTask.close** 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 支付宝小程序 | 百度小程序 | 17 | | :-: | :-: | :-: | :-: | :-: | :-: | 18 | | SocketTask | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 19 | | Taro.closeSocket | ✔️ | | | ✔️ | ✔️ | 20 | 21 | -------------------------------------------------------------------------------- /packages/taro-helper/src/babel.ts: -------------------------------------------------------------------------------- 1 | const babelOptions: IBabelOptions = { 2 | sourceMap: true, 3 | presets: [ 4 | 'env' 5 | ], 6 | plugins: [ 7 | require('babel-plugin-transform-react-jsx'), // rn need 8 | 'transform-decorators-legacy', 9 | 'transform-class-properties', 10 | 'transform-object-rest-spread' 11 | ] 12 | } 13 | 14 | export default babelOptions 15 | 16 | export interface IBabelOptions { 17 | sourceMap: boolean, 18 | presets: string[], 19 | plugins: any[] 20 | } 21 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/config/babel.ts: -------------------------------------------------------------------------------- 1 | const babelOptions: IBabelOptions = { 2 | sourceMap: true, 3 | presets: [ 4 | 'env' 5 | ], 6 | plugins: [ 7 | require('babel-plugin-transform-react-jsx'), 8 | 'transform-decorators-legacy', 9 | 'transform-class-properties', 10 | 'transform-object-rest-spread' 11 | ] 12 | } 13 | 14 | export default babelOptions 15 | 16 | export interface IBabelOptions { 17 | sourceMap: boolean, 18 | presets: string[], 19 | plugins: any[] 20 | } 21 | -------------------------------------------------------------------------------- /packages/taro-quickapp/src/data-cache.js: -------------------------------------------------------------------------------- 1 | import appGlobal from './global' 2 | 3 | appGlobal.cacheData = appGlobal.cacheData || {} 4 | 5 | export function cacheDataSet (key, val) { 6 | appGlobal.cacheData[key] = val 7 | } 8 | 9 | export function cacheDataGet (key, delelteAfterGet) { 10 | const temp = appGlobal.cacheData[key] 11 | delelteAfterGet && delete appGlobal.cacheData[key] 12 | return temp 13 | } 14 | 15 | export function cacheDataHas (key) { 16 | return key in appGlobal.cacheData 17 | } 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/network/socket/onSocketOpen.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.onSocketOpen 3 | sidebar_label: onSocketOpen 4 | id: version-1.3.14-onSocketOpen 5 | original_id: onSocketOpen 6 | --- 7 | 8 | 9 | `@Deprecated` 请使用 **SocketTask.onOpen** 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 支付宝小程序 | 百度小程序 | 17 | | :-: | :-: | :-: | :-: | :-: | :-: | 18 | | SocketTask | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 19 | | Taro.onSocketOpen | ✔️ | | | ✔️ | ✔️ | 20 | 21 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.23/apis/network/webSocket/onSocketOpen.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.onSocketOpen 3 | sidebar_label: onSocketOpen 4 | id: version-1.3.23-onSocketOpen 5 | original_id: onSocketOpen 6 | --- 7 | 8 | 9 | `@Deprecated` 请使用 **SocketTask.onOpen** 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 支付宝小程序 | 百度小程序 | 17 | | :-: | :-: | :-: | :-: | :-: | :-: | 18 | | SocketTask | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 19 | | Taro.onSocketOpen | ✔️ | | | ✔️ | ✔️ | 20 | 21 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.26/apis/device/wifi/offGetWifiList.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.offGetWifiList(CALLBACK) 3 | sidebar_label: offGetWifiList 4 | id: version-1.3.26-offGetWifiList 5 | original_id: offGetWifiList 6 | --- 7 | 8 | 9 | 使用方式同 [`wx.offGetWifiList`](https://developers.weixin.qq.com/miniprogram/dev/api/wx.offGetWifiList.html)。 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 17 | | :-: | :-: | :-: | :-: | 18 | | Taro.offGetWifiList | ✔️ | | | 19 | 20 | -------------------------------------------------------------------------------- /packages/taro-components-rn/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | 7 | ## [0.0.67-beta.2](https://github.com/NervJS/taro/compare/v0.0.67-beta.1...v0.0.67-beta.2) (2018-07-04) 8 | 9 | 10 | ### Features 11 | 12 | * **tcr:** Picker 的 Dialog 模块重构,参考react-native-modal的思想 ([4562227](https://github.com/NervJS/taro/commit/4562227)) 13 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/tabbar/container.js: -------------------------------------------------------------------------------- 1 | import 'weui' 2 | import Nerv from 'nervjs' 3 | import classNames from 'classnames' 4 | import View from '../view' 5 | export default class TabbarContainer extends Nerv.Component { 6 | render () { 7 | const { children, className, ...reset } = this.props 8 | const cls = classNames('taro-tabbar__container', className) 9 | return ( 10 | 11 | {children} 12 | 13 | ) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/taro-mini-runner/src/quickapp/template-rewriter.ts: -------------------------------------------------------------------------------- 1 | import parseXml from './template/parser' 2 | import rewriteNode from './template/node' 3 | import serialize from './template/serialize' 4 | 5 | export default function rewriterTemplate (code : string): string { 6 | // 解析Code 7 | const viewNodes = parseXml(`${code}`).children 8 | // 解析视图组件 9 | const retNodes = rewriteNode(viewNodes) 10 | // 生成xml代码 11 | const templateCode = serialize(retNodes) 12 | return templateCode 13 | } 14 | -------------------------------------------------------------------------------- /packages/taro-rn-runner/src/config/babel_bak.ts: -------------------------------------------------------------------------------- 1 | const babelOptions: IBabelOptions = { 2 | sourceMap: true, 3 | presets: [ 4 | 'env' 5 | ], 6 | plugins: [ 7 | require('babel-plugin-transform-react-jsx'), 8 | 'transform-decorators-legacy', 9 | 'transform-class-properties', 10 | 'transform-object-rest-spread' 11 | ] 12 | } 13 | 14 | export default babelOptions 15 | 16 | export interface IBabelOptions { 17 | sourceMap: boolean, 18 | presets: string[], 19 | plugins: any[] 20 | } 21 | -------------------------------------------------------------------------------- /packages/taro-rn/src/__tests__/__mock__/mockNavigator.js: -------------------------------------------------------------------------------- 1 | const geolocation = { 2 | getCurrentPosition (callback, errFn) { 3 | const res = {} 4 | const coords = { 5 | latitude: 0, 6 | longitude: 0, 7 | speed: 0, 8 | accuracy: 0, 9 | altitude: 0 10 | } 11 | res.coords = coords 12 | res.timestamp = Date.now() 13 | callback && callback(res) 14 | } 15 | } 16 | 17 | const navigator = {} 18 | navigator.geolocation = geolocation 19 | 20 | export default navigator 21 | -------------------------------------------------------------------------------- /packages/taro-router-rn/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | verbose: true, 3 | preset: 'react-native', 4 | transform: { 5 | '^.+\\.js$': 'babel-jest' 6 | }, 7 | transformIgnorePatterns: ['node_modules/(?!(react-native|react-navigation|react-navigation-stack|react-native-screens|react-native-safe-area-view|react-navigation-tabs)/)'], 8 | setupTestFrameworkScriptFile: 'jest-enzyme', 9 | testEnvironment: 'enzyme', 10 | testEnvironmentOptions: { 11 | enzymeAdapter: 'react16' 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/device/ibeacon/onBeaconUpdate.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.onBeaconUpdate(CALLBACK) 3 | sidebar_label: onBeaconUpdate 4 | id: version-1.3.14-onBeaconUpdate 5 | original_id: onBeaconUpdate 6 | --- 7 | 8 | 9 | 使用方式同 [`wx.onBeaconUpdate`](https://developers.weixin.qq.com/miniprogram/dev/api/wx.onBeaconUpdate.html)。 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 17 | | :-: | :-: | :-: | :-: | 18 | | Taro.onBeaconUpdate | ✔️ | | | 19 | 20 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/network/socket/onSocketClose.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.onSocketClose 3 | sidebar_label: onSocketClose 4 | id: version-1.3.14-onSocketClose 5 | original_id: onSocketClose 6 | --- 7 | 8 | 9 | `@Deprecated` 请使用 **SocketTask.onClose** 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 支付宝小程序 | 百度小程序 | 17 | | :-: | :-: | :-: | :-: | :-: | :-: | 18 | | SocketTask | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 19 | | Taro.onSocketClose | ✔️ | | | ✔️ | ✔️ | 20 | 21 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/network/socket/onSocketError.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.onSocketError 3 | sidebar_label: onSocketError 4 | id: version-1.3.14-onSocketError 5 | original_id: onSocketError 6 | --- 7 | 8 | 9 | `@Deprecated` 请使用 **SocketTask.onError** 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 支付宝小程序 | 百度小程序 | 17 | | :-: | :-: | :-: | :-: | :-: | :-: | 18 | | SocketTask | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 19 | | Taro.onSocketError | ✔️ | | | ✔️ | ✔️ | 20 | 21 | -------------------------------------------------------------------------------- /packages/taro-redux-h5/react-redux/utils/isPlainObject.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {any} obj The object to inspect. 3 | * @returns {boolean} True if the argument appears to be a plain object. 4 | */ 5 | export default function isPlainObject(obj) { 6 | if (typeof obj !== 'object' || obj === null) return false 7 | 8 | let proto = obj 9 | while (Object.getPrototypeOf(proto) !== null) { 10 | proto = Object.getPrototypeOf(proto) 11 | } 12 | 13 | return Object.getPrototypeOf(obj) === proto 14 | } 15 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/device/wifi/onWifiConnected.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.onWifiConnected(CALLBACK) 3 | sidebar_label: onWifiConnected 4 | id: version-1.3.14-onWifiConnected 5 | original_id: onWifiConnected 6 | --- 7 | 8 | 9 | 使用方式同 [`wx.onWifiConnected`](https://developers.weixin.qq.com/miniprogram/dev/api/wx.onWifiConnected.html)。 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 17 | | :-: | :-: | :-: | :-: | 18 | | Taro.onWifiConnected | ✔️ | | | 19 | 20 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.23/apis/base/arrayBufferToBase64.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.arrayBufferToBase64(buffer) 3 | sidebar_label: arrayBufferToBase64 4 | id: version-1.3.23-arrayBufferToBase64 5 | original_id: arrayBufferToBase64 6 | --- 7 | 8 | 将 ArrayBuffer 数据转成 Base64 字符串。 9 | 10 | ## 类型 11 | 12 | ```tsx 13 | (buffer: arrayBuffer) => string 14 | ``` 15 | 16 | ## 示例代码 17 | 18 | ```tsx 19 | const arrayBuffer = new Uint8Array([11, 22, 33]) 20 | const base64 = Taro.arrayBufferToBase64(arrayBuffer) 21 | ``` 22 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.23/apis/network/webSocket/onSocketClose.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.onSocketClose 3 | sidebar_label: onSocketClose 4 | id: version-1.3.23-onSocketClose 5 | original_id: onSocketClose 6 | --- 7 | 8 | 9 | `@Deprecated` 请使用 **SocketTask.onClose** 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 支付宝小程序 | 百度小程序 | 17 | | :-: | :-: | :-: | :-: | :-: | :-: | 18 | | SocketTask | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 19 | | Taro.onSocketClose | ✔️ | | | ✔️ | ✔️ | 20 | 21 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.23/apis/network/webSocket/onSocketError.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.onSocketError 3 | sidebar_label: onSocketError 4 | id: version-1.3.23-onSocketError 5 | original_id: onSocketError 6 | --- 7 | 8 | 9 | `@Deprecated` 请使用 **SocketTask.onError** 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 支付宝小程序 | 百度小程序 | 17 | | :-: | :-: | :-: | :-: | :-: | :-: | 18 | | SocketTask | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 19 | | Taro.onSocketError | ✔️ | | | ✔️ | ✔️ | 20 | 21 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/video/utils.js: -------------------------------------------------------------------------------- 1 | export const formatTime = time => { 2 | if (time === null) return '' 3 | const sec = Math.round(time % 60) 4 | const min = Math.round((time - sec) / 60) 5 | return `${min < 10 ? `0${min}` : min}:${sec < 10 ? `0${sec}` : sec}` 6 | } 7 | 8 | export const calcDist = (x, y) => { 9 | return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) 10 | } 11 | 12 | export const normalizeNumber = number => { 13 | return Math.max(-1, Math.min(number, 1)) 14 | } 15 | -------------------------------------------------------------------------------- /packages/taro-components/types/PickerViewColumn.d.ts: -------------------------------------------------------------------------------- 1 | import { ComponentType } from 'react' 2 | import { StandardProps, CommonEventFunction } from './common' 3 | 4 | /** 滚动选择器子项 5 | * 仅可放置于 `` 中,其孩子节点的高度会自动设置成与 picker-view 的选中框的高度一致 6 | * @classification forms 7 | * @supported weapp, swan, alipay, tt 8 | * @see https://developers.weixin.qq.com/miniprogram/dev/component/picker-view-column.html 9 | */ 10 | declare const PickerViewColumn: ComponentType 11 | 12 | export { PickerViewColumn } 13 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.26/apis/device/wifi/offWifiConnected.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.offWifiConnected(CALLBACK) 3 | sidebar_label: offWifiConnected 4 | id: version-1.3.26-offWifiConnected 5 | original_id: offWifiConnected 6 | --- 7 | 8 | 9 | 使用方式同 [`wx.offWifiConnected`](https://developers.weixin.qq.com/miniprogram/dev/api/wx.offWifiConnected.html)。 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 17 | | :-: | :-: | :-: | :-: | 18 | | Taro.offWifiConnected | ✔️ | | | 19 | 20 | -------------------------------------------------------------------------------- /website/versioned_docs/version-2.0.3/apis/device/ibeacon/IBeaconInfo.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: IBeaconInfo 3 | sidebar_label: IBeaconInfo 4 | id: version-2.0.3-IBeaconInfo 5 | original_id: IBeaconInfo 6 | --- 7 | 8 | ## 方法 9 | 10 | | 参数 | 类型 | 说明 | 11 | | --- | --- | --- | 12 | | accuracy | `number` | iBeacon 设备的距离 | 13 | | major | `string` | iBeacon 设备的主 id | 14 | | minor | `string` | iBeacon 设备的次 id | 15 | | proximity | `number` | 表示设备距离的枚举值 | 16 | | rssi | `number` | 表示设备的信号强度 | 17 | | uuid | `string` | iBeacon 设备广播的 uuid | 18 | -------------------------------------------------------------------------------- /packages/taro-cli/templates/default/global.d.ts: -------------------------------------------------------------------------------- 1 | declare module "*.png"; 2 | declare module "*.gif"; 3 | declare module "*.jpg"; 4 | declare module "*.jpeg"; 5 | declare module "*.svg"; 6 | declare module "*.css"; 7 | declare module "*.less"; 8 | declare module "*.scss"; 9 | declare module "*.sass"; 10 | declare module "*.styl"; 11 | 12 | // @ts-ignore 13 | declare const process: { 14 | env: { 15 | TARO_ENV: 'weapp' | 'swan' | 'alipay' | 'h5' | 'rn' | 'tt' | 'quickapp' | 'qq'; 16 | [key: string]: any; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/network/socket/onSocketMessage.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.onSocketMessage 3 | sidebar_label: onSocketMessage 4 | id: version-1.3.14-onSocketMessage 5 | original_id: onSocketMessage 6 | --- 7 | 8 | 9 | `@Deprecated` 请使用 **SocketTask.onMessage** 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 支付宝小程序 | 百度小程序 | 17 | | :-: | :-: | :-: | :-: | :-: | :-: | 18 | | SocketTask | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 19 | | Taro.onSocketMessage | ✔️ | | | ✔️ | ✔️ | 20 | 21 | -------------------------------------------------------------------------------- /packages/taro-cli/src/commands/create.ts: -------------------------------------------------------------------------------- 1 | import { Kernel } from '@tarojs/service' 2 | 3 | export default function create (kernel: Kernel, { 4 | appPath, 5 | type, 6 | name, 7 | description, 8 | isHelp 9 | }: { 10 | appPath: string, 11 | type: string, 12 | name: string, 13 | description?: string, 14 | isHelp?: boolean 15 | }) { 16 | kernel.run({ 17 | name: 'create', 18 | opts: { 19 | appPath, 20 | type, 21 | name, 22 | description, 23 | isHelp 24 | } 25 | }) 26 | } 27 | -------------------------------------------------------------------------------- /packages/taro-plugin-csso/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@tarojs/plugin-csso", 3 | "version": "2.2.8", 4 | "description": "Taro压缩CSS文件", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/NervJS/taro.git" 12 | }, 13 | "keywords": [ 14 | "taro" 15 | ], 16 | "author": "luckyadam", 17 | "license": "MIT", 18 | "dependencies": { 19 | "csso": "^3.5.0" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/device/ble/closeBLEConnection.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.closeBLEConnection(OBJECT) 3 | sidebar_label: closeBLEConnection 4 | id: version-1.3.14-closeBLEConnection 5 | original_id: closeBLEConnection 6 | --- 7 | 8 | 使用方式同 [`wx.closeBLEConnection`](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.closeBLEConnection.html),支持 `Promise` 化使用。 9 | 10 | ## 示例代码 11 | 12 | ```jsx 13 | import Taro from '@tarojs/taro' 14 | 15 | Taro.closeBLEConnection(params).then(...) 16 | ``` 17 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/network/socket/sendSocketMessage.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.sendSocketMessage 3 | sidebar_label: sendSocketMessage 4 | id: version-1.3.14-sendSocketMessage 5 | original_id: sendSocketMessage 6 | --- 7 | 8 | 9 | `@Deprecated` 请使用 **SocketTask.send** 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 支付宝小程序 | 百度小程序 | 17 | | :-: | :-: | :-: | :-: | :-: | :-: | 18 | | SocketTask | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 19 | | Taro.sendSocketMessage | ✔️ | | | ✔️ | ✔️ | 20 | 21 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/storage/clearStorageSync.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.clearStorageSync() 3 | sidebar_label: clearStorageSync 4 | id: version-1.3.14-clearStorageSync 5 | original_id: clearStorageSync 6 | --- 7 | 8 | 9 | 同步清理本地数据缓存 10 | 11 | ## 示例代码 12 | 13 | ```jsx 14 | import Taro from '@tarojs/taro' 15 | 16 | Taro.clearStorageSync() 17 | ``` 18 | 19 | 20 | 21 | ## API支持度 22 | 23 | 24 | | API | 微信小程序 | H5 | React Native | 25 | | :-: | :-: | :-: | :-: | 26 | | Taro.clearStorageSync | ✔️ | ✔️ | | 27 | 28 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.23/apis/network/webSocket/onSocketMessage.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.onSocketMessage 3 | sidebar_label: onSocketMessage 4 | id: version-1.3.23-onSocketMessage 5 | original_id: onSocketMessage 6 | --- 7 | 8 | 9 | `@Deprecated` 请使用 **SocketTask.onMessage** 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 支付宝小程序 | 百度小程序 | 17 | | :-: | :-: | :-: | :-: | :-: | :-: | 18 | | SocketTask | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 19 | | Taro.onSocketMessage | ✔️ | | | ✔️ | ✔️ | 20 | 21 | -------------------------------------------------------------------------------- /packages/stylelint-taro-rn/src/utils/index.js: -------------------------------------------------------------------------------- 1 | export { endsWith } from "./endsWith"; 2 | export { isCustomProperty } from "./isCustomProperty"; 3 | export { isExportBlock } from "./isExportBlock"; 4 | export { isStandardSyntaxDeclaration } from "./isStandardSyntaxDeclaration"; 5 | export { isStandardSyntaxProperty } from "./isStandardSyntaxProperty"; 6 | export { isString } from "./isString"; 7 | export { kebabCase } from "./kebabCase"; 8 | export { namespace } from "./namespace"; 9 | export { optionsMatches } from "./optionsMatches"; 10 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/switch/__test__/switch.test.js: -------------------------------------------------------------------------------- 1 | import Nerv from 'nervjs' 2 | import { renderIntoDocument } from 'nerv-test-utils' 3 | import Switch from '../index' 4 | 5 | describe('Switch', () => { 6 | it('works', () => { 7 | const container = renderIntoDocument() 8 | expect(container.props.checked).toBeFalsy() 9 | }) 10 | it('should checked', () => { 11 | const container = renderIntoDocument() 12 | expect(container.props.checked).toBeTruthy() 13 | }) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/taro-h5/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | testMatch: ['/__test__/**/*-test.js'], 3 | setupFiles: ['jest-localstorage-mock'], 4 | setupFilesAfterEnv: [ 5 | 'jest-mock-console/dist/setupTestFramework.js' 6 | ], 7 | transform: { 8 | ".js": "babel-jest", 9 | }, 10 | moduleNameMapper: { 11 | "@tarojs/taro-h5": "/src/index.js", 12 | "(\\.(css|less|sass|scss))|weui": "/__mocks__/styleMock.js", 13 | "\\.(gif|ttf|eot|svg)$": "/__mocks__/fileMock.js" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/taro-redux-h5/react-redux/utils/PropTypes.js: -------------------------------------------------------------------------------- 1 | import PropTypes from 'prop-types' 2 | 3 | export const subscriptionShape = PropTypes.shape({ 4 | trySubscribe: PropTypes.func.isRequired, 5 | tryUnsubscribe: PropTypes.func.isRequired, 6 | notifyNestedSubs: PropTypes.func.isRequired, 7 | isSubscribed: PropTypes.func.isRequired, 8 | }) 9 | 10 | export const storeShape = PropTypes.shape({ 11 | subscribe: PropTypes.func.isRequired, 12 | dispatch: PropTypes.func.isRequired, 13 | getState: PropTypes.func.isRequired 14 | }) 15 | -------------------------------------------------------------------------------- /packages/taro-utils/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@tarojs/utils", 3 | "version": "2.2.8", 4 | "description": "Utils for Taro", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "jest", 8 | "build": "rollup -c rollup.config.js" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/NervJS/taro.git" 13 | }, 14 | "keywords": [ 15 | "taro" 16 | ], 17 | "publishConfig": { 18 | "access": "public" 19 | }, 20 | "author": "luckyadam", 21 | "license": "MIT" 22 | } 23 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/device/bluetooth/getBluetoothDevices.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.getBluetoothDevices(OBJECT) 3 | sidebar_label: getBluetoothDevices 4 | id: version-1.3.14-getBluetoothDevices 5 | original_id: getBluetoothDevices 6 | --- 7 | 8 | 使用方式同 [`wx.getBluetoothDevices`](https://developers.weixin.qq.com/miniprogram/dev/api/wx.getBluetoothDevices.html),支持 `Promise` 化使用。 9 | 10 | ## 示例代码 11 | 12 | ```jsx 13 | import Taro from '@tarojs/taro' 14 | 15 | Taro.getBluetoothDevices(params).then(...) 16 | ``` 17 | 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.23/apis/network/webSocket/sendSocketMessage.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.sendSocketMessage 3 | sidebar_label: sendSocketMessage 4 | id: version-1.3.23-sendSocketMessage 5 | original_id: sendSocketMessage 6 | --- 7 | 8 | 9 | `@Deprecated` 请使用 **SocketTask.send** 10 | 11 | 12 | 13 | ## API支持度 14 | 15 | 16 | | API | 微信小程序 | H5 | React Native | 支付宝小程序 | 百度小程序 | 17 | | :-: | :-: | :-: | :-: | :-: | :-: | 18 | | SocketTask | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 19 | | Taro.sendSocketMessage | ✔️ | | | ✔️ | ✔️ | 20 | 21 | -------------------------------------------------------------------------------- /docs/apis/media/video-processing/createMediaContainer.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.createMediaContainer() 3 | sidebar_label: createMediaContainer 4 | --- 5 | 6 | 创建音视频处理容器,最终可将容器中的轨道合成一个视频 7 | 8 | > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/wx.createMediaContainer.html) 9 | 10 | ## 类型 11 | 12 | ```tsx 13 | () => MediaContainer 14 | ``` 15 | 16 | ## 参数 17 | 18 | ## API 支持度 19 | 20 | | API | 微信小程序 | H5 | React Native | 21 | | :---: | :---: | :---: | :---: | 22 | | Taro.createMediaContainer | ✔️ | | | 23 | -------------------------------------------------------------------------------- /packages/taro-components-rn/src/components/Progress/PropsType.tsx: -------------------------------------------------------------------------------- 1 | import { StyleProp, ViewStyle, Animated } from 'react-native' 2 | 3 | export interface ProgressState { 4 | percent: number; 5 | prevPercent: number; 6 | valve: Animated.Value; 7 | } 8 | 9 | export interface ProgressProps { 10 | style?: StyleProp; 11 | percent: number; 12 | showInfo?: boolean; 13 | strokeWidth: number; 14 | activeColor: string; 15 | backgroundColor: string; 16 | active?: boolean; 17 | activeMode: 'backwards' | 'forwards'; 18 | } 19 | -------------------------------------------------------------------------------- /packages/taro-plugin-babel/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@tarojs/plugin-babel", 3 | "version": "2.2.8", 4 | "description": "Taro babel编译", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/NervJS/taro.git" 12 | }, 13 | "keywords": [ 14 | "taro" 15 | ], 16 | "author": "luckyadam", 17 | "license": "MIT", 18 | "dependencies": { 19 | "babel-core": "^6.26.0" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/about/env.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 环境判断 3 | id: version-1.3.14-env 4 | original_id: env 5 | --- 6 | 7 | ## Taro.ENV_TYPE 8 | 9 | `ENV_TYPE.WEAPP` 微信小程序环境 10 | 11 | `ENV_TYPE.SWAN` 百度小程序环境 12 | 13 | `ENV_TYPE.ALIPAY` 支付宝小程序环境 14 | 15 | `ENV_TYPE.TT` 字节跳动小程序环境 16 | 17 | `ENV_TYPE.WEB` WEB(H5)环境 18 | 19 | `ENV_TYPE.RN` ReactNative 环境 20 | 21 | `ENV_TYPE.QUICKAPP` 快应用环境 22 | 23 | `ENV_TYPE.QQ` QQ小程序 环境 24 | 25 | `ENV_TYPE.JD` 京东小程序 环境 26 | 27 | ## Taro.getEnv() 28 | 29 | 获取当前环境值,具体值如上 `Taro.ENV_TYPE` 30 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/device/ble/createBLEConnection.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.createBLEConnection(OBJECT) 3 | sidebar_label: createBLEConnection 4 | id: version-1.3.14-createBLEConnection 5 | original_id: createBLEConnection 6 | --- 7 | 8 | 使用方式同 [`wx.createBLEConnection`](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.createBLEConnection.html),支持 `Promise` 化使用。 9 | 10 | ## 示例代码 11 | 12 | ```jsx 13 | import Taro from '@tarojs/taro' 14 | 15 | Taro.createBLEConnection(params).then(...) 16 | ``` 17 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/device/bluetooth/openBluetoothAdapter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.openBluetoothAdapter(OBJECT) 3 | sidebar_label: openBluetoothAdapter 4 | id: version-1.3.14-openBluetoothAdapter 5 | original_id: openBluetoothAdapter 6 | --- 7 | 8 | 使用方式同 [`wx.openBluetoothAdapter`](https://developers.weixin.qq.com/miniprogram/dev/api/wx.openBluetoothAdapter.html),支持 `Promise` 化使用。 9 | 10 | ## 示例代码 11 | 12 | ```jsx 13 | import Taro from '@tarojs/taro' 14 | 15 | Taro.openBluetoothAdapter(params).then(...) 16 | ``` 17 | -------------------------------------------------------------------------------- /PLANS.md: -------------------------------------------------------------------------------- 1 | # 开发计划 2 | 3 | ## 版本规划 4 | 5 | ### 2.x 6 | 7 | > 2.0 正式版本预计在 12 月初发布 8 | 9 | #### 2.1 10 | 11 | - [ ] H5 编译改造,去除中间态文件生成 12 | 13 | #### 2.2 14 | 15 | - [ ] RN 编译改造,使用 webpack 编译 RN 应用 16 | 17 | ### 3.x 18 | 19 | > 3.x 将会同时支持 React 及 Vue,目前已探索成功 20 | 21 | #### 3.0-alpha 22 | 23 | - [ ] 小程序各端跑通 24 | - [ ] 旧版本迁移指南 25 | 26 | #### 3.0-beta 27 | 28 | - [ ] H5 跑通 29 | - [ ] React Native 跑通 30 | - [ ] 旧版本兼容模式 31 | - [ ] Taro 原有生态及小程序原生生态兼容支持 32 | 33 | #### 正式版及后续 34 | 35 | - [ ] 文档重构 36 | - [ ] Angular 和 Flutter 示例 37 | - [ ] 跨端能力开放 38 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/checkbox/__test__/checkbox.test.js: -------------------------------------------------------------------------------- 1 | import Nerv from 'nervjs' 2 | import { renderIntoDocument } from 'nerv-test-utils' 3 | import Checkbox from '../index' 4 | 5 | describe('Checkbox', () => { 6 | it('works', () => { 7 | const container = renderIntoDocument() 8 | expect(container.props.checked).toBeFalsy() 9 | }) 10 | it('should checked', () => { 11 | const container = renderIntoDocument() 12 | expect(container.props.checked).toBeTruthy() 13 | }) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/radio/__test__/radio.test.js: -------------------------------------------------------------------------------- 1 | import Nerv from 'nervjs' 2 | import { renderIntoDocument } from 'nerv-test-utils' 3 | import Radio from '../index' 4 | 5 | describe('Radio', () => { 6 | it('works', () => { 7 | const container = renderIntoDocument() 8 | expect(container.props.checked).toBeFalsy() 9 | }) 10 | it('should checked', () => { 11 | const container = renderIntoDocument() 12 | expect(container.props.checked).toBeTruthy() 13 | }) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/taro-h5/build/rollup-plugin-export-name-only.js: -------------------------------------------------------------------------------- 1 | export default function exportNameOnly () { 2 | const emptyMap = { mappings: '' } 3 | return { 4 | name: 'export-name-only', 5 | renderChunk (code, chunk, options) { 6 | const pos = chunk.exports.indexOf('default') 7 | if (pos > -1) { 8 | chunk.exports.splice(pos, 1) 9 | } 10 | return { 11 | code: `module.exports = new Set(${JSON.stringify(chunk.exports)})`, 12 | map: emptyMap 13 | } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/taro-redux/src/utils/index.js: -------------------------------------------------------------------------------- 1 | export function isObject (arg) { 2 | return arg != null && typeof arg === 'object' && !Array.isArray(arg) 3 | } 4 | 5 | export function mergeObjects (obj1, obj2) { 6 | const result = Object.assign({}, obj1) 7 | if (isObject(obj1) && isObject(obj2)) { 8 | for (const p in obj2) { 9 | if (isObject(obj1[p]) && isObject(obj2[p])) { 10 | result[p] = mergeObjects(obj1[p], obj2[p]) 11 | } else { 12 | result[p] = obj2[p] 13 | } 14 | } 15 | } 16 | return result 17 | } 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/device/ble/getBLEDeviceServices.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.getBLEDeviceServices(OBJECT) 3 | sidebar_label: getBLEDeviceServices 4 | id: version-1.3.14-getBLEDeviceServices 5 | original_id: getBLEDeviceServices 6 | --- 7 | 8 | 使用方式同 [`wx.getBLEDeviceServices`](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getBLEDeviceServices.html),支持 `Promise` 化使用。 9 | 10 | ## 示例代码 11 | 12 | ```jsx 13 | import Taro from '@tarojs/taro' 14 | 15 | Taro.getBLEDeviceServices(params).then(...) 16 | ``` 17 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/storage/clearStorage.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.clearStorage() 3 | sidebar_label: clearStorage 4 | id: version-1.3.14-clearStorage 5 | original_id: clearStorage 6 | --- 7 | 8 | 9 | 清理本地数据缓存。 10 | 11 | ## 示例代码 12 | 13 | ```jsx 14 | import Taro from '@tarojs/taro' 15 | 16 | Taro.clearStorage() 17 | ``` 18 | 19 | 20 | 21 | ## API支持度 22 | 23 | 24 | | API | 微信小程序 | H5 | React Native | 25 | | :-: | :-: | :-: | :-: | 26 | | Taro.clearStorage | ✔️ | ✔️ | ✔️ | 27 | | Taro.clearStorageSync | ✔️ | ✔️ | | 28 | 29 | -------------------------------------------------------------------------------- /packages/css-to-react-native/src/css-to-react-native/transforms/textDecorationLine.js: -------------------------------------------------------------------------------- 1 | import { tokens } from "../tokenTypes"; 2 | 3 | const { SPACE, LINE } = tokens; 4 | 5 | export default tokenStream => { 6 | const lines = []; 7 | 8 | let didParseFirst = false; 9 | while (tokenStream.hasTokens()) { 10 | if (didParseFirst) tokenStream.expect(SPACE); 11 | 12 | lines.push(tokenStream.expect(LINE).toLowerCase()); 13 | 14 | didParseFirst = true; 15 | } 16 | 17 | lines.sort().reverse(); 18 | 19 | return lines.join(" "); 20 | }; 21 | -------------------------------------------------------------------------------- /packages/taro-cli/src/jdreact/test.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs-extra') 2 | var path = require('path') 3 | var klaw = require('klaw') 4 | 5 | // console.log(__dirname) 6 | 7 | let nm = path.join(__dirname, 'node_modules') 8 | 9 | console.log(nm) 10 | 11 | const filterFunc = item => { 12 | const basename = path.basename(item) 13 | return ((basename === '.' || basename[0] !== '.') && !item.startsWith('/Users/chengshuai/Work/taro/packages/taro-cli')) 14 | } 15 | 16 | klaw('../../src', {filter: filterFunc}) 17 | .on('data', item => console.log(item)) 18 | -------------------------------------------------------------------------------- /packages/taro-quickapp/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | verbose: true, 3 | moduleNameMapper: { 4 | '@tarojs/taro-quickapp': '/src/index.js', 5 | // '@tarojs/taro': '/../taro/src/index', 6 | '@tarojs/utils': '/../taro-utils/src/index', 7 | '^@system.(.*)': '/__mocks__/@system/$1.js' 8 | }, 9 | rootDir: __dirname, 10 | testMatch: ['/**/*.test.js'], 11 | transform: { 12 | '^.+\\.js?$': 'babel-jest' 13 | }, 14 | transformIgnorePatterns: ['/node_modules/'] 15 | } 16 | -------------------------------------------------------------------------------- /packages/taro-webpack-runner/src/config/devServer.conf.ts: -------------------------------------------------------------------------------- 1 | import WebpackDevServer = require('webpack-dev-server') 2 | 3 | const devServerConf: WebpackDevServer.Configuration = { 4 | compress: true, 5 | disableHostCheck: true, 6 | historyApiFallback: { 7 | disableDotRule: true 8 | }, 9 | host: '0.0.0.0', 10 | hot: true, 11 | https: false, 12 | inline: true, 13 | open: true, 14 | overlay: true, 15 | port: 10086, 16 | quiet: true, 17 | watchContentBase: true, 18 | writeToDisk: false 19 | } 20 | 21 | export default devServerConf -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/device/bluetooth/closeBluetoothAdapter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.closeBluetoothAdapter(OBJECT) 3 | sidebar_label: closeBluetoothAdapter 4 | id: version-1.3.14-closeBluetoothAdapter 5 | original_id: closeBluetoothAdapter 6 | --- 7 | 8 | 使用方式同 [`wx.closeBluetoothAdapter`](https://developers.weixin.qq.com/miniprogram/dev/api/wx.closeBluetoothAdapter.html),支持 `Promise` 化使用。 9 | 10 | ## 示例代码 11 | 12 | ```jsx 13 | import Taro from '@tarojs/taro' 14 | 15 | Taro.closeBluetoothAdapter(params).then(...) 16 | ``` 17 | 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/device/ibeacon/onBeaconServiceChange.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.onBeaconServiceChange(CALLBACK) 3 | sidebar_label: onBeaconServiceChange 4 | id: version-1.3.14-onBeaconServiceChange 5 | original_id: onBeaconServiceChange 6 | --- 7 | 8 | 9 | 使用方式同 [`wx.onBeaconServiceChange`](https://developers.weixin.qq.com/miniprogram/dev/api/wx.onBeaconServiceChange.html)。 10 | 11 | ## API支持度 12 | 13 | 14 | | API | 微信小程序 | H5 | React Native | 15 | | :-: | :-: | :-: | :-: | 16 | | Taro.onBeaconServiceChange | ✔️ | | | 17 | 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/specials.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 特殊问题的处理 3 | id: version-1.3.14-specials 4 | original_id: specials 5 | --- 6 | 7 | - [Issue #46](https://github.com/NervJS/taro/issues/46),`redux-saga` 的引入问题处理 8 | 9 | - 在 H5 模式下,tabBar 可能会挡住页面 fixed 元素问题:这是因为与小程序的 tabBar 不同,在 H5 下 tabBar 是一个普通的组件,当页面中存在 `fixed(bottom)` 定位的元素时,其表现会与小程序中不一致。Taro 提供了一个适配的方法: 10 | 11 | 例如: 12 | 13 | ```css 14 | .fixed { 15 | bottom: 0; 16 | /* 在 H5 模式下将会编译成 margin-bottom: 50px,在小程序模式下则会忽略 */ 17 | margin-bottom: taro-tabbar-height; 18 | } 19 | ``` 20 | -------------------------------------------------------------------------------- /website/versioned_docs/version-2.1.1/apis/framework/Page.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Page 3 | sidebar_label: Page 4 | id: version-2.1.1-Page 5 | original_id: Page 6 | --- 7 | 8 | 注册小程序中的一个页面。接受一个 `Object` 类型参数,其指定页面的初始数据、生命周期回调、事件处理函数等。 9 | 10 | ## 方法 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
参数类型说明
routestring当前页面的路径
28 | -------------------------------------------------------------------------------- /packages/taro-components-rn/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: [ 4 | 'standard', 5 | 'plugin:react/recommended', 6 | 'plugin:jest/recommended', 7 | // 'plugin:@typescript-eslint/recommended' 8 | ], 9 | parser: '@typescript-eslint/parser', 10 | plugins: ['@typescript-eslint'], 11 | env: { 12 | 'node': true, 13 | 'jest': true, 14 | }, 15 | settings: { 16 | react: { 17 | version: 'detect' 18 | } 19 | }, 20 | rules: { 21 | 'comma-dangle': [2, 'only-multiline'] 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/taro-helper/src/index.ts: -------------------------------------------------------------------------------- 1 | import * as fs from 'fs-extra' 2 | import * as chalk from 'chalk' 3 | import * as chokidar from 'chokidar' 4 | import createDebug from 'debug' 5 | 6 | import * as constants from './constants' 7 | import * as utils from './utils' 8 | import * as npm from './npm' 9 | import createBabelRegister from './babelRegister' 10 | 11 | export const helper = { 12 | ...constants, 13 | ...utils, 14 | npm, 15 | createBabelRegister, 16 | fs, 17 | chalk, 18 | chokidar, 19 | createDebug 20 | } 21 | 22 | export default helper 23 | -------------------------------------------------------------------------------- /packages/taro-plugin-typescript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@tarojs/plugin-typescript", 3 | "version": "2.2.8", 4 | "description": "Taro TypeScript 编译插件", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/NervJS/taro.git" 12 | }, 13 | "keywords": [ 14 | "taro" 15 | ], 16 | "author": "luckyadam", 17 | "license": "MIT", 18 | "dependencies": { 19 | "typescript": "^2.9.2" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/taro-rn-runner/src/loaders/utils/config.ts: -------------------------------------------------------------------------------- 1 | import { ParserOptions } from '@babel/core' 2 | 3 | export const parserOpts: ParserOptions = { 4 | sourceType: 'module', 5 | plugins: [ 6 | 'classProperties', 7 | 'jsx', 8 | // 'trailingFunctionCommas', // babel7 removed 9 | // 'asyncFunctions', 10 | // 'exponentiationOperator', 11 | 'asyncGenerators', 12 | 'objectRestSpread', 13 | 'decorators-legacy', 14 | 'dynamicImport', 15 | 'typescript', 16 | 'doExpressions' 17 | // 'exportExtensions' 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/extend-apis/arrayBufferToBase64.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: arrayBufferToBase64 3 | sidebar_label: arrayBufferToBase64 4 | id: version-1.3.14-arrayBufferToBase64 5 | original_id: arrayBufferToBase64 6 | --- 7 | 8 | ## Taro.arrayBufferToBase64(arrayBuffer) 9 | 10 | 将 ArrayBuffer 数据转成 Base64 字符串。(小程序端基础库 1.1.0 开始支持,低版本需做兼容处理) 11 | 12 | **示例代码:** 13 | 14 | ```jsx 15 | import Taro from '@tarojs/taro' 16 | 17 | const arrayBuffer = new Uint8Array([11, 22, 33]) 18 | const base64 = Taro.arrayBufferToBase64(arrayBuffer) 19 | ``` 20 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/location/getLocation.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.getLocation(OBJECT) 3 | sidebar_label: getLocation 4 | id: version-1.3.14-getLocation 5 | original_id: getLocation 6 | --- 7 | 8 | 使用方式同 [`wx.getLocation`](https://developers.weixin.qq.com/miniprogram/dev/api/wx.getLocation.html),h5端仅支持[微信公众号](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115)(API以小程序为准),支持 `Promise` 化使用。 9 | 10 | ## 示例代码 11 | 12 | ```jsx 13 | import Taro from '@tarojs/taro' 14 | 15 | Taro.getLocation(params).then(...) 16 | ``` 17 | 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.23/apis/canvas/createCanvasContext.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.createCanvasContext(canvasId, componentInstance) 3 | sidebar_label: createCanvasContext 4 | id: version-1.3.23-createCanvasContext 5 | original_id: createCanvasContext 6 | --- 7 | 8 | 9 | 使用方式同 [`wx.createCanvasContext`](https://developers.weixin.qq.com/miniprogram/dev/api/wx.createCanvasContext.html)。 10 | 11 | 12 | ## API支持度 13 | 14 | 15 | | API | 微信小程序 | H5 | React Native | 16 | | :-: | :-: | :-: | :-: | 17 | | Taro.createCanvasContext | ✔️ | ✔️ | | 18 | 19 | -------------------------------------------------------------------------------- /packages/taro-redux/src/hooks/use-store.js: -------------------------------------------------------------------------------- 1 | import { useReduxContext } from './use-redux-context' 2 | 3 | /** 4 | * A hook to access the redux store. 5 | * 6 | * @returns {any} the redux store 7 | * 8 | * @example 9 | * 10 | * import React from 'react' 11 | * import { useStore } from 'react-redux' 12 | * 13 | * export const ExampleComponent = () => { 14 | * const store = useStore() 15 | * return
{store.getState()}
16 | * } 17 | */ 18 | export function useStore () { 19 | const { store } = useReduxContext() 20 | return store 21 | } 22 | -------------------------------------------------------------------------------- /docs/apis/alipay/getOpenUserInfo.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.getOpenUserInfo() 3 | sidebar_label: getOpenUserInfo 4 | --- 5 | 6 | 此接口可获取支付宝会员的基础信息(头像图片地址、昵称、性别、国家码、省份、所在市区),接入方法请参考 获取会员基础信息介绍。如需获取支付宝会员标识(user_id),请调用 my.getAuthCode 和 alipay.system.oauth.token 接口。 7 | 8 | > [参考文档](https://docs.alipay.com/mini/api/ch8chh) 9 | 10 | ## 类型 11 | 12 | ```tsx 13 | () => Promise 14 | ``` 15 | 16 | ## 参数 17 | 18 | ## API 支持度 19 | 20 | | API | 微信小程序 | 支付宝小程序 | H5 | React Native | 21 | | :---: | :---: | :---: | :---: | :---: | 22 | | Taro.getOpenUserInfo | | ✔️ | | | 23 | -------------------------------------------------------------------------------- /packages/taro-components/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['standard', 'standard-jsx'], 3 | env: { 4 | browser: true, 5 | node: true, 6 | es6: true, 7 | jest: true, 8 | }, 9 | globals: { 10 | wx: true, 11 | getApp: true, 12 | getCurrentPages: true 13 | }, 14 | rules: { 15 | 'no-unused-expressions': 0, 16 | 'no-useless-constructor': 0 17 | }, 18 | settings: { 19 | react: { 20 | pragma: 'Nerv' 21 | } 22 | }, 23 | parser: 'babel-eslint' 24 | } 25 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/progress/__test__/progress.test.js: -------------------------------------------------------------------------------- 1 | import Nerv from 'nervjs' 2 | import { renderIntoDocument } from 'nerv-test-utils' 3 | import Progress from '../index' 4 | 5 | describe('Progress', () => { 6 | it('render Progress', () => { 7 | const component = renderIntoDocument( 8 | 9 | ) 10 | const dom = Nerv.findDOMNode(component) 11 | expect(dom.getAttribute('class')).toContain('weui-progress') 12 | }) 13 | }) 14 | -------------------------------------------------------------------------------- /packages/taro-mobx-rn/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@tarojs/mobx-rn", 3 | "version": "2.2.8", 4 | "description": "mobx-rn for taro", 5 | "keywords": [ 6 | "mobx", 7 | "rn", 8 | "taro" 9 | ], 10 | "license": "MIT", 11 | "author": "Tom.Huang", 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/NervJS/taro.git" 15 | }, 16 | "main": "src/index.js", 17 | "files": [ 18 | "src" 19 | ], 20 | "dependencies": { 21 | "@tarojs/mobx-common": "^2.2.8", 22 | "@tarojs/taro-rn": "^2.2.8" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/interface/canvas/createCanvasContext.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.createCanvasContext(canvasId, componentInstance) 3 | sidebar_label: createCanvasContext 4 | id: version-1.3.14-createCanvasContext 5 | original_id: createCanvasContext 6 | --- 7 | 8 | 9 | 使用方式同 [`wx.createCanvasContext`](https://developers.weixin.qq.com/miniprogram/dev/api/wx.createCanvasContext.html)。 10 | 11 | 12 | ## API支持度 13 | 14 | 15 | | API | 微信小程序 | H5 | React Native | 16 | | :-: | :-: | :-: | :-: | 17 | | Taro.createCanvasContext | ✔️ | ✔️ | | 18 | 19 | -------------------------------------------------------------------------------- /packages/taro-mobx-common/src/index.js: -------------------------------------------------------------------------------- 1 | import { errorsReporter } from './reporter' 2 | 3 | export const onError = fn => errorsReporter.on(fn) 4 | 5 | export { PropTypes } from "./propTypes" 6 | 7 | export { useLocalStore } from './useLocalStore' 8 | export { useAsObservableSource } from './useAsObservableSource' 9 | export { isUsingStaticRendering, useStaticRendering } from './staticRendering' 10 | 11 | export { getStore, setStore } from './store' 12 | export { errorsReporter } from './reporter' 13 | export { inject, getInjectName, mapStoreToProps } from './inject' 14 | -------------------------------------------------------------------------------- /packages/taro-router-rn/__tests__/__snapshots__/TaroProvider.spec.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`TaroProvider should render success 1`] = ` 4 | 17 | 18 | 19 | `; 20 | -------------------------------------------------------------------------------- /docs/apis/network/udp/createUDPSocket.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.createUDPSocket() 3 | sidebar_label: createUDPSocket 4 | --- 5 | 6 | 创建一个 UDP Socket 实例。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。 7 | 8 | > [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/wx.createUDPSocket.html) 9 | 10 | ## 类型 11 | 12 | ```tsx 13 | () => UDPSocket 14 | ``` 15 | 16 | ## 参数 17 | 18 | ## API 支持度 19 | 20 | | API | 微信小程序 | H5 | React Native | 21 | | :---: | :---: | :---: | :---: | 22 | | Taro.createUDPSocket | ✔️ | | | 23 | -------------------------------------------------------------------------------- /packages/eslint-plugin-taro/rules/no-ref.js: -------------------------------------------------------------------------------- 1 | const { buildDocsMeta } = require('../utils/utils') 2 | 3 | const ERROR_MESSAGE = '定义 ref 在微信小程序不会起作用' 4 | 5 | module.exports = { 6 | meta: { 7 | docs: buildDocsMeta(ERROR_MESSAGE, 'no-ref') 8 | }, 9 | 10 | create (context) { 11 | return { 12 | JSXAttribute (node) { 13 | if (node.name.type === 'JSXIdentifier' && node.name.name === 'ref') { 14 | context.report({ 15 | message: ERROR_MESSAGE, 16 | node 17 | }) 18 | } 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/taro-components/src/components/text/__test__/text.test.js: -------------------------------------------------------------------------------- 1 | import Nerv from 'nervjs' 2 | import { renderIntoDocument } from 'nerv-test-utils' 3 | import Text from '../index' 4 | 5 | describe('Text', () => { 6 | it('render Text', () => { 7 | const component = renderIntoDocument(this is Text) 8 | const dom = Nerv.findDOMNode(component) 9 | expect(dom.textContent).toEqual('this is Text') 10 | 11 | const c = renderIntoDocument(0) 12 | const d = Nerv.findDOMNode(c) 13 | expect(d.textContent).toEqual('0') 14 | }) 15 | }) 16 | -------------------------------------------------------------------------------- /packages/taro-rn/gulpfile.js: -------------------------------------------------------------------------------- 1 | const { src, dest, parallel } = require('gulp') 2 | const ts = require('gulp-typescript') 3 | 4 | const tsProject = ts.createProject('tsconfig.json') 5 | const distPath = 'dist' 6 | 7 | function typescripts () { 8 | return tsProject 9 | .src() 10 | .pipe(tsProject()) 11 | .on('error', (err) => { 12 | console.log(err) 13 | }) 14 | .pipe(dest(distPath)) 15 | } 16 | 17 | function images () { 18 | return src(['src/**/*.png']) 19 | .pipe(dest(distPath)) 20 | } 21 | 22 | exports.default = parallel(typescripts, images) 23 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/device/bluetooth/getBluetoothAdapterState.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.getBluetoothAdapterState(OBJECT) 3 | sidebar_label: getBluetoothAdapterState 4 | id: version-1.3.14-getBluetoothAdapterState 5 | original_id: getBluetoothAdapterState 6 | --- 7 | 8 | 使用方式同 [`wx.getBluetoothAdapterState`](https://developers.weixin.qq.com/miniprogram/dev/api/wx.getBluetoothAdapterState.html),支持 `Promise` 化使用。 9 | 10 | ## 示例代码 11 | 12 | ```jsx 13 | import Taro from '@tarojs/taro' 14 | 15 | Taro.getBluetoothAdapterState(params).then(...) 16 | ``` 17 | 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.14/apis/open-api/login/login.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro.login(OBJECT) 3 | sidebar_label: login 4 | id: version-1.3.14-login 5 | original_id: login 6 | --- 7 | 8 | 9 | 使用方式同 [`wx.login`](https://developers.weixin.qq.com/miniprogram/dev/api/wx.login.html),支持 `Promise` 化使用。 10 | 11 | ## 示例代码 12 | 13 | ```jsx 14 | import Taro from '@tarojs/taro' 15 | 16 | Taro.login(params).then(...) 17 | ``` 18 | 19 | 20 | 21 | ## API支持度 22 | 23 | 24 | | API | 微信小程序 | H5 | React Native | 25 | | :-: | :-: | :-: | :-: | 26 | | Taro.login | ✔️ | | | 27 | 28 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.3.15/components/open/others.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 其他 3 | sidebar_label: 其他 4 | id: version-1.3.15-others 5 | original_id: others 6 | --- 7 | 8 | ##### 其他组件 9 | 10 | 除导航列表的一些组件外,还有一些差异化组件,每个端不同,后续计划将这些统一封装。目前差异化组件请详看各小程序官网。 11 | 12 | >其他组件请看各小程序官方文档 13 | 14 | [微信小程序](https://developers.weixin.qq.com/miniprogram/dev/component/)。 15 | 16 | [百度小程序](https://smartprogram.baidu.com/docs/develop/component/view/)。 17 | 18 | [支付宝小程序](https://docs.alipay.com/mini/component/overview)。 19 | 20 | [字节跳动小程序](https://developer.toutiao.com/docs/comp/)。 21 | 22 | -------------------------------------------------------------------------------- /packages/postcss-unit-transform/index.js: -------------------------------------------------------------------------------- 1 | const postcss = require('postcss') 2 | 3 | module.exports = postcss.plugin('postcss-taro-unit-transform', plugin) 4 | 5 | function plugin (opts) { 6 | return function (root) { 7 | root.walkDecls(function (decl) { 8 | let value = decl.value 9 | value = value.replace(/([0-9.]+)px/ig, function (match, size) { 10 | return (parseInt(size, 10) * 2) + 'px' 11 | }).replace(/([0-9.]+)rpx/ig, function (match, size) { 12 | return size + 'px' 13 | }) 14 | decl.value = value 15 | }) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/taro-components-rn/src/components/Checkbox/styles.tsx: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from 'react-native' 2 | 3 | export default StyleSheet.create({ 4 | wrapper: { 5 | alignItems: 'center', 6 | justifyContent: 'center', 7 | width: 24, 8 | height: 24, 9 | borderColor: '#f3f3f3', 10 | borderWidth: 2, 11 | borderRadius: 4 12 | }, 13 | wrapperChecked: { 14 | // borderColor: '#2BA245', 15 | // backgroundColor: '#2BA245' 16 | }, 17 | wrapperIcon: { 18 | opacity: 0 19 | }, 20 | wrapperCheckedIcon: { 21 | opacity: 1 22 | } 23 | }) 24 | -------------------------------------------------------------------------------- /packages/taro-components-rn/src/components/Radio/styles.tsx: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from 'react-native' 2 | 3 | export default StyleSheet.create({ 4 | wrapper: { 5 | alignItems: 'center', 6 | justifyContent: 'center', 7 | width: 24, 8 | height: 24, 9 | borderColor: '#f3f3f3', 10 | borderWidth: 2, 11 | borderRadius: 12 12 | }, 13 | wrapperChecked: { 14 | // borderColor: '#2BA245', 15 | // backgroundColor: '#2BA245' 16 | }, 17 | wrapperIcon: { 18 | opacity: 0 19 | }, 20 | wrapperCheckedIcon: { 21 | opacity: 1 22 | } 23 | }) 24 | --------------------------------------------------------------------------------