From 7992dfdf322635f39da6034687dba591e2a8dfa1 Mon Sep 17 00:00:00 2001 From: t <28008958+taeh98@users.noreply.github.com> Date: Tue, 5 Sep 2023 11:39:35 +0100 Subject: [PATCH] chore: added runnable examples subdir and updated README accordingly --- .npmignore | 2 +- README.md | 36 +- examples/.gitignore | 35 + examples/App.tsx | 159 + examples/app.json | 28 + examples/assets/adaptive-icon.png | Bin 0 -> 17547 bytes examples/assets/favicon.png | Bin 0 -> 1466 bytes examples/assets/icon.png | Bin 0 -> 22380 bytes examples/assets/splash.png | Bin 0 -> 47346 bytes examples/babel.config.js | 6 + .../javascript-class-example.jsx | 116 + .../javascript-function-example.jsx | 82 + .../typescript-class-example.tsx | 128 + .../typescript-function-example.tsx | 84 + examples/package-lock.json | 13686 ++++++++++++++++ examples/package.json | 24 + examples/tsconfig.json | 6 + index.d.ts | 4 +- package-lock.json | 554 +- package.json | 4 +- 20 files changed, 14666 insertions(+), 288 deletions(-) create mode 100644 examples/.gitignore create mode 100644 examples/App.tsx create mode 100644 examples/app.json create mode 100644 examples/assets/adaptive-icon.png create mode 100644 examples/assets/favicon.png create mode 100644 examples/assets/icon.png create mode 100644 examples/assets/splash.png create mode 100644 examples/babel.config.js create mode 100644 examples/example-src-files/javascript-class-example.jsx create mode 100644 examples/example-src-files/javascript-function-example.jsx create mode 100644 examples/example-src-files/typescript-class-example.tsx create mode 100644 examples/example-src-files/typescript-function-example.tsx create mode 100644 examples/package-lock.json create mode 100644 examples/package.json create mode 100644 examples/tsconfig.json diff --git a/.npmignore b/.npmignore index 960e504f..375e7d7f 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,4 @@ .github/ node_modules/ - +examples package-lock.json \ No newline at end of file diff --git a/README.md b/README.md index cba73820..fe396b1b 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,11 @@ # React Native Dropdown Picker -
+[![react-native-dropdown-picker is released under the MIT license.](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/hossein-zare/react-native-dropdown-picker/blob/dev-5.x/LICENSE) +[![Current npm package version.](https://img.shields.io/npm/v/react-native-dropdown-picker?color=brightgreen&label=npm%20package)](https://www.npmjs.org/package/react-native-dropdown-picker) + +[//]: # (TODO: add badge linking to GitHub repo) + +--- ## Screenshots @@ -22,17 +18,24 @@ width="270" alt="Screenshot showing dark theme and parent items" /> -The above screenshots are taken from the following -example: [https://snack.expo.dev/8mHmLfcZf](https://snack.expo.dev/8mHmLfcZf) +The above screenshots were taken +from [this example](https://snack.expo.dev/8mHmLfcZf). ## Usage -See [the relevant documentation](https://hossein-zare.github.io/react-native-dropdown-picker-website/docs/usage). +You can find runnable examples in the `examples` subdirectory, which is a +working [Expo](https://github.com/expo/expo) project demonstrating this library. +Navigate into the `examples` subdirectory, run `npm install`, and then run +`npx expo start` to see the examples working. + +For further information on how to use this library, +read [the relevant documentation](https://hossein-zare.github.io/react-native-dropdown-picker-website/docs/usage). ## Further documentation The docs can be read -at: [https://hossein-zare.github.io/react-native-dropdown-picker-website](https://hossein-zare.github.io/react-native-dropdown-picker-website). +at: [https://hossein-zare.github.io/react-native-dropdown-picker-website](https://hossein-zare.github.io/react-native-dropdown-picker-website) + The docs can be edited at: [https://github.com/hossein-zare/react-native-dropdown-picker-website](https://github.com/hossein-zare/react-native-dropdown-picker-website) @@ -60,9 +63,8 @@ To make a new release, follow these steps: works well * You can test changes to the library and experiment easily with [patch-package](https://www.npmjs.com/package/patch-package) -* Use `npm pack` to test the new version of the library locally and check it - works correctly; - see [https://dev.to/scooperdev/use-npm-pack-to-test-your-packages-locally-486e](https://dev.to/scooperdev/use-npm-pack-to-test-your-packages-locally-486e) +* Once you have made changes, and after finalizing them, use `npm pack` + to [test your new, changed version of the library locally and check it works correctly](https://dev.to/scooperdev/use-npm-pack-to-test-your-packages-locally-486e) * Make and merge a final PR into the development branch that increments the version number in `package.json` * Make and merge a PR from the development branch to the release branch diff --git a/examples/.gitignore b/examples/.gitignore new file mode 100644 index 00000000..05647d55 --- /dev/null +++ b/examples/.gitignore @@ -0,0 +1,35 @@ +# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files + +# dependencies +node_modules/ + +# Expo +.expo/ +dist/ +web-build/ + +# Native +*.orig.* +*.jks +*.p8 +*.p12 +*.key +*.mobileprovision + +# Metro +.metro-health-check* + +# debug +npm-debug.* +yarn-debug.* +yarn-error.* + +# macOS +.DS_Store +*.pem + +# local env files +.env*.local + +# typescript +*.tsbuildinfo diff --git a/examples/App.tsx b/examples/App.tsx new file mode 100644 index 00000000..83243383 --- /dev/null +++ b/examples/App.tsx @@ -0,0 +1,159 @@ +import React, { JSX } from 'react'; +import { StyleSheet, Text, View } from 'react-native'; +import DropDownPicker, { ItemType } from 'react-native-dropdown-picker'; +import JavascriptClassExample from './example-src-files/javascript-class-example'; +import JavascriptFunctionExample from './example-src-files/javascript-function-example'; +import TypescriptClassExample from './example-src-files/typescript-class-example'; +import TypescriptFunctionExample from './example-src-files/typescript-function-example'; + +enum ExampleComponent { + JavaScriptClassSingleValue, + JavaScriptClassMultiValue, + JavaScriptFunctionSingleValue, + JavaScriptFunctionMultiValue, + TypeScriptClassSingleValue, + TypeScriptClassMultiValue, + TypeScriptFunctionSingleValue, + TypeScriptFunctionMultiValue, +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + // backgroundColor: "#fff", + // alignItems: "center", + // justifyContent: "center", + flexDirection: 'column', + margin: 3, + marginTop: 20, + padding: 3, + }, +}); + +const EXAMPLE_COMPONENT_ITEMS: Arraygk(*nG6_q=^VO{)x0`lqq2GV~}@c!>8{Rh%N*#!Md
zcK;8gf67wupJn>jNdIgNpZR|v@cIA03H<+(hK<+%dm4_({I~3;yCGk?+3uu{%&A)1
zP|cr?l KFzaTY@vvKH7%3fMd5>K7Hf1!``V7EA{
z1wfp4Pd!A;Kstvm^z=AAQ1*5zEXWGy2d _m_Cz!aI|OA~=>rP h%0{}|+DPWgk|($2LaYkVi1EqD))Ngy$!?Ey_Khw=N$
z0*>LrfiNG=fipoI@PGE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