You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Are you coming from iOS native development background, newbies to JavaScript & react-native.
@@ -11,7 +12,60 @@ This approach is quite same as them or even more better. No need to add more dyn
11
12
- keyMapper to rename the field names.
12
13
- ease to implement and use.
13
14
15
+
### Installation
16
+
- Run this command `$ npm install react-native-jsmodel --save`
17
+
14
18
### Implementation
19
+
- import in js file as `import JSModel from 'react-native-jsmodel';`[see example](https://github.com/dayitv89/react-native-jsmodel/blob/master/RNTestJSModel/MockModel.js)
20
+
21
+
```JavaScript
22
+
importJSModelfrom'react-native-jsmodel';
23
+
24
+
exportdefaultclassMockModelextendsJSModel {
25
+
message() {
26
+
return'This message added by JSModel: '+this.error.message;
27
+
}
28
+
}
29
+
```
30
+
31
+
- Make object of your model as `const model = new MockModel(Mock);`[see example](https://github.com/dayitv89/react-native-jsmodel/blob/master/RNTestJSModel/index.ios.js#L14)
- Must inherit root object from `JSModel`. e.g. `class Parent extends JSONModel`.
16
70
- Just inherit all models from `JSModel` that need to implement some methods, otherwise no need to create class. e.g. `common` & `root` is implemented but `orignal` is not implemented.
To test this demo code run: `$ npm i && npm start`
55
109
110
+
### Checklist
111
+
-[x] Basic model
112
+
-[x] Object Cloning
113
+
-[x] keyMapper
114
+
-[ ] Array parsing using static method as `JSModel.parseArray(ClassName, jsonArray)`
115
+
-[ ] accessor & mutator concept for props.
116
+
-[ ] Advance Model with type check using `prop-types`
117
+
-[ ] Test cases for model (jest/mocha/ ** or something better**)
118
+
-[ ] travis-ci setup
119
+
56
120
### Feedbacks
57
-
- I love to hear your valuable feedbacks, suggestions & issues. Please raise a issue on the repo or email me @ `[email protected]`.
121
+
- I love to hear your valuable feedbacks, suggestions & issues. Please raise a issue on the repo or email me (as subject: 'jsmodel#issue <topic>') @ `[email protected]`.
0 commit comments