|
1 | 1 | <img alt="React Native Typescript Library Starter" src="assets/logo.png" width="1050"/>
|
2 | 2 |
|
3 |
| -[](https://github.com/WrathChaos/react-native-typescript-library-starter) |
4 |
| - |
5 |
| -[](https://github.com/WrathChaos/react-native-typescript-library-starter) |
6 |
| - |
7 |
| -[](https://www.npmjs.com/package/react-native-typescript-library-starter) |
8 |
| -[](https://www.npmjs.com/package/react-native-typescript-library-starter) |
9 |
| - |
10 |
| -[](https://opensource.org/licenses/MIT) |
11 |
| -[](https://github.com/prettier/prettier) |
12 |
| - |
13 | 3 | <p align="center">
|
14 | 4 | <img alt="React Native Typescript Library Starter"
|
15 |
| - src="assets/Screenshots/typescript.jpg" /> |
| 5 | + src="assets/react-native-language-select.gif" /> |
16 | 6 | </p>
|
17 | 7 |
|
18 |
| -## Library Usage |
19 |
| - |
20 |
| -- `npm i` |
21 |
| -- `npm run husky:setup` |
22 |
| -- Delete example folder |
23 |
| -- Delete build folder |
24 |
| -- Make your own library into the `lib` folder |
25 |
| -- Change package.json |
26 |
| -- Change README for your own documentation |
27 |
| -- `npm run build` |
28 |
| - |
29 |
| -``` |
30 |
| -> [email protected] build /Users/kuray/Coursion/MyLibraries/ReactNative/react-native-typescript-library-starter |
31 |
| -> cd lib && tsc && cp ../package.json ../build/dist/ && Echo Build completed! |
32 |
| -
|
33 |
| -Build completed! |
34 |
| -``` |
35 |
| - |
36 |
| -- Test your build/dist into the new project |
37 |
| -- Finally, time to npm publish :) |
38 |
| - |
39 |
| -### Below part is for Documentation ! Remove above Library Usage |
40 |
| - |
41 | 8 | # Installation
|
42 | 9 |
|
43 | 10 | Add the dependency:
|
44 | 11 |
|
45 | 12 | ```bash
|
46 |
| -npm i react-native-typescript-library-starter |
| 13 | +npm i react-native-language-select |
47 | 14 | ```
|
48 | 15 |
|
49 |
| -## Peer Dependencies |
50 |
| - |
51 |
| -<h5><i>IMPORTANT! You need install them</i></h5> |
| 16 | +# Import |
52 | 17 |
|
53 |
| -```js |
54 |
| -"react": ">= 16.x.x", |
55 |
| -"react-native": ">= 0.55.x", |
| 18 | +```jsx |
| 19 | +import LanguagePicker, { ILanguagePicker } from "react-native-language-select"; |
56 | 20 | ```
|
57 | 21 |
|
58 |
| -# Usage |
59 |
| - |
60 |
| -## Import |
| 22 | +# Example Data |
61 | 23 |
|
62 | 24 | ```jsx
|
63 |
| -import MyComponent from "react-native-typescript-library-starter"; |
| 25 | +const data: ILanguagePicker[] = [ |
| 26 | + { |
| 27 | + title: "English", |
| 28 | + imageSource: require("./lib/local-assets/america.png"), |
| 29 | + language: "en", |
| 30 | + }, |
| 31 | + { |
| 32 | + title: "Italian", |
| 33 | + imageSource: require("./lib/local-assets/italy.png"), |
| 34 | + }, |
| 35 | + { |
| 36 | + title: "German", |
| 37 | + imageSource: require("./lib/local-assets/germany.png"), |
| 38 | + }, |
| 39 | + { |
| 40 | + title: "Turkish", |
| 41 | + imageSource: require("./lib/local-assets/turkey.png"), |
| 42 | + language: "tr", |
| 43 | + }, |
| 44 | + { |
| 45 | + title: "Swedish", |
| 46 | + imageSource: require("./lib/local-assets/sweden.png"), |
| 47 | + }, |
| 48 | + { |
| 49 | + title: "Japanese", |
| 50 | + imageSource: require("./lib/local-assets/japan.png"), |
| 51 | + }, |
| 52 | +]; |
64 | 53 | ```
|
65 | 54 |
|
66 |
| -## Fundamental Usage |
| 55 | +# Usage |
67 | 56 |
|
68 | 57 | ```jsx
|
69 |
| -<MyComponent /> |
| 58 | +<LanguagePicker |
| 59 | + initialIndex={1} |
| 60 | + data={data} |
| 61 | + onSelect={(selectedItem: ILanguagePicker) => { |
| 62 | + onsole.log(selectedItem); |
| 63 | + }} |
| 64 | +/> |
70 | 65 | ```
|
71 | 66 |
|
72 |
| -## Example Project 😍 |
73 |
| - |
74 |
| -You can checkout the example project 🥰 |
75 |
| - |
76 |
| -Simply run |
77 |
| - |
78 |
| -- `npm i` |
79 |
| -- `react-native run-ios/android` |
80 |
| - |
81 |
| -should work of the example project. |
82 |
| - |
83 | 67 | # Configuration - Props
|
84 | 68 |
|
85 | 69 | ## Fundamentals
|
86 | 70 |
|
87 |
| -| Property | Type | Default | Description | |
88 |
| -| ----------- | :----: | :-------: | --------------------- | |
89 |
| -| title | string | undefined | change the title | |
90 |
| -| description | string | undefined | change the descrition | |
| 71 | +| Property | Type | Default | Description | |
| 72 | +| -------- | :-------------: | :-------: | ------------------------------------------- | |
| 73 | +| data | ILanguagePicker | undefined | Language select data | |
| 74 | +| onSelect | function | undefined | select the language item when it is pressed | |
91 | 75 |
|
92 | 76 | ## Customization (Optionals)
|
93 | 77 |
|
94 |
| -| Property | Type | Default | Description | |
95 |
| -| -------------- | :-------: | :-------: | ---------------------------------------------------------------------- | |
96 |
| -| enableButton | boolean | false | let you enable the button (must use it for button) | |
97 |
| -| onPress | function | undefined | set your own logic for the button functionality when it is pressed | |
98 |
| -| buttonText | string | undefined | change the button's text | |
99 |
| -| style | ViewStyle | default | set or override the style object for the main container | |
100 |
| -| buttonStyle | ViewStyle | default | set or override the style object for the button style | |
101 |
| -| ImageComponent | Image | default | set your own component instead of default react-native Image component | |
| 78 | +| Property | Type | Default | Description | |
| 79 | +| ----------------- | :-----------------: | :---------------------------------: | ------------------------------------------------------- | |
| 80 | +| flatListStyle | style | default | set or override the style object for the main container | |
| 81 | +| containerWidth | windowWidth \* 0.9 | number | set the main container width | |
| 82 | +| containerHeight | windowHeight \* 0.7 | number | set the main container height | |
| 83 | +| initialIndex | number | undefined | set your selected language item | |
| 84 | +| width | windowWidth \* 0.9 | number | set the language item width | |
| 85 | +| height | 80 | number | set the language item height | |
| 86 | +| backgroundColor | '#FFFFFF' | string | set the language item background color | |
| 87 | +| activeBorderColor | '#504ED9' | strings | set the language item active item border color | |
| 88 | +| textColor | '#2F3452' | string | set to language text | |
| 89 | +| itemContainer | default | default | change the language item container style | |
| 90 | +| imageComponent | default | React.ReactNode / React.ReactNode[] | change the language image component | |
| 91 | +| checkComponent | default | React.ReactNode / React.ReactNode[] | change the check component | |
102 | 92 |
|
103 | 93 | ## Future Plans
|
104 | 94 |
|
105 | 95 | - [x] ~~LICENSE~~
|
106 |
| -- [ ] Write an article about the lib on Medium |
107 |
| - |
108 |
| -# Change Log |
109 |
| - |
110 |
| -Change log will be here ! |
111 | 96 |
|
112 | 97 | ## Author
|
113 | 98 |
|
114 | 99 |
|
115 | 100 |
|
116 | 101 | ## License
|
117 | 102 |
|
118 |
| -React Native Typescript Library Starter is available under the MIT license. See the LICENSE file for more info. |
| 103 | +React Native Language Select is available under the MIT license. See the LICENSE file for more info. |
0 commit comments